Visit website & about the program work from the help menu

This commit is contained in:
Manuel Cortez 2015-02-26 16:09:26 -06:00
parent 458d607b9a
commit 76d8c292c9
2 changed files with 23 additions and 2 deletions

View File

@ -1,4 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import application
from wxUI import (view, dialogs, commonMessageDialogs) from wxUI import (view, dialogs, commonMessageDialogs)
from twitter import utils from twitter import utils
from sessionmanager import manager from sessionmanager import manager
@ -26,6 +27,7 @@ if platform.system() == "Windows":
from keyboard_handler.wx_handler import WXKeyboardHandler from keyboard_handler.wx_handler import WXKeyboardHandler
import userActionsController import userActionsController
import trendingTopics import trendingTopics
import webbrowser
log = logging.getLogger("mainController") 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.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.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.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) widgetUtils.connect_event(self.view.nb, widgetUtils.NOTEBOOK_PAGE_CHANGED, self.buffer_changed)
def __init__(self): def __init__(self):
@ -1044,5 +1049,11 @@ class Controller(object):
km = self.create_invisible_keyboard_shorcuts() km = self.create_invisible_keyboard_shorcuts()
self.unregister_invisible_keyboard_shorcuts(km) 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): def __del__(self):
config.app.write() config.app.write()

View File

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import wx import wx
import application
class mainFrame(wx.Frame): class mainFrame(wx.Frame):
""" Main class of the Frame. This is the Main Window.""" """ 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 = help.Append(wx.NewId(), _(u"&Report an error"))
self.reportError.Enable(False) self.reportError.Enable(False)
self.visit_website = help.Append(-1, _(u"TW Blue &website")) 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 = help.Append(-1, _(u"About &TW Blue"))
self.about.Enable(False)
# Add all to the menu Bar # Add all to the menu Bar
menuBar.Append(app, _(u"&Application")) menuBar.Append(app, _(u"&Application"))
@ -173,5 +172,16 @@ class mainFrame(wx.Frame):
def delete_buffer(self, pos): def delete_buffer(self, pos):
self.nb.DeletePage(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(): def no_update_available():
wx.MessageDialog(None, _(u"Your TW Blue version is up to date"), _(u"Update"), style=wx.OK).ShowModal() wx.MessageDialog(None, _(u"Your TW Blue version is up to date"), _(u"Update"), style=wx.OK).ShowModal()