← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~smpettit/openlp/windows-help into lp:openlp

 

Stevan Pettit has proposed merging lp:~smpettit/openlp/windows-help into lp:openlp.

Requested reviews:
  Jonathan Corwin (j-corwin)
Related bugs:
  Bug #802161 in OpenLP: "[windows] Help File should be reachable within OpenLP"
  https://bugs.launchpad.net/openlp/+bug/802161

For more details, see:
https://code.launchpad.net/~smpettit/openlp/windows-help/+merge/66364

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).

Modified code to do a "Windows" check instead of help file check.
Modified build script to create the helpfile as OpenLP.chm

Changed Windows check to os.name
-- 
https://code.launchpad.net/~smpettit/openlp/windows-help/+merge/66364
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2011-06-27 15:56:48 +0000
+++ openlp/core/ui/mainwindow.py	2011-06-29 17:39:29 +0000
@@ -276,7 +276,19 @@
         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(
+        if os.name == u'nt':
+            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',
+                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)
@@ -314,9 +326,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 os.name == u'nt':
+            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()))
@@ -437,6 +454,9 @@
         self.helpAboutItem.setText(translate('OpenLP.MainWindow', '&About'))
         self.helpAboutItem.setStatusTip(
             translate('OpenLP.MainWindow', 'More information about OpenLP'))
+        if os.name == u'nt':
+            self.helpLocalHelpItem.setText(
+                translate('OpenLP.MainWindow', '&Help'))
         self.helpOnlineHelpItem.setText(
             translate('OpenLP.MainWindow', '&Online Help'))
         self.helpWebSiteItem.setText(
@@ -735,6 +755,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

=== modified file 'scripts/windows-builder.py'
--- scripts/windows-builder.py	2011-06-03 16:40:17 +0000
+++ scripts/windows-builder.py	2011-06-29 17:39:29 +0000
@@ -242,10 +242,10 @@
         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'
 


Follow ups