eric6/Project/ProjectTranslationsBrowser.py

branch
maintenance
changeset 7940
5c1057897164
parent 7924
8a96736d465e
child 8043
0acf98cd089a
equal deleted inserted replaced
7939:0fc1df79965d 7940:5c1057897164
9 """ 9 """
10 10
11 import os 11 import os
12 import shutil 12 import shutil
13 import fnmatch 13 import fnmatch
14 import functools
14 15
15 from PyQt5.QtCore import pyqtSignal, QProcess 16 from PyQt5.QtCore import pyqtSignal, QProcess
16 from PyQt5.QtWidgets import QDialog, QMenu 17 from PyQt5.QtWidgets import QDialog, QMenu
17 18
18 from E5Gui import E5MessageBox 19 from E5Gui import E5MessageBox
912 Private slot to extract the messages to form a messages template file. 913 Private slot to extract the messages to form a messages template file.
913 """ 914 """
914 if self.hooks["extractMessages"] is not None: 915 if self.hooks["extractMessages"] is not None:
915 self.hooks["extractMessages"]() 916 self.hooks["extractMessages"]()
916 917
917 def __generateTSFileDone(self, exitCode, exitStatus, proc): 918 def __generateTSFileDone(self, proc, exitCode, exitStatus):
918 """ 919 """
919 Private slot to handle the finished signal of the pylupdate process. 920 Private slot to handle the finished signal of the pylupdate process.
920 921
922 @param proc reference to the process
923 @type QProcess
921 @param exitCode exit code of the process 924 @param exitCode exit code of the process
922 @type int 925 @type int
923 @param exitStatus exit status of the process 926 @param exitStatus exit status of the process
924 @type QProcess.ExitStatus 927 @type QProcess.ExitStatus
925 @param proc reference to the process
926 @type QProcess
927 """ 928 """
928 if exitStatus == QProcess.NormalExit and exitCode == 0: 929 if exitStatus == QProcess.NormalExit and exitCode == 0:
929 ui = e5App().getObject("UserInterface") 930 ui = e5App().getObject("UserInterface")
930 if ui.notificationsEnabled(): 931 if ui.notificationsEnabled():
931 ui.showNotification( 932 ui.showNotification(
1040 args.append('-verbose') 1041 args.append('-verbose')
1041 path, filename = os.path.split(tempProjectFile) 1042 path, filename = os.path.split(tempProjectFile)
1042 args.append(filename) 1043 args.append(filename)
1043 proc.setWorkingDirectory(os.path.join(self.project.ppath, path)) 1044 proc.setWorkingDirectory(os.path.join(self.project.ppath, path))
1044 proc.finished.connect( 1045 proc.finished.connect(
1045 lambda c, s: self.__generateTSFileDone(c, s, proc)) 1046 functools.partial(self.__generateTSFileDone, proc)
1047 )
1046 proc.readyReadStandardOutput.connect( 1048 proc.readyReadStandardOutput.connect(
1047 lambda: self.__readStdoutLupdate(proc)) 1049 functools.partial(self.__readStdoutLupdate, proc)
1050 )
1048 proc.readyReadStandardError.connect( 1051 proc.readyReadStandardError.connect(
1049 lambda: self.__readStderrLupdate(proc)) 1052 functools.partial(self.__readStderrLupdate, proc)
1053 )
1050 1054
1051 proc.start(self.pylupdate, args) 1055 proc.start(self.pylupdate, args)
1052 procStarted = proc.waitForStarted() 1056 procStarted = proc.waitForStarted()
1053 if procStarted: 1057 if procStarted:
1054 self.pylupdateProcRunning = True 1058 self.pylupdateProcRunning = True
1104 1108
1105 ########################################################################### 1109 ###########################################################################
1106 ## Methods for the release commands 1110 ## Methods for the release commands
1107 ########################################################################### 1111 ###########################################################################
1108 1112
1109 def __releaseTSFileDone(self, exitCode, exitStatus, proc): 1113 def __releaseTSFileDone(self, proc, exitCode, exitStatus):
1110 """ 1114 """
1111 Private slot to handle the finished signal of the lrelease process. 1115 Private slot to handle the finished signal of the lrelease process.
1112 1116
1117 @param proc reference to the process
1118 @type QProcess
1113 @param exitCode exit code of the process 1119 @param exitCode exit code of the process
1114 @type int 1120 @type int
1115 @param exitStatus exit status of the process 1121 @param exitStatus exit status of the process
1116 @type QProcess.ExitStatus 1122 @type QProcess.ExitStatus
1117 @param proc reference to the process
1118 @type QProcess
1119 """ 1123 """
1120 if exitStatus == QProcess.NormalExit and exitCode == 0: 1124 if exitStatus == QProcess.NormalExit and exitCode == 0:
1121 ui = e5App().getObject("UserInterface") 1125 ui = e5App().getObject("UserInterface")
1122 if ui.notificationsEnabled(): 1126 if ui.notificationsEnabled():
1123 ui.showNotification( 1127 ui.showNotification(
1218 args.append(filename) 1222 args.append(filename)
1219 1223
1220 proc = QProcess() 1224 proc = QProcess()
1221 proc.setWorkingDirectory(os.path.join(self.project.ppath, path)) 1225 proc.setWorkingDirectory(os.path.join(self.project.ppath, path))
1222 proc.finished.connect( 1226 proc.finished.connect(
1223 lambda c, s: self.__releaseTSFileDone(c, s, proc)) 1227 functools.partial(self.__releaseTSFileDone, proc)
1228 )
1224 proc.readyReadStandardOutput.connect( 1229 proc.readyReadStandardOutput.connect(
1225 lambda: self.__readStdoutLrelease(proc)) 1230 functools.partial(self.__readStdoutLrelease, proc)
1231 )
1226 proc.readyReadStandardError.connect( 1232 proc.readyReadStandardError.connect(
1227 lambda: self.__readStderrLrelease(proc)) 1233 functools.partial(self.__readStderrLrelease, proc)
1234 )
1228 1235
1229 proc.start(lrelease, args) 1236 proc.start(lrelease, args)
1230 procStarted = proc.waitForStarted() 1237 procStarted = proc.waitForStarted()
1231 if procStarted: 1238 if procStarted:
1232 self.lreleaseProcRunning = True 1239 self.lreleaseProcRunning = True

eric ide

mercurial