From 76d8c292c9d2d64c81505511195bc0c2bd2f0047 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Thu, 26 Feb 2015 16:09:26 -0600 Subject: [PATCH] Visit website & about the program work from the help menu --- src/controller/mainController.py | 11 +++++++++++ src/wxUI/view.py | 14 ++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/controller/mainController.py b/src/controller/mainController.py index 2b0361ce..0ee8be58 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +import application from wxUI import (view, dialogs, commonMessageDialogs) from twitter import utils from sessionmanager import manager @@ -26,6 +27,7 @@ if platform.system() == "Windows": from keyboard_handler.wx_handler import WXKeyboardHandler import userActionsController import trendingTopics +import webbrowser log = logging.getLogger("mainController") @@ -142,6 +144,9 @@ class Controller(object): widgetUtils.connect_event(self.view, widgetUtils.MENU, self.clear_buffer, menuitem=self.view.clear) widgetUtils.connect_event(self.view, widgetUtils.MENU, self.remove_buffer, self.view.deleteTl) widgetUtils.connect_event(self.view, widgetUtils.MENU, self.check_for_updates, self.view.check_for_updates) + widgetUtils.connect_event(self.view, widgetUtils.MENU, self.about, menuitem=self.view.about) + widgetUtils.connect_event(self.view, widgetUtils.MENU, self.visit_website, menuitem=self.view.visit_website) + widgetUtils.connect_event(self.view.nb, widgetUtils.NOTEBOOK_PAGE_CHANGED, self.buffer_changed) def __init__(self): @@ -1044,5 +1049,11 @@ class Controller(object): km = self.create_invisible_keyboard_shorcuts() self.unregister_invisible_keyboard_shorcuts(km) + def about(self, *args, **kwargs): + self.view.about_dialog() + + def visit_website(self, *args, **kwargs): + webbrowser.open(application.url) + def __del__(self): config.app.write() \ No newline at end of file diff --git a/src/wxUI/view.py b/src/wxUI/view.py index 227c1735..0bf89fd7 100644 --- a/src/wxUI/view.py +++ b/src/wxUI/view.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- import wx +import application class mainFrame(wx.Frame): """ Main class of the Frame. This is the Main Window.""" @@ -79,9 +80,7 @@ class mainFrame(wx.Frame): self.reportError = help.Append(wx.NewId(), _(u"&Report an error")) self.reportError.Enable(False) self.visit_website = help.Append(-1, _(u"TW Blue &website")) - self.visit_website.Enable(False) self.about = help.Append(-1, _(u"About &TW Blue")) - self.about.Enable(False) # Add all to the menu Bar menuBar.Append(app, _(u"&Application")) @@ -173,5 +172,16 @@ class mainFrame(wx.Frame): def delete_buffer(self, pos): self.nb.DeletePage(pos) + def about_dialog(self): + info = wx.AboutDialogInfo() + info.SetName(application.name) + info.SetVersion(application.version) + info.SetDescription(application.description) + info.SetCopyright(application.copyright) + info.SetTranslators(application.translators) +# info.SetLicence(application.licence) + info.AddDeveloper(application.author) + wx.AboutBox(info) + def no_update_available(): wx.MessageDialog(None, _(u"Your TW Blue version is up to date"), _(u"Update"), style=wx.OK).ShowModal()