828 if len(self.__tmpProjects) == 0: |
828 if len(self.__tmpProjects) == 0: |
829 return False |
829 return False |
830 |
830 |
831 return True |
831 return True |
832 |
832 |
833 def __readStdoutLupdate(self): |
833 def __readStdoutLupdate(self, proc): |
834 """ |
834 """ |
835 Private slot to handle the readyReadStandardOutput signal of the |
835 Private slot to handle the readyReadStandardOutput signal of the |
836 pylupdate process. |
836 pylupdate process. |
837 """ |
837 |
838 proc = self.sender() |
838 @param proc reference to the process |
839 if proc is not None: |
839 @type QProcess |
840 self.__readStdout(proc, '{0}: '.format(self.pylupdate)) |
840 """ |
841 else: |
841 self.__readStdout(proc, '{0}: '.format(self.pylupdate)) |
842 return |
842 |
843 |
843 def __readStdoutLrelease(self, proc): |
844 def __readStdoutLrelease(self): |
|
845 """ |
844 """ |
846 Private slot to handle the readyReadStandardOutput signal of the |
845 Private slot to handle the readyReadStandardOutput signal of the |
847 lrelease process. |
846 lrelease process. |
848 """ |
847 |
849 proc = self.sender() |
848 @param proc reference to the process |
850 if proc is not None: |
849 @type QProcess |
851 self.__readStdout(proc, 'lrelease: ') |
850 """ |
852 else: |
851 self.__readStdout(proc, 'lrelease: ') |
853 return |
|
854 |
852 |
855 def __readStdout(self, proc, ps): |
853 def __readStdout(self, proc, ps): |
856 """ |
854 """ |
857 Private method to read from a process' stdout channel. |
855 Private method to read from a process' stdout channel. |
858 |
856 |
866 s = ps |
864 s = ps |
867 output = str(proc.readLine(), ioEncoding, 'replace') |
865 output = str(proc.readLine(), ioEncoding, 'replace') |
868 s += output |
866 s += output |
869 self.appendStdout.emit(s) |
867 self.appendStdout.emit(s) |
870 |
868 |
871 def __readStderrLupdate(self): |
869 def __readStderrLupdate(self, proc): |
872 """ |
870 """ |
873 Private slot to handle the readyReadStandardError signal of the |
871 Private slot to handle the readyReadStandardError signal of the |
874 pylupdate4/pylupdate5/pyside-lupdate process. |
872 pylupdate4/pylupdate5/pyside-lupdate process. |
875 """ |
873 |
876 proc = self.sender() |
874 @param proc reference to the process |
877 if proc is not None: |
875 @type QProcess |
878 self.__readStderr(proc, '{0}: '.format(self.pylupdate)) |
876 """ |
879 else: |
877 self.__readStderr(proc, '{0}: '.format(self.pylupdate)) |
880 return |
878 |
881 |
879 def __readStderrLrelease(self, proc): |
882 def __readStderrLrelease(self): |
|
883 """ |
880 """ |
884 Private slot to handle the readyReadStandardError signal of the |
881 Private slot to handle the readyReadStandardError signal of the |
885 lrelease process. |
882 lrelease process. |
886 """ |
883 |
887 proc = self.sender() |
884 @param proc reference to the process |
888 if proc is not None: |
885 @type QProcess |
889 self.__readStderr(proc, 'lrelease: ') |
886 """ |
890 else: |
887 self.__readStderr(proc, 'lrelease: ') |
891 return |
|
892 |
888 |
893 def __readStderr(self, proc, ps): |
889 def __readStderr(self, proc, ps): |
894 """ |
890 """ |
895 Private method to read from a process' stderr channel. |
891 Private method to read from a process' stderr channel. |
896 |
892 |
915 Private slot to extract the messages to form a messages template file. |
911 Private slot to extract the messages to form a messages template file. |
916 """ |
912 """ |
917 if self.hooks["extractMessages"] is not None: |
913 if self.hooks["extractMessages"] is not None: |
918 self.hooks["extractMessages"]() |
914 self.hooks["extractMessages"]() |
919 |
915 |
920 def __generateTSFileDone(self, exitCode, exitStatus): |
916 def __generateTSFileDone(self, exitCode, exitStatus, proc): |
921 """ |
917 """ |
922 Private slot to handle the finished signal of the pylupdate process. |
918 Private slot to handle the finished signal of the pylupdate process. |
923 |
919 |
924 @param exitCode exit code of the process (integer) |
920 @param exitCode exit code of the process |
925 @param exitStatus exit status of the process (QProcess.ExitStatus) |
921 @type int |
|
922 @param exitStatus exit status of the process |
|
923 @type QProcess.ExitStatus |
|
924 @param proc reference to the process |
|
925 @type QProcess |
926 """ |
926 """ |
927 if exitStatus == QProcess.NormalExit and exitCode == 0: |
927 if exitStatus == QProcess.NormalExit and exitCode == 0: |
928 ui = e5App().getObject("UserInterface") |
928 ui = e5App().getObject("UserInterface") |
929 if ui.notificationsEnabled(): |
929 if ui.notificationsEnabled(): |
930 ui.showNotification( |
930 ui.showNotification( |
950 self.tr("Translation file generation"), |
950 self.tr("Translation file generation"), |
951 self.tr( |
951 self.tr( |
952 "The generation of the translation files (*.ts) has" |
952 "The generation of the translation files (*.ts) has" |
953 " failed.{0}").format(info)) |
953 " failed.{0}").format(info)) |
954 |
954 |
955 proc = self.sender() |
|
956 for index in range(len(self.__pylupdateProcesses)): |
955 for index in range(len(self.__pylupdateProcesses)): |
957 if proc == self.__pylupdateProcesses[index][0]: |
956 if proc == self.__pylupdateProcesses[index][0]: |
958 try: |
957 try: |
959 self.__tmpProjects.remove( |
958 self.__tmpProjects.remove( |
960 self.__pylupdateProcesses[index][1]) |
959 self.__pylupdateProcesses[index][1]) |
1042 |
1041 |
1043 args.append('-verbose') |
1042 args.append('-verbose') |
1044 path, filename = os.path.split(tempProjectFile) |
1043 path, filename = os.path.split(tempProjectFile) |
1045 args.append(filename) |
1044 args.append(filename) |
1046 proc.setWorkingDirectory(os.path.join(self.project.ppath, path)) |
1045 proc.setWorkingDirectory(os.path.join(self.project.ppath, path)) |
1047 proc.finished.connect(self.__generateTSFileDone) |
1046 proc.finished.connect( |
1048 proc.readyReadStandardOutput.connect(self.__readStdoutLupdate) |
1047 lambda c, s: self.__generateTSFileDone(c, s, proc)) |
1049 proc.readyReadStandardError.connect(self.__readStderrLupdate) |
1048 proc.readyReadStandardOutput.connect( |
|
1049 lambda: self.__readStdoutLupdate(proc)) |
|
1050 proc.readyReadStandardError.connect( |
|
1051 lambda: self.__readStderrLupdate(proc)) |
1050 |
1052 |
1051 proc.start(self.pylupdate, args) |
1053 proc.start(self.pylupdate, args) |
1052 procStarted = proc.waitForStarted() |
1054 procStarted = proc.waitForStarted() |
1053 if procStarted: |
1055 if procStarted: |
1054 self.pylupdateProcRunning = True |
1056 self.pylupdateProcRunning = True |
1104 |
1106 |
1105 ########################################################################### |
1107 ########################################################################### |
1106 ## Methods for the release commands |
1108 ## Methods for the release commands |
1107 ########################################################################### |
1109 ########################################################################### |
1108 |
1110 |
1109 def __releaseTSFileDone(self, exitCode, exitStatus): |
1111 def __releaseTSFileDone(self, exitCode, exitStatus, proc): |
1110 """ |
1112 """ |
1111 Private slot to handle the finished signal of the lrelease process. |
1113 Private slot to handle the finished signal of the lrelease process. |
1112 |
1114 |
1113 @param exitCode exit code of the process (integer) |
1115 @param exitCode exit code of the process |
1114 @param exitStatus exit status of the process (QProcess.ExitStatus) |
1116 @type int |
|
1117 @param exitStatus exit status of the process |
|
1118 @type QProcess.ExitStatus |
|
1119 @param proc reference to the process |
|
1120 @type QProcess |
1115 """ |
1121 """ |
1116 if exitStatus == QProcess.NormalExit and exitCode == 0: |
1122 if exitStatus == QProcess.NormalExit and exitCode == 0: |
1117 ui = e5App().getObject("UserInterface") |
1123 ui = e5App().getObject("UserInterface") |
1118 if ui.notificationsEnabled(): |
1124 if ui.notificationsEnabled(): |
1119 ui.showNotification( |
1125 ui.showNotification( |
1142 self, |
1148 self, |
1143 self.tr("Translation file release"), |
1149 self.tr("Translation file release"), |
1144 self.tr( |
1150 self.tr( |
1145 "The release of the translation files (*.qm) has failed.")) |
1151 "The release of the translation files (*.qm) has failed.")) |
1146 |
1152 |
1147 proc = self.sender() |
|
1148 for index in range(len(self.__lreleaseProcesses)): |
1153 for index in range(len(self.__lreleaseProcesses)): |
1149 if proc == self.__lreleaseProcesses[index][0]: |
1154 if proc == self.__lreleaseProcesses[index][0]: |
1150 try: |
1155 try: |
1151 self.__tmpProjects.remove( |
1156 self.__tmpProjects.remove( |
1152 self.__lreleaseProcesses[index][1]) |
1157 self.__lreleaseProcesses[index][1]) |
1212 |
1217 |
1213 args.append('-verbose') |
1218 args.append('-verbose') |
1214 path, filename = os.path.split(tempProjectFile) |
1219 path, filename = os.path.split(tempProjectFile) |
1215 args.append(filename) |
1220 args.append(filename) |
1216 proc.setWorkingDirectory(os.path.join(self.project.ppath, path)) |
1221 proc.setWorkingDirectory(os.path.join(self.project.ppath, path)) |
1217 proc.finished.connect(self.__releaseTSFileDone) |
1222 proc.finished.connect( |
1218 proc.readyReadStandardOutput.connect(self.__readStdoutLrelease) |
1223 lambda c, s: self.__releaseTSFileDone(c, s, proc)) |
1219 proc.readyReadStandardError.connect(self.__readStderrLrelease) |
1224 proc.readyReadStandardOutput.connect( |
|
1225 lambda: self.__readStdoutLrelease(proc)) |
|
1226 proc.readyReadStandardError.connect( |
|
1227 lambda: self.__readStderrLrelease(proc)) |
1220 |
1228 |
1221 proc.start(lrelease, args) |
1229 proc.start(lrelease, args) |
1222 procStarted = proc.waitForStarted() |
1230 procStarted = proc.waitForStarted() |
1223 if procStarted: |
1231 if procStarted: |
1224 self.lreleaseProcRunning = True |
1232 self.lreleaseProcRunning = True |