--- a/eric7/Project/UicLoadUi5.py Mon Apr 04 17:43:43 2022 +0200 +++ b/eric7/Project/UicLoadUi5.py Thu Apr 07 18:33:33 2022 +0200 @@ -7,27 +7,25 @@ Module to get the object name, class name or signatures of a Qt form (*.ui). """ -import os import sys import json import xml.etree.ElementTree # secok import contextlib try: - from PyQt5.QtCore import QMetaMethod, QByteArray - from PyQt5.QtGui import QAction - from PyQt5.QtWidgets import QWidget, QApplication + from PyQt5.QtCore import QByteArray, QMetaMethod + from PyQt5.QtWidgets import QAction, QApplication, QWidget from PyQt5 import uic -except ImportError: +except ModuleNotFoundError: print("PyQt5 could not be found.") sys.exit(1) +except ImportError as err: + print("PyQt5 could not be imported. Issue: {0}".format(str(err))) + sys.exit(1) with contextlib.suppress(ImportError): from PyQt5 import QtWebEngineWidgets # __IGNORE_WARNING__ -sys.path.append(os.path.dirname(os.path.dirname(__file__))) -# add the eric package directory - def objectName(formFile, projectPath): """ @@ -38,6 +36,8 @@ @param projectPath directory name of the project @type str """ + sys.path.append(projectPath) + app = QApplication([]) # __IGNORE_WARNING__ try: dlg = uic.loadUi(formFile, package=projectPath) @@ -58,6 +58,8 @@ @param projectPath directory name of the project @type str """ + sys.path.append(projectPath) + app = QApplication([]) # __IGNORE_WARNING__ try: dlg = uic.loadUi(formFile, package=projectPath) @@ -109,6 +111,8 @@ @param projectPath directory name of the project @type str """ + sys.path.append(projectPath) + objectsList = [] app = QApplication([]) # __IGNORE_WARNING__