diff --git a/nw/__init__.py b/nw/__init__.py index 31c19ee5..8010c267 100644 --- a/nw/__init__.py +++ b/nw/__init__.py @@ -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:

" + " - %s

Exiting." + ) % ( + __package__, "
 - ".join(errorData) + )) + errApp.exec_() + sys.exit(1) + CONFIG.initConfig(confPath, dataPath) if testMode: diff --git a/nw/config.py b/nw/config.py index 985f4b8d..7bc3bf77 100644 --- a/nw/config.py +++ b/nw/config.py @@ -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