From f7f20f9722cab57ed9fedef58bbcfa3294613989 Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Mon, 27 Jun 2011 00:05:25 -0400 Subject: [PATCH 1/3] Add link to Windows help file from main window --- openlp/core/ui/mainwindow.py | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 0210da52d..4148b40eb 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -269,7 +269,20 @@ class Ui_MainWindow(object): self.helpAboutItem = shortcut_action(mainWindow, u'helpAboutItem', [QtGui.QKeySequence(u'Ctrl+F1')], self.onHelpAboutItemClicked, u':/system/system_about.png', category=UiStrings().Help) - self.helpOnlineHelpItem = shortcut_action( + self.localHelpFile = os.path.join( + AppLocation.get_directory(AppLocation.AppDir), 'Openlp.chm') + self.haveHelpFile = os.path.isfile(self.localHelpFile) + if self.haveHelpFile: + self.helpLocalHelpItem = shortcut_action( + mainWindow, u'helpLocalHelpItem', [QtGui.QKeySequence(u'F1')], + self.onHelpLocalHelpClicked, u':/system/system_about.png', + category=UiStrings().Help) + self.helpOnlineHelpItem = shortcut_action( + mainWindow, u'helpOnlineHelpItem', [QtGui.QKeySequence(u'Alt+F1')], + self.onHelpOnlineHelpClicked, u':/system/system_online_help.png', + category=UiStrings().Help) + else: + self.helpOnlineHelpItem = shortcut_action( mainWindow, u'helpOnlineHelpItem', [QtGui.QKeySequence(u'F1')], self.onHelpOnlineHelpClicked, u':/system/system_online_help.png', category=UiStrings().Help) @@ -307,9 +320,14 @@ class Ui_MainWindow(object): add_actions(self.toolsMenu, (self.toolsAddToolItem, None)) add_actions(self.toolsMenu, (self.toolsOpenDataFolder, None)) add_actions(self.toolsMenu, [self.updateThemeImages]) - add_actions(self.helpMenu, (self.helpDocumentationItem, + add_actions(self.helpMenu, (self.helpDocumentationItem, None)) + if self.haveHelpFile: + add_actions(self.helpMenu, (self.helpLocalHelpItem, self.helpOnlineHelpItem, None, self.helpWebSiteItem, self.helpAboutItem)) + else: + add_actions(self.helpMenu, (self.helpOnlineHelpItem, None, + self.helpWebSiteItem, self.helpAboutItem)) add_actions(self.menuBar, (self.fileMenu.menuAction(), self.viewMenu.menuAction(), self.toolsMenu.menuAction(), self.settingsMenu.menuAction(), self.helpMenu.menuAction())) @@ -425,6 +443,9 @@ class Ui_MainWindow(object): self.helpAboutItem.setText(translate('OpenLP.MainWindow', '&About')) self.helpAboutItem.setStatusTip( translate('OpenLP.MainWindow', 'More information about OpenLP')) + if self.haveHelpFile: + self.helpLocalHelpItem.setText( + translate('OpenLP.MainWindow', '&Help')) self.helpOnlineHelpItem.setText( translate('OpenLP.MainWindow', '&Online Help')) self.helpWebSiteItem.setText( @@ -723,6 +744,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): import webbrowser webbrowser.open_new(u'http://openlp.org/') + def onHelpLocalHelpClicked(self): + """ + Load the local OpenLP help file + """ + os.startfile(self.localHelpFile) + def onHelpOnlineHelpClicked(self): """ Load the online OpenLP manual From 0612a939641b9dfec3067dccbb72bc021db8a773 Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Wed, 29 Jun 2011 10:42:14 -0400 Subject: [PATCH 2/3] Changed helpfile check to Windows condition check. Modified build script to create OpenLP.chm --- openlp/core/ui/mainwindow.py | 11 +++++------ scripts/windows-builder.py | 6 +++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 4148b40eb..2114e17a9 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -269,10 +269,9 @@ class Ui_MainWindow(object): self.helpAboutItem = shortcut_action(mainWindow, u'helpAboutItem', [QtGui.QKeySequence(u'Ctrl+F1')], self.onHelpAboutItemClicked, u':/system/system_about.png', category=UiStrings().Help) - self.localHelpFile = os.path.join( - AppLocation.get_directory(AppLocation.AppDir), 'Openlp.chm') - self.haveHelpFile = os.path.isfile(self.localHelpFile) - if self.haveHelpFile: + if sys.platform[:3] == u'win': + self.localHelpFile = os.path.join( + AppLocation.get_directory(AppLocation.AppDir), 'OpenLP.chm') self.helpLocalHelpItem = shortcut_action( mainWindow, u'helpLocalHelpItem', [QtGui.QKeySequence(u'F1')], self.onHelpLocalHelpClicked, u':/system/system_about.png', @@ -321,7 +320,7 @@ class Ui_MainWindow(object): add_actions(self.toolsMenu, (self.toolsOpenDataFolder, None)) add_actions(self.toolsMenu, [self.updateThemeImages]) add_actions(self.helpMenu, (self.helpDocumentationItem, None)) - if self.haveHelpFile: + if sys.platform[:3] == u'win': add_actions(self.helpMenu, (self.helpLocalHelpItem, self.helpOnlineHelpItem, None, self.helpWebSiteItem, self.helpAboutItem)) @@ -443,7 +442,7 @@ class Ui_MainWindow(object): self.helpAboutItem.setText(translate('OpenLP.MainWindow', '&About')) self.helpAboutItem.setStatusTip( translate('OpenLP.MainWindow', 'More information about OpenLP')) - if self.haveHelpFile: + if sys.platform[:3] == u'win': self.helpLocalHelpItem.setText( translate('OpenLP.MainWindow', '&Help')) self.helpOnlineHelpItem.setText( diff --git a/scripts/windows-builder.py b/scripts/windows-builder.py index 854c927c9..4ab31f893 100644 --- a/scripts/windows-builder.py +++ b/scripts/windows-builder.py @@ -242,10 +242,10 @@ def copy_windows_files(): os.path.join(dist_path, u'LICENSE.txt')) copy(os.path.join(winres_path, u'psvince.dll'), os.path.join(dist_path, u'psvince.dll')) - if os.path.isfile(os.path.join(helpfile_path, u'Openlp.chm')): + if os.path.isfile(os.path.join(helpfile_path, u'OpenLP.chm')): print u' Windows help file found' - copy(os.path.join(helpfile_path, u'Openlp.chm'), - os.path.join(dist_path, u'Openlp.chm')) + copy(os.path.join(helpfile_path, u'OpenLP.chm'), + os.path.join(dist_path, u'OpenLP.chm')) else: print u' WARNING ---- Windows help file not found ---- WARNING' From 97a76369bf3b31d50ea87a5890df706985089813 Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Wed, 29 Jun 2011 13:30:53 -0400 Subject: [PATCH 3/3] Changed Windows test to os.name --- openlp/core/ui/mainwindow.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 2114e17a9..cde13f18a 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -269,7 +269,7 @@ class Ui_MainWindow(object): self.helpAboutItem = shortcut_action(mainWindow, u'helpAboutItem', [QtGui.QKeySequence(u'Ctrl+F1')], self.onHelpAboutItemClicked, u':/system/system_about.png', category=UiStrings().Help) - if sys.platform[:3] == u'win': + if os.name == u'nt': self.localHelpFile = os.path.join( AppLocation.get_directory(AppLocation.AppDir), 'OpenLP.chm') self.helpLocalHelpItem = shortcut_action( @@ -320,7 +320,7 @@ class Ui_MainWindow(object): add_actions(self.toolsMenu, (self.toolsOpenDataFolder, None)) add_actions(self.toolsMenu, [self.updateThemeImages]) add_actions(self.helpMenu, (self.helpDocumentationItem, None)) - if sys.platform[:3] == u'win': + if os.name == u'nt': add_actions(self.helpMenu, (self.helpLocalHelpItem, self.helpOnlineHelpItem, None, self.helpWebSiteItem, self.helpAboutItem)) @@ -442,7 +442,7 @@ class Ui_MainWindow(object): self.helpAboutItem.setText(translate('OpenLP.MainWindow', '&About')) self.helpAboutItem.setStatusTip( translate('OpenLP.MainWindow', 'More information about OpenLP')) - if sys.platform[:3] == u'win': + if os.name == u'nt': self.helpLocalHelpItem.setText( translate('OpenLP.MainWindow', '&Help')) self.helpOnlineHelpItem.setText(