Moved some package checks into the main function so we can pop an error dialog for non-command line users.
This commit is contained in:
+38
-1
@@ -32,7 +32,7 @@ import logging
|
||||
from os import path, remove, rename
|
||||
|
||||
from PyQt5.QtGui import QIcon
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
from PyQt5.QtWidgets import QApplication, QErrorMessage
|
||||
|
||||
from nw.guimain import GuiMain
|
||||
from nw.config import Config
|
||||
@@ -217,6 +217,43 @@ def main(sysArgs=None):
|
||||
|
||||
logger.setLevel(debugLevel)
|
||||
|
||||
# Check Packages and Versions
|
||||
errorData = []
|
||||
if sys.hexversion < 0x030600F0:
|
||||
errorData.append(
|
||||
"At least Python 3.6 is required."
|
||||
)
|
||||
if CONFIG.verQtValue < 50200:
|
||||
errorData.append(
|
||||
"At least Qt5 version 5.2 is required, found %s." % CONFIG.verQtString
|
||||
)
|
||||
if CONFIG.verPyQtValue < 50200:
|
||||
errorData.append(
|
||||
"At least PyQt5 version 5.2 is required, found %s." % CONFIG.verPyQtString
|
||||
)
|
||||
try:
|
||||
import PyQt5.QtSvg
|
||||
except:
|
||||
errorData.append("Python module 'PyQt5.QtSvg' is missing.")
|
||||
try:
|
||||
import lxml
|
||||
except:
|
||||
errorData.append("Python module 'lxml' is missing.")
|
||||
|
||||
if errorData:
|
||||
errApp = QApplication([])
|
||||
errMsg = QErrorMessage()
|
||||
errMsg.setMinimumWidth(500)
|
||||
errMsg.setMinimumHeight(300)
|
||||
errMsg.showMessage((
|
||||
"ERROR: %s cannot start due to the following issues:<br><br>"
|
||||
" - %s<br><br>Exiting."
|
||||
) % (
|
||||
__package__, "<br> - ".join(errorData)
|
||||
))
|
||||
errApp.exec_()
|
||||
sys.exit(1)
|
||||
|
||||
CONFIG.initConfig(confPath, dataPath)
|
||||
|
||||
if testMode:
|
||||
|
||||
@@ -36,6 +36,7 @@ from time import time
|
||||
|
||||
from PyQt5.Qt import PYQT_VERSION_STR
|
||||
from PyQt5.QtCore import QT_VERSION_STR, QStandardPaths, QSysInfo
|
||||
from PyQt5.QtWidgets import QErrorMessage
|
||||
|
||||
from nw.constants import nwFiles, nwUnicode
|
||||
from nw.common import splitVersionNumber, formatTimeStamp
|
||||
|
||||
Reference in New Issue
Block a user