1019 pylupdate process. |
1019 pylupdate process. |
1020 |
1020 |
1021 @param proc reference to the process |
1021 @param proc reference to the process |
1022 @type QProcess |
1022 @type QProcess |
1023 """ |
1023 """ |
1024 self.__readStdout(proc, "{0}: ".format(self.pylupdate)) |
1024 out = self.__readStdout(proc, "{0}: ".format(self.pylupdate)) |
|
1025 for index in range(len(self.__pylupdateProcesses)): |
|
1026 if proc is self.__pylupdateProcesses[index][0]: |
|
1027 self.__pylupdateProcesses[index][2].append(out) |
|
1028 break |
1025 |
1029 |
1026 def __readStdoutLrelease(self, proc): |
1030 def __readStdoutLrelease(self, proc): |
1027 """ |
1031 """ |
1028 Private slot to handle the readyReadStandardOutput signal of the |
1032 Private slot to handle the readyReadStandardOutput signal of the |
1029 lrelease process. |
1033 lrelease process. |
1030 |
1034 |
1031 @param proc reference to the process |
1035 @param proc reference to the process |
1032 @type QProcess |
1036 @type QProcess |
1033 """ |
1037 """ |
1034 self.__readStdout(proc, "lrelease: ") |
1038 out = self.__readStdout(proc, "lrelease: ") |
|
1039 for index in range(len(self.__lreleaseProcesses)): |
|
1040 if proc is self.__lreleaseProcesses[index][0]: |
|
1041 self.__lreleaseProcesses[index][1].append(out) |
|
1042 break |
1035 |
1043 |
1036 def __readStdout(self, proc, ps): |
1044 def __readStdout(self, proc, ps): |
1037 """ |
1045 """ |
1038 Private method to read from a process' stdout channel. |
1046 Private method to read from a process' stdout channel. |
1039 |
1047 |
1040 @param proc process to read from (QProcess) |
1048 @param proc process to read from |
1041 @param ps prompt string (string) |
1049 @type QProcess |
|
1050 @param ps prompt string |
|
1051 @type str |
|
1052 @return string read from the process |
|
1053 @rtype str |
1042 """ |
1054 """ |
1043 ioEncoding = Preferences.getSystem("IOEncoding") |
1055 ioEncoding = Preferences.getSystem("IOEncoding") |
|
1056 out = "" |
1044 |
1057 |
1045 proc.setReadChannel(QProcess.ProcessChannel.StandardOutput) |
1058 proc.setReadChannel(QProcess.ProcessChannel.StandardOutput) |
1046 while proc and proc.canReadLine(): |
1059 while proc and proc.canReadLine(): |
1047 s = ps |
1060 out += ps |
1048 output = str(proc.readLine(), ioEncoding, "replace") |
1061 output = str(proc.readLine(), ioEncoding, "replace") |
1049 s += output |
1062 out += output |
1050 self.appendStdout.emit(s) |
1063 |
|
1064 return out |
1051 |
1065 |
1052 def __readStderrLupdate(self, proc): |
1066 def __readStderrLupdate(self, proc): |
1053 """ |
1067 """ |
1054 Private slot to handle the readyReadStandardError signal of the |
1068 Private slot to handle the readyReadStandardError signal of the |
1055 pylupdate5 / pylupdate6 / pyside2-lupdate / pyside6-lupdate process. |
1069 pylupdate5 / pylupdate6 / pyside2-lupdate / pyside6-lupdate process. |
1130 kind=NotificationTypes.CRITICAL, |
1144 kind=NotificationTypes.CRITICAL, |
1131 timeout=0, |
1145 timeout=0, |
1132 ) |
1146 ) |
1133 |
1147 |
1134 for index in range(len(self.__pylupdateProcesses)): |
1148 for index in range(len(self.__pylupdateProcesses)): |
1135 if proc == self.__pylupdateProcesses[index][0]: |
1149 if proc is self.__pylupdateProcesses[index][0]: |
1136 tmpProjectFile = self.__pylupdateProcesses[index][1] |
1150 tmpProjectFile = self.__pylupdateProcesses[index][1] |
1137 if tmpProjectFile: |
1151 if tmpProjectFile: |
1138 with contextlib.suppress(OSError): |
1152 with contextlib.suppress(OSError): |
1139 self.__tmpProjects.remove(tmpProjectFile) |
1153 self.__tmpProjects.remove(tmpProjectFile) |
1140 os.remove(tmpProjectFile) |
1154 os.remove(tmpProjectFile) |
|
1155 |
|
1156 if self.__pylupdateProcesses[index][2]: |
|
1157 self.appendStdout.emit("".join(self.__pylupdateProcesses[index][2])) |
|
1158 |
1141 del self.__pylupdateProcesses[index] |
1159 del self.__pylupdateProcesses[index] |
1142 break |
1160 break |
1143 |
1161 |
1144 if not self.__pylupdateProcesses: |
1162 if not self.__pylupdateProcesses: |
1145 # all done |
1163 # all done |
1280 |
1298 |
1281 proc.start(self.pylupdate, args) |
1299 proc.start(self.pylupdate, args) |
1282 procStarted = proc.waitForStarted() |
1300 procStarted = proc.waitForStarted() |
1283 if procStarted: |
1301 if procStarted: |
1284 self.pylupdateProcRunning = True |
1302 self.pylupdateProcRunning = True |
1285 self.__pylupdateProcesses.append((proc, "")) |
1303 self.__pylupdateProcesses.append((proc, "", [])) |
1286 else: |
1304 else: |
1287 with EricOverridenCursor(): |
1305 with EricOverridenCursor(): |
1288 EricMessageBox.critical( |
1306 EricMessageBox.critical( |
1289 self, |
1307 self, |
1290 self.tr("Process Generation Error"), |
1308 self.tr("Process Generation Error"), |
1328 |
1346 |
1329 proc.start(self.pylupdate, args) |
1347 proc.start(self.pylupdate, args) |
1330 procStarted = proc.waitForStarted() |
1348 procStarted = proc.waitForStarted() |
1331 if procStarted: |
1349 if procStarted: |
1332 self.pylupdateProcRunning = True |
1350 self.pylupdateProcRunning = True |
1333 self.__pylupdateProcesses.append((proc, tempProjectFile)) |
1351 self.__pylupdateProcesses.append((proc, tempProjectFile, [])) |
1334 else: |
1352 else: |
1335 with EricOverridenCursor(): |
1353 with EricOverridenCursor(): |
1336 EricMessageBox.critical( |
1354 EricMessageBox.critical( |
1337 self, |
1355 self, |
1338 self.tr("Process Generation Error"), |
1356 self.tr("Process Generation Error"), |
1429 kind=NotificationTypes.CRITICAL, |
1447 kind=NotificationTypes.CRITICAL, |
1430 timeout=0, |
1448 timeout=0, |
1431 ) |
1449 ) |
1432 |
1450 |
1433 for index in range(len(self.__lreleaseProcesses)): |
1451 for index in range(len(self.__lreleaseProcesses)): |
1434 if proc == self.__lreleaseProcesses[index]: |
1452 if proc is self.__lreleaseProcesses[index][0]: |
|
1453 if self.__lreleaseProcesses[index][1]: |
|
1454 self.appendStdout.emit("".join(self.__lreleaseProcesses[index][1])) |
|
1455 |
1435 del self.__lreleaseProcesses[index] |
1456 del self.__lreleaseProcesses[index] |
1436 break |
1457 break |
1437 if not self.__lreleaseProcesses: |
1458 if not self.__lreleaseProcesses: |
1438 # all done |
1459 # all done |
1439 self.lreleaseProcRunning = False |
1460 self.lreleaseProcRunning = False |
1526 |
1547 |
1527 proc.start(lrelease, args) |
1548 proc.start(lrelease, args) |
1528 procStarted = proc.waitForStarted() |
1549 procStarted = proc.waitForStarted() |
1529 if procStarted: |
1550 if procStarted: |
1530 self.lreleaseProcRunning = True |
1551 self.lreleaseProcRunning = True |
1531 self.__lreleaseProcesses.append(proc) |
1552 self.__lreleaseProcesses.append((proc, [])) |
1532 else: |
1553 else: |
1533 EricMessageBox.critical( |
1554 EricMessageBox.critical( |
1534 self, |
1555 self, |
1535 self.tr("Process Generation Error"), |
1556 self.tr("Process Generation Error"), |
1536 self.tr( |
1557 self.tr( |