Fri, 21 Apr 2023 16:45:32 +0200
Create Code Dialog
- Fixed a situation where the helper processes actually worked but their exit status was changed by Qt (see issue 462).
--- a/src/eric7/Project/CreateDialogCodeDialog.py Tue Apr 18 14:21:29 2023 +0200 +++ b/src/eric7/Project/CreateDialogCodeDialog.py Fri Apr 21 16:45:32 2023 +0200 @@ -217,11 +217,20 @@ if started and finished: output = proc.readAllStandardError() outText = str(output, "utf-8", "replace") - if "@@eric_start@@" in outText and "@@eric_end@@" in outText: + if "@@eric_start@@" in outText: + # it is something we sent via UicLoadUi[56].py + outText = outText.split("@@eric_start@@")[1] + ok = True + elif "@@eric_error@@" in outText: # it is something we sent via UicLoadUi[56].py - outText = outText.split("@@eric_start@@")[1].split("@@eric_end@@")[0] - if proc.exitCode() == 0: - ok = True + outText = outText.split("@@eric_error@@")[1] + ok = False + else: + ok = False + if "@@eric_end@@" in outText: + # it is something we sent via UicLoadUi[56].py + outText = outText.split("@@eric_end@@")[0] + if ok: uicText = outText.strip() else: EricMessageBox.critical(
--- a/src/eric7/Project/UicLoadUi5.py Tue Apr 18 14:21:29 2023 +0200 +++ b/src/eric7/Project/UicLoadUi5.py Fri Apr 21 16:45:32 2023 +0200 @@ -15,7 +15,7 @@ def _printout(dataString): """ - Function to print the given string to sys.stdout with a guard string. + Function to print the given string as output to sys.stderr with a guard string. @param dataString string to be printed @type str @@ -23,6 +23,16 @@ print("@@eric_start@@{0}@@eric_end@@".format(dataString), file=sys.stderr) +def _printerr(dataString): + """ + Function to print the given string as error to sys.stdoerr with a guard string. + + @param dataString string to be printed + @type str + """ + print("@@eric_error@@{0}@@eric_end@@".format(dataString), file=sys.stderr) + + try: from PyQt5 import uic from PyQt5.QtCore import QByteArray, QMetaMethod @@ -31,7 +41,7 @@ _printout("PyQt5 could not be found.") sys.exit(1) except ImportError as err: - _printout("PyQt5 could not be imported. Issue: {0}".format(str(err))) + _printerr("PyQt5 could not be imported. Issue: {0}".format(str(err))) sys.exit(1) with contextlib.suppress(ImportError): @@ -55,7 +65,7 @@ _printout(dlg.objectName()) sys.exit(0) except (AttributeError, ImportError, xml.etree.ElementTree.ParseError) as err: - _printout(str(err)) + _printerr(str(err)) sys.exit(1) @@ -76,7 +86,7 @@ _printout(dlg.metaObject().className()) sys.exit(0) except (AttributeError, ImportError, xml.etree.ElementTree.ParseError) as err: - _printout(str(err)) + _printerr(str(err)) sys.exit(1) @@ -204,13 +214,13 @@ _printout(json.dumps(objectsList)) sys.exit(0) except (AttributeError, ImportError, xml.etree.ElementTree.ParseError) as err: - _printout(str(err)) + _printerr(str(err)) sys.exit(1) if __name__ == "__main__": if len(sys.argv) != 4: - _printout("Wrong number of arguments.") + _printerr("Wrong number of arguments.") sys.exit(1) if sys.argv[1] == "object_name": @@ -220,7 +230,7 @@ elif sys.argv[1] == "signatures": signatures(sys.argv[2], sys.argv[3]) else: - _printout("Unknow operation given.") + _printerr("Unknow operation given.") sys.exit(1) #
--- a/src/eric7/Project/UicLoadUi6.py Tue Apr 18 14:21:29 2023 +0200 +++ b/src/eric7/Project/UicLoadUi6.py Fri Apr 21 16:45:32 2023 +0200 @@ -16,7 +16,7 @@ def _printout(dataString): """ - Function to print the given string to sys.stdout with a guard string. + Function to print the given string as output to sys.stderr with a guard string. @param dataString string to be printed @type str @@ -24,6 +24,16 @@ print("@@eric_start@@{0}@@eric_end@@".format(dataString), file=sys.stderr) +def _printerr(dataString): + """ + Function to print the given string as error to sys.stdoerr with a guard string. + + @param dataString string to be printed + @type str + """ + print("@@eric_error@@{0}@@eric_end@@".format(dataString), file=sys.stderr) + + try: from PyQt6 import uic from PyQt6.QtCore import QByteArray, QMetaMethod @@ -33,7 +43,7 @@ _printout("PyQt6 could not be found.") sys.exit(1) except ImportError as err: - _printout("PyQt6 could not be imported. Issue: {0}".format(str(err))) + _printerr("PyQt6 could not be imported. Issue: {0}".format(str(err))) sys.exit(1) with contextlib.suppress(ImportError): @@ -60,7 +70,7 @@ _printout(dlg.objectName()) sys.exit(0) except (AttributeError, ImportError, xml.etree.ElementTree.ParseError) as err: - _printout(str(err)) + _printerr(str(err)) sys.exit(1) @@ -81,7 +91,7 @@ _printout(dlg.metaObject().className()) sys.exit(0) except (AttributeError, ImportError, xml.etree.ElementTree.ParseError) as err: - _printout(str(err)) + _printerr(str(err)) sys.exit(1) @@ -209,13 +219,13 @@ _printout(json.dumps(objectsList)) sys.exit(0) except (AttributeError, ImportError, xml.etree.ElementTree.ParseError) as err: - _printout(str(err)) + _printerr(str(err)) sys.exit(1) if __name__ == "__main__": if len(sys.argv) != 4: - _printout("Wrong number of arguments.") + _printerr("Wrong number of arguments.") sys.exit(1) if sys.argv[1] == "object_name": @@ -225,7 +235,7 @@ elif sys.argv[1] == "signatures": signatures(sys.argv[2], sys.argv[3]) else: - _printout("Unknow operation given.") + _printerr("Unknow operation given.") sys.exit(1) #