Added website and check for updates in menu bar

This commit is contained in:
Manuel Cortez 2018-02-26 10:06:48 -06:00
parent 0a2307d56f
commit 68f73501ed
2 changed files with 12 additions and 0 deletions

View File

@ -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()

View File

@ -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)