Added more system checks and help now opens the documentation website

This commit is contained in:
Veronica K. B. Olsen
2019-10-24 21:13:11 +02:00
parent 3ae87b6cf4
commit 4a98f58a20
7 changed files with 42 additions and 649 deletions
+1
View File
@@ -28,6 +28,7 @@ __maintainer__ = "Veronica Berglyd Olsen"
__email__ = "code@vkbo.net"
__status__ = "Development"
__url__ = "https://github.com/vkbo/novelWriter"
__docurl__ = "https://novelwriter.readthedocs.io"
__credits__ = [
"Veronica Berglyd Olsen (developer)",
"Marian Lückhof (contributor, tester)"
+25
View File
@@ -12,6 +12,7 @@
import logging
import configparser
import sys
import nw
from os import path, mkdir, getcwd
@@ -114,6 +115,30 @@ class Config:
self.verPyQtPatch = verQt[2]
self.verPyQtValue = verQt[3]
# Check Python Version
self.verPyString = sys.version.split()[0]
self.verPyMajor = sys.version_info[0]
self.verPyMinor = sys.version_info[1]
self.verPyPatch = sys.version_info[2]
self.verPyHexVal = sys.hexversion
# Check OS Type
self.osType = sys.platform
self.osLinux = False
self.osWindows = False
self.osDarwin = False
self.osUnknown = False
if self.osType.startswith("linux"):
self.osLinux = True
elif self.osType.startswith("darwin"):
self.osDarwin = True
elif self.osType.startswith("win32"):
self.osWindows = True
elif self.osType.startswith("cygwin"):
self.osWindows = True
else:
self.osUnknown = True
return
##
+1 -13
View File
@@ -13,7 +13,7 @@
import logging
import nw
from PyQt5.QtCore import Qt, QUrl
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QTextBrowser
from PyQt5.QtGui import QTextOption, QFont, QPalette, QColor
@@ -91,10 +91,6 @@ class GuiDocViewer(QTextBrowser):
def loadText(self, tHandle):
if tHandle == "Help":
self.loadHelp()
return True
tItem = self.theProject.getItem(tHandle)
if tItem is None:
logger.warning("Item not found")
@@ -118,14 +114,6 @@ class GuiDocViewer(QTextBrowser):
return True
def loadHelp(self):
self.clearViewer()
self.setSearchPaths([self.mainConf.helpPath])
self.setSource(QUrl("index.html"))
return True
##
# Internal Functions
##
+7 -2
View File
@@ -13,7 +13,8 @@
import logging
import nw
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import QUrl
from PyQt5.QtGui import QIcon, QDesktopServices
from PyQt5.QtWidgets import QMenuBar, QAction, QMessageBox
from nw.enum import nwItemType, nwItemClass, nwDocAction
@@ -145,6 +146,10 @@ class GuiMainMenu(QMenuBar):
msgBox.aboutQt(self.theParent,"About Qt")
return True
def _openHelp(self):
QDesktopServices.openUrl(QUrl(nw.__docurl__))
return True
##
# Menu Builders
##
@@ -604,7 +609,7 @@ class GuiMainMenu(QMenuBar):
menuItem = QAction("Documentation", self)
menuItem.setStatusTip("View documentation")
menuItem.setShortcut("F1")
menuItem.triggered.connect(lambda : self.theParent.viewDocument("Help"))
menuItem.triggered.connect(self._openHelp)
self.helpMenu.addAction(menuItem)
return
+4 -2
View File
@@ -60,8 +60,10 @@ class GuiMain(QMainWindow):
self.theIndex = NWIndex(self.theProject, self)
self.hasProject = False
logger.info("Qt5 Version: %s (%d)" % (self.mainConf.verQtString, self.mainConf.verQtValue))
logger.info("PyQt5 Version: %s (%d)" % (self.mainConf.verPyQtString, self.mainConf.verPyQtValue))
logger.info("OS: %s" % (self.mainConf.osType))
logger.info("Qt5 Version: %s (%d)" % (self.mainConf.verQtString, self.mainConf.verQtValue))
logger.info("PyQt5 Version: %s (%d)" % (self.mainConf.verPyQtString, self.mainConf.verPyQtValue))
logger.info("Python Version: %s (0x%x)" % (self.mainConf.verPyString, self.mainConf.verPyHexVal))
self.resize(*self.mainConf.winGeometry)
self._setWindowTitle()