diff -r 331569d44b19 -r 684261ef2165 eric6/Project/UicLoadUi.py --- a/eric6/Project/UicLoadUi.py Sun Sep 01 17:44:33 2019 +0200 +++ b/eric6/Project/UicLoadUi.py Sun Sep 01 19:40:53 2019 +0200 @@ -14,22 +14,12 @@ import xml.etree.ElementTree try: - from PyQt5.QtCore import qVersion, QMetaMethod, QByteArray + from PyQt5.QtCore import QMetaMethod, QByteArray from PyQt5.QtWidgets import QAction, QWidget, QApplication from PyQt5 import uic - - pyqtType = 5 except ImportError: - try: - # try a potential PyQt4 installation - from PyQt4.QtCore import qVersion, QMetaMethod, QByteArray - from PyQt4.QtGui import QAction, QWidget, QApplication - from PyQt4 import uic - - pyqtType = 4 - except ImportError: - print("Neither PyQt5 nor PyQt4 found.") - sys.exit(1) + print("PyQt5 could not be found.") + sys.exit(1) def objectName(formFile, projectPath): @@ -87,16 +77,15 @@ # I. always check for * mapped = mapped.replace("*", "") - if pyqtType != 4: - # 1. check for const - mapped = mapped.replace("const ", "") - - # 2. replace QString and QStringList - mapped = mapped.replace("QStringList", "list")\ - .replace("QString", "str") - - # 3. replace double by float - mapped = mapped.replace("double", "float") + # 1. check for const + mapped = mapped.replace("const ", "") + + # 2. replace QString and QStringList + mapped = mapped.replace("QStringList", "list")\ + .replace("QString", "str") + + # 3. replace double by float + mapped = mapped.replace("double", "float") return mapped @@ -135,28 +124,16 @@ signatureDict = { "methods": [] } - if qVersion().startswith("5."): - signatureDict["signature"] = "on_{0}_{1}".format( - name, - bytes(metaMethod.methodSignature()).decode() - ) - else: - signatureDict["signature"] = "on_{0}_{1}".format( - name, - metaMethod.signature() - ) + signatureDict["signature"] = "on_{0}_{1}".format( + name, + bytes(metaMethod.methodSignature()).decode() + ) - if qVersion().startswith("5."): - signatureDict["methods"].append("on_{0}_{1}".format( - name, - bytes(metaMethod.methodSignature()) - .decode().split("(")[0] - )) - else: - signatureDict["methods"].append("on_{0}_{1}".format( - name, - metaMethod.signature().split("(")[0] - )) + signatureDict["methods"].append("on_{0}_{1}".format( + name, + bytes(metaMethod.methodSignature()) + .decode().split("(")[0] + )) signatureDict["methods"].append("{0}({1})".format( signatureDict["methods"][-1], ", ".join([ @@ -191,29 +168,17 @@ methNamesSig = ", ".join(parameterNamesList) if methNamesSig: - if qVersion().startswith("5."): - pythonSignature = \ - "on_{0}_{1}(self, {2})".format( - name, - bytes(metaMethod.methodSignature()) - .decode().split("(")[0], - methNamesSig) - else: - pythonSignature = \ - "on_{0}_{1}(self, {2})".format( - name, - metaMethod.signature().split("(")[0], - methNamesSig) - else: - if qVersion().startswith("5."): - pythonSignature = "on_{0}_{1}(self)".format( + pythonSignature = \ + "on_{0}_{1}(self, {2})".format( name, bytes(metaMethod.methodSignature()) - .decode().split("(")[0]) - else: - pythonSignature = "on_{0}_{1}(self)".format( - name, - metaMethod.signature().split("(")[0]) + .decode().split("(")[0], + methNamesSig) + else: + pythonSignature = "on_{0}_{1}(self)".format( + name, + bytes(metaMethod.methodSignature()) + .decode().split("(")[0]) signatureDict["python_signature"] = pythonSignature objectDict["methods"].append(signatureDict)