better checking before launching local help
This commit is contained in:
@@ -321,6 +321,7 @@ class Config:
|
|||||||
# Check if local help files exist
|
# Check if local help files exist
|
||||||
self.helpPath = path.join(self.assetPath, "help", "novelWriter.qhc")
|
self.helpPath = path.join(self.assetPath, "help", "novelWriter.qhc")
|
||||||
self.hasHelp = path.isfile(self.helpPath)
|
self.hasHelp = path.isfile(self.helpPath)
|
||||||
|
self.hasHelp &= path.isfile(path.join(self.assetPath, "help", "novelWriter.qch"))
|
||||||
|
|
||||||
logger.debug("Config initialisation complete")
|
logger.debug("Config initialisation complete")
|
||||||
|
|
||||||
|
|||||||
+15
-7
@@ -169,12 +169,14 @@ class GuiMainMenu(QMenuBar):
|
|||||||
"""Open the documentation in Qt Assistant.
|
"""Open the documentation in Qt Assistant.
|
||||||
"""
|
"""
|
||||||
if not self.mainConf.hasHelp:
|
if not self.mainConf.hasHelp:
|
||||||
|
self._openWebsite(nw.__docurl__)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
self.assistProc = QProcess(self)
|
self.assistProc = QProcess(self)
|
||||||
self.assistProc.start("assistant", ["-collectionFile", self.mainConf.helpPath])
|
self.assistProc.start("assistant", ["-collectionFile", self.mainConf.helpPath])
|
||||||
|
|
||||||
if not self.assistProc.waitForStarted(10000):
|
if not self.assistProc.waitForStarted(10000):
|
||||||
|
self._openWebsite(nw.__docurl__)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
@@ -864,15 +866,21 @@ class GuiMainMenu(QMenuBar):
|
|||||||
self.helpMenu.addSeparator()
|
self.helpMenu.addSeparator()
|
||||||
|
|
||||||
# Document > Documentation
|
# Document > Documentation
|
||||||
self.aHelp = QAction("Documentation", self)
|
|
||||||
if self.mainConf.hasHelp and self.mainConf.hasAssistant:
|
if self.mainConf.hasHelp and self.mainConf.hasAssistant:
|
||||||
self.aHelp.setStatusTip("View local documentation with Qt Assistant")
|
self.aHelpLoc = QAction("Documentation (Local)", self)
|
||||||
self.aHelp.triggered.connect(self._openAssistant)
|
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:
|
else:
|
||||||
self.aHelp.setStatusTip("View online documentation")
|
self.aHelpWeb.setShortcuts(["F1","Shift+F1"])
|
||||||
self.aHelp.triggered.connect(lambda: self._openWebsite(nw.__docurl__))
|
self.helpMenu.addAction(self.aHelpWeb)
|
||||||
self.aHelp.setShortcut("F1")
|
|
||||||
self.helpMenu.addAction(self.aHelp)
|
|
||||||
|
|
||||||
# Document > Go to Website
|
# Document > Go to Website
|
||||||
self.aWebsite = QAction("Open the novelWriter Website", self)
|
self.aWebsite = QAction("Open the novelWriter Website", self)
|
||||||
|
|||||||
+3
-1
@@ -1034,7 +1034,9 @@ class GuiMain(QMainWindow):
|
|||||||
self.addAction(self.mainMenu.aPreferences)
|
self.addAction(self.mainMenu.aPreferences)
|
||||||
|
|
||||||
# Help
|
# 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
|
return True
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user