Merge pull request #386 from vkbo/doc_menu

Help Menu Improvements
This commit is contained in:
Veronica K. Berglyd Olsen
2020-08-08 15:09:13 +02:00
committed by GitHub
4 changed files with 21 additions and 9 deletions
+2 -1
View File
@@ -362,8 +362,9 @@ Most features are available as keyboard shortcuts. These are as follows:
":kbd:`F9`", "Re-build the project index."
":kbd:`F10`", "Re-build the project outline."
":kbd:`F11`", "Activate full screen mode."
":kbd:`Shift`:kbd:`F1`", "Open the online documentation in the system default browser."
":kbd:`Shift`:kbd:`F3`", "Find previous occurrence of search word in current document. (Same as :kbd:`Ctrl`:kbd:`Shift`:kbd:`G`)"
":kbd:`Enter`", "If in the project tree, open a document for editing."
":kbd:`Return`", "If in the project tree, open a document for editing."
.. note::
On macOS, replace :kbd:`Ctrl` with :kbd:`Cmd`.
+1
View File
@@ -321,6 +321,7 @@ class Config:
# Check if local help files exist
self.helpPath = path.join(self.assetPath, "help", "novelWriter.qhc")
self.hasHelp = path.isfile(self.helpPath)
self.hasHelp &= path.isfile(path.join(self.assetPath, "help", "novelWriter.qch"))
logger.debug("Config initialisation complete")
+15 -7
View File
@@ -169,12 +169,14 @@ class GuiMainMenu(QMenuBar):
"""Open the documentation in Qt Assistant.
"""
if not self.mainConf.hasHelp:
self._openWebsite(nw.__docurl__)
return False
self.assistProc = QProcess(self)
self.assistProc.start("assistant", ["-collectionFile", self.mainConf.helpPath])
if not self.assistProc.waitForStarted(10000):
self._openWebsite(nw.__docurl__)
return False
return True
@@ -864,15 +866,21 @@ class GuiMainMenu(QMenuBar):
self.helpMenu.addSeparator()
# Document > Documentation
self.aHelp = QAction("Documentation", self)
if self.mainConf.hasHelp and self.mainConf.hasAssistant:
self.aHelp.setStatusTip("View local documentation with Qt Assistant")
self.aHelp.triggered.connect(self._openAssistant)
self.aHelpLoc = QAction("Documentation (Local)", self)
self.aHelpLoc.setStatusTip("View local documentation with Qt Assistant")
self.aHelpLoc.triggered.connect(self._openAssistant)
self.aHelpLoc.setShortcut("F1")
self.helpMenu.addAction(self.aHelpLoc)
self.aHelpWeb = QAction("Documentation (Online)", self)
self.aHelpWeb.setStatusTip("View online documentation")
self.aHelpWeb.triggered.connect(lambda: self._openWebsite(nw.__docurl__))
if self.mainConf.hasHelp and self.mainConf.hasAssistant:
self.aHelpWeb.setShortcut("Shift+F1")
else:
self.aHelp.setStatusTip("View online documentation")
self.aHelp.triggered.connect(lambda: self._openWebsite(nw.__docurl__))
self.aHelp.setShortcut("F1")
self.helpMenu.addAction(self.aHelp)
self.aHelpWeb.setShortcuts(["F1","Shift+F1"])
self.helpMenu.addAction(self.aHelpWeb)
# Document > Go to Website
self.aWebsite = QAction("Open the novelWriter Website", self)
+3 -1
View File
@@ -1034,7 +1034,9 @@ class GuiMain(QMainWindow):
self.addAction(self.mainMenu.aPreferences)
# Help
self.addAction(self.mainMenu.aHelp)
if self.mainConf.hasHelp and self.mainConf.hasAssistant:
self.addAction(self.mainMenu.aHelpLoc)
self.addAction(self.mainMenu.aHelpWeb)
return True