eric6/Project/ProjectTranslationsBrowser.py

changeset 7955
567f2ec958c3
parent 7938
1d3a2a0dac22
child 7959
44e15eda6506
equal deleted inserted replaced
7954:d32319ede131 7955:567f2ec958c3
932 @param exitCode exit code of the process 932 @param exitCode exit code of the process
933 @type int 933 @type int
934 @param exitStatus exit status of the process 934 @param exitStatus exit status of the process
935 @type QProcess.ExitStatus 935 @type QProcess.ExitStatus
936 """ 936 """
937 ui = e5App().getObject("UserInterface")
937 if exitStatus == QProcess.NormalExit and exitCode == 0: 938 if exitStatus == QProcess.NormalExit and exitCode == 0:
938 ui = e5App().getObject("UserInterface") 939 ui.showNotification(
939 if ui.notificationsEnabled(): 940 UI.PixmapCache.getPixmap("linguist48"),
940 ui.showNotification( 941 self.tr("Translation file generation"),
941 UI.PixmapCache.getPixmap("linguist48"), 942 self.tr(
942 self.tr("Translation file generation"), 943 "The generation of the translation files (*.ts)"
943 self.tr( 944 " was successful."))
944 "The generation of the translation files (*.ts)"
945 " was successful."))
946 else:
947 E5MessageBox.information(
948 self,
949 self.tr("Translation file generation"),
950 self.tr(
951 "The generation of the translation files (*.ts)"
952 " was successful."))
953 else: 945 else:
954 if exitStatus == QProcess.CrashExit: 946 if exitStatus == QProcess.CrashExit:
955 info = self.tr(" The process has crashed.") 947 info = self.tr(" The process has crashed.")
956 else: 948 else:
957 info = "" 949 info = ""
958 E5MessageBox.critical( 950 ui.showNotification(
959 self, 951 UI.PixmapCache.getPixmap("linguist48"),
960 self.tr("Translation file generation"), 952 self.tr("Translation file generation"),
961 self.tr( 953 self.tr(
962 "The generation of the translation files (*.ts) has" 954 "The generation of the translation files (*.ts) has"
963 " failed.{0}").format(info)) 955 " failed.{0}").format(info),
956 timeout=0)
964 957
965 for index in range(len(self.__pylupdateProcesses)): 958 for index in range(len(self.__pylupdateProcesses)):
966 if proc == self.__pylupdateProcesses[index][0]: 959 if proc == self.__pylupdateProcesses[index][0]:
967 tmpProjectFile = self.__pylupdateProcesses[index][1] 960 tmpProjectFile = self.__pylupdateProcesses[index][1]
968 if tmpProjectFile: 961 if tmpProjectFile:
1191 @param exitCode exit code of the process 1184 @param exitCode exit code of the process
1192 @type int 1185 @type int
1193 @param exitStatus exit status of the process 1186 @param exitStatus exit status of the process
1194 @type QProcess.ExitStatus 1187 @type QProcess.ExitStatus
1195 """ 1188 """
1189 ui = e5App().getObject("UserInterface")
1196 if exitStatus == QProcess.NormalExit and exitCode == 0: 1190 if exitStatus == QProcess.NormalExit and exitCode == 0:
1197 ui = e5App().getObject("UserInterface") 1191 ui.showNotification(
1198 if ui.notificationsEnabled(): 1192 UI.PixmapCache.getPixmap("linguist48"),
1199 ui.showNotification( 1193 self.tr("Translation file release"),
1200 UI.PixmapCache.getPixmap("linguist48"), 1194 self.tr("The release of the translation files (*.qm)"
1201 self.tr("Translation file release"), 1195 " was successful."))
1202 self.tr("The release of the translation files (*.qm)"
1203 " was successful."))
1204 else:
1205 E5MessageBox.information(
1206 self,
1207 self.tr("Translation file release"),
1208 self.tr("The release of the translation files (*.qm)"
1209 " was successful."))
1210 if self.project.pdata["TRANSLATIONSBINPATH"]: 1196 if self.project.pdata["TRANSLATIONSBINPATH"]:
1211 target = os.path.join( 1197 target = os.path.join(
1212 self.project.ppath, 1198 self.project.ppath,
1213 self.project.pdata["TRANSLATIONSBINPATH"]) 1199 self.project.pdata["TRANSLATIONSBINPATH"])
1214 for langFile in self.project.pdata["TRANSLATIONS"][:]: 1200 for langFile in self.project.pdata["TRANSLATIONS"][:]:
1216 qmFile = os.path.join(self.project.ppath, 1202 qmFile = os.path.join(self.project.ppath,
1217 langFile.replace('.ts', '.qm')) 1203 langFile.replace('.ts', '.qm'))
1218 if os.path.exists(qmFile): 1204 if os.path.exists(qmFile):
1219 shutil.move(qmFile, target) 1205 shutil.move(qmFile, target)
1220 else: 1206 else:
1221 E5MessageBox.critical( 1207 ui.showNotification(
1222 self, 1208 UI.PixmapCache.getPixmap("linguist48"),
1223 self.tr("Translation file release"), 1209 self.tr("Translation file release"),
1224 self.tr( 1210 self.tr(
1225 "The release of the translation files (*.qm) has failed.")) 1211 "The release of the translation files (*.qm) has failed."),
1212 timeout=0)
1226 1213
1227 for index in range(len(self.__lreleaseProcesses)): 1214 for index in range(len(self.__lreleaseProcesses)):
1228 if proc == self.__lreleaseProcesses[index]: 1215 if proc == self.__lreleaseProcesses[index]:
1229 del self.__lreleaseProcesses[index] 1216 del self.__lreleaseProcesses[index]
1230 break 1217 break

eric ide

mercurial