Added documentation in the help menu

This commit is contained in:
Manuel Cortez 2016-06-29 13:16:35 -05:00
parent 70a3f2fff3
commit 5099ac9621
3 changed files with 15 additions and 1 deletions

View File

@ -13,9 +13,11 @@ import webbrowser
import logging import logging
import longpoolthread import longpoolthread
import selector import selector
from vk.exceptions import VkAuthError
from pubsub import pub from pubsub import pub
from mysc.repeating_timer import RepeatingTimer from mysc.repeating_timer import RepeatingTimer
from mysc.thread_utils import call_threaded from mysc.thread_utils import call_threaded
from mysc import localization
from sessionmanager import session from sessionmanager import session
from wxUI import (mainWindow, commonMessages) from wxUI import (mainWindow, commonMessages)
from wxUI.dialogs import search as searchDialogs from wxUI.dialogs import search as searchDialogs
@ -126,6 +128,7 @@ class Controller(object):
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.new_timeline, menuitem=self.window.timeline) widgetUtils.connect_event(self.window, widgetUtils.MENU, self.new_timeline, menuitem=self.window.timeline)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.create_audio_album, menuitem=self.window.audio_album) widgetUtils.connect_event(self.window, widgetUtils.MENU, self.create_audio_album, menuitem=self.window.audio_album)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.delete_audio_album, menuitem=self.window.delete_audio_album) widgetUtils.connect_event(self.window, widgetUtils.MENU, self.delete_audio_album, menuitem=self.window.delete_audio_album)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.check_documentation, menuitem=self.window.documentation)
pub.subscribe(self.get_chat, "order-sent-message") pub.subscribe(self.get_chat, "order-sent-message")
def disconnect_events(self): def disconnect_events(self):
@ -190,7 +193,10 @@ class Controller(object):
def exit(self, *args, **kwargs): def exit(self, *args, **kwargs):
log.debug("Receibed an exit signal. closing...") log.debug("Receibed an exit signal. closing...")
try:
self.session.vk.client.account.setOffline() self.session.vk.client.account.setOffline()
except VkAuthError:
pass
self.disconnect_events() self.disconnect_events()
self.window.Destroy() self.window.Destroy()
wx.GetApp().ExitMainLoop() wx.GetApp().ExitMainLoop()
@ -399,3 +405,9 @@ class Controller(object):
self.buffers.remove(buffer) self.buffers.remove(buffer)
del buffer del buffer
self.session.audio_albums = self.session.vk.client.audio.getAlbums(owner_id=self.session.user_id)["items"] self.session.audio_albums = self.session.vk.client.audio.getAlbums(owner_id=self.session.user_id)["items"]
def check_documentation(self, *args, **kwargs):
lang = localization.get("documentation")
os.chdir("documentation/%s" % (lang,))
webbrowser.open("manual.html")
os.chdir("../../")

View File

@ -23,6 +23,7 @@ class newSessionDialog(widgetUtils.BaseDialog):
sizer.Add(b1, 0, wx.ALL, 5) sizer.Add(b1, 0, wx.ALL, 5)
sizer.Add(b2, 0, wx.ALL, 5) sizer.Add(b2, 0, wx.ALL, 5)
ok = wx.Button(panel, wx.ID_OK) ok = wx.Button(panel, wx.ID_OK)
ok.SetDefault()
cancel = wx.Button(panel, wx.ID_CANCEL) cancel = wx.Button(panel, wx.ID_CANCEL)
btnb = wx.BoxSizer(wx.HORIZONTAL) btnb = wx.BoxSizer(wx.HORIZONTAL)
btnb.Add(ok, 0, wx.ALL, 5) btnb.Add(ok, 0, wx.ALL, 5)

View File

@ -25,6 +25,7 @@ class mainWindow(wx.Frame):
mb.Append(buffer, _(u"Buffer")) mb.Append(buffer, _(u"Buffer"))
help_ = wx.Menu() help_ = wx.Menu()
self.about = help_.Append(wx.NewId(), _(u"About {0}").format(application.name,)) self.about = help_.Append(wx.NewId(), _(u"About {0}").format(application.name,))
self.documentation = help_.Append(wx.NewId(), _(u"Manual"))
self.check_for_updates = help_.Append(wx.NewId(), _(u"Check for updates")) self.check_for_updates = help_.Append(wx.NewId(), _(u"Check for updates"))
self.changelog = help_.Append(wx.NewId(), _(u"Chan&gelog")) self.changelog = help_.Append(wx.NewId(), _(u"Chan&gelog"))
mb.Append(help_, _(u"Help")) mb.Append(help_, _(u"Help"))