From 68f73501edcec89b79039b548680f7bdbc4fbd69 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Mon, 26 Feb 2018 10:06:48 -0600 Subject: [PATCH] Added website and check for updates in menu bar --- src/controller/mainController.py | 10 ++++++++++ src/wxUI/mainWindow.py | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/controller/mainController.py b/src/controller/mainController.py index 129fadb..44427f0 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -1,9 +1,11 @@ # -*- coding: utf-8 -*- """ main controller for MusicDL""" +import webbrowser import wx import logging import widgetUtils import utils +import application from pubsub import pub from wxUI import mainWindow, menus from extractors import zaycev, youtube @@ -61,6 +63,8 @@ class Controller(object): widgetUtils.connect_event(self.window, widgetUtils.MENU, self.on_mute, menuitem=self.window.player_mute) widgetUtils.connect_event(self.window, widgetUtils.MENU, self.on_shuffle, menuitem=self.window.player_shuffle) widgetUtils.connect_event(self.window, widgetUtils.MENU, self.window.about_dialog, menuitem=self.window.about) + widgetUtils.connect_event(self.window, widgetUtils.MENU, self.on_check_for_updates, menuitem=self.window.check_for_updates) + widgetUtils.connect_event(self.window, widgetUtils.MENU, self.on_visit_website, menuitem=self.window.website) widgetUtils.connect_event(self.window.previous, widgetUtils.BUTTON_PRESSED, self.on_previous) widgetUtils.connect_event(self.window.play, widgetUtils.BUTTON_PRESSED, self.on_play_pause) widgetUtils.connect_event(self.window.stop, widgetUtils.BUTTON_PRESSED, self.on_stop) @@ -180,6 +184,12 @@ class Controller(object): """ Function used for changing the status bar from outside the main controller module.""" self.window.change_status("{0} {1}".format(status, self.get_status_info())) + def on_visit_website(self, *args, **kwargs): + webbrowser.open_new_tab(application.url) + + def on_check_for_updates(self, *args, **kwargs): + utils.call_threaded(updater.do_update) + # real functions. These functions really are doing the work. def search(self, *args, **kwargs): text = self.window.get_text() diff --git a/src/wxUI/mainWindow.py b/src/wxUI/mainWindow.py index 1f830cd..c7cbb72 100644 --- a/src/wxUI/mainWindow.py +++ b/src/wxUI/mainWindow.py @@ -21,6 +21,7 @@ class mainWindow(wx.Frame): help_ = wx.Menu() self.about = help_.Append(wx.NewId(), _(u"About {0}").format(application.name,)) self.check_for_updates = help_.Append(wx.NewId(), _(u"Check for updates")) + self.website = help_.Append(wx.NewId(), _("Visit website")) mb.Append(player, _(u"Player")) mb.Append(help_, _(u"Help")) self.SetMenuBar(mb) @@ -80,6 +81,7 @@ class mainWindow(wx.Frame): info.SetVersion(application.version) info.SetDescription(application.description) info.SetCopyright(application.copyright) + info.SetWebSite(application.url) # info.SetTranslators(application.translators) # info.SetLicence(application.licence) info.AddDeveloper(application.author)