openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #10505
[Merge] lp:~smpettit/openlp/windows-help into lp:openlp
Stevan Pettit has proposed merging lp:~smpettit/openlp/windows-help into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~smpettit/openlp/windows-help/+merge/65976
Bug #802161
Added code to create a main window menu item to display the Windows help file (openlp.chm) if it exists on the users machine.
If it exists, F1 will display the local file, Alt-F1 will display the online help.
If the help file does not exist, F1 will display the Online help (as it currently does).
--
https://code.launchpad.net/~smpettit/openlp/windows-help/+merge/65976
Your team OpenLP Core is requested to review the proposed merge of lp:~smpettit/openlp/windows-help into lp:openlp.
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2011-06-26 05:58:29 +0000
+++ openlp/core/ui/mainwindow.py 2011-06-27 13:11:19 +0000
@@ -269,7 +269,20 @@
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 @@
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 @@
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 @@
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
Follow ups