751 langs = [lang for lang in self.project.pdata["TRANSLATIONS"] \ |
751 langs = [lang for lang in self.project.pdata["TRANSLATIONS"] \ |
752 if fnmatch.fnmatch(lang, pattern)] |
752 if fnmatch.fnmatch(lang, pattern)] |
753 except IndexError: |
753 except IndexError: |
754 langs = [] |
754 langs = [] |
755 if not langs: |
755 if not langs: |
756 E5MessageBox.warning(self, |
756 E5MessageBox.warning( |
|
757 self, |
757 self.trUtf8("Write temporary project file"), |
758 self.trUtf8("Write temporary project file"), |
758 self.trUtf8("""No translation files (*.ts) selected.""")) |
759 self.trUtf8("""No translation files (*.ts) selected.""")) |
759 return False |
760 return False |
760 |
761 |
761 # create a prefix relative from the *.ts down to the project path |
762 # create a prefix relative from the *.ts down to the project path |
796 list[0].replace(os.sep, '/'), "\n", "\n")) |
797 list[0].replace(os.sep, '/'), "\n", "\n")) |
797 |
798 |
798 pf.close() |
799 pf.close() |
799 self.__tmpProjects.append(outFile) |
800 self.__tmpProjects.append(outFile) |
800 except IOError: |
801 except IOError: |
801 E5MessageBox.critical(self, |
802 E5MessageBox.critical( |
|
803 self, |
802 self.trUtf8("Write temporary project file"), |
804 self.trUtf8("Write temporary project file"), |
803 self.trUtf8( |
805 self.trUtf8( |
804 "<p>The temporary project file <b>{0}</b> could not" |
806 "<p>The temporary project file <b>{0}</b> could not" |
805 " be written.</p>").format(outFile)) |
807 " be written.</p>").format(outFile)) |
806 |
808 |
910 self.trUtf8("Translation file generation"), |
912 self.trUtf8("Translation file generation"), |
911 self.trUtf8( |
913 self.trUtf8( |
912 "The generation of the translation files (*.ts)" |
914 "The generation of the translation files (*.ts)" |
913 " was successful.")) |
915 " was successful.")) |
914 else: |
916 else: |
915 E5MessageBox.information(self, |
917 E5MessageBox.information( |
|
918 self, |
916 self.trUtf8("Translation file generation"), |
919 self.trUtf8("Translation file generation"), |
917 self.trUtf8( |
920 self.trUtf8( |
918 "The generation of the translation files (*.ts)" |
921 "The generation of the translation files (*.ts)" |
919 " was successful.")) |
922 " was successful.")) |
920 else: |
923 else: |
921 E5MessageBox.critical(self, |
924 E5MessageBox.critical( |
|
925 self, |
922 self.trUtf8("Translation file generation"), |
926 self.trUtf8("Translation file generation"), |
923 self.trUtf8( |
927 self.trUtf8( |
924 "The generation of the translation files (*.ts) has" |
928 "The generation of the translation files (*.ts) has" |
925 " failed.")) |
929 " failed.")) |
926 |
930 |
1023 procStarted = proc.waitForStarted() |
1027 procStarted = proc.waitForStarted() |
1024 if procStarted: |
1028 if procStarted: |
1025 self.pylupdateProcRunning = True |
1029 self.pylupdateProcRunning = True |
1026 self.__pylupdateProcesses.append((proc, tempProjectFile)) |
1030 self.__pylupdateProcesses.append((proc, tempProjectFile)) |
1027 else: |
1031 else: |
1028 E5MessageBox.critical(self, |
1032 E5MessageBox.critical( |
|
1033 self, |
1029 self.trUtf8('Process Generation Error'), |
1034 self.trUtf8('Process Generation Error'), |
1030 self.trUtf8( |
1035 self.trUtf8( |
1031 'Could not start {0}.<br>' |
1036 'Could not start {0}.<br>' |
1032 'Ensure that it is in the search path.' |
1037 'Ensure that it is in the search path.' |
1033 ).format(self.pylupdate)) |
1038 ).format(self.pylupdate)) |
1091 ui.showNotification(UI.PixmapCache.getPixmap("linguist48.png"), |
1096 ui.showNotification(UI.PixmapCache.getPixmap("linguist48.png"), |
1092 self.trUtf8("Translation file release"), |
1097 self.trUtf8("Translation file release"), |
1093 self.trUtf8("The release of the translation files (*.qm)" |
1098 self.trUtf8("The release of the translation files (*.qm)" |
1094 " was successful.")) |
1099 " was successful.")) |
1095 else: |
1100 else: |
1096 E5MessageBox.information(self, |
1101 E5MessageBox.information( |
|
1102 self, |
1097 self.trUtf8("Translation file release"), |
1103 self.trUtf8("Translation file release"), |
1098 self.trUtf8("The release of the translation files (*.qm)" |
1104 self.trUtf8("The release of the translation files (*.qm)" |
1099 " was successful.")) |
1105 " was successful.")) |
1100 if self.project.pdata["TRANSLATIONSBINPATH"]: |
1106 if self.project.pdata["TRANSLATIONSBINPATH"]: |
1101 target = os.path.join( |
1107 target = os.path.join( |
1106 qmFile = os.path.join(self.project.ppath, |
1112 qmFile = os.path.join(self.project.ppath, |
1107 langFile.replace('.ts', '.qm')) |
1113 langFile.replace('.ts', '.qm')) |
1108 if os.path.exists(qmFile): |
1114 if os.path.exists(qmFile): |
1109 shutil.move(qmFile, target) |
1115 shutil.move(qmFile, target) |
1110 else: |
1116 else: |
1111 E5MessageBox.critical(self, |
1117 E5MessageBox.critical( |
|
1118 self, |
1112 self.trUtf8("Translation file release"), |
1119 self.trUtf8("Translation file release"), |
1113 self.trUtf8( |
1120 self.trUtf8( |
1114 "The release of the translation files (*.qm) has failed.")) |
1121 "The release of the translation files (*.qm) has failed.")) |
1115 |
1122 |
1116 proc = self.sender() |
1123 proc = self.sender() |
1191 procStarted = proc.waitForStarted() |
1198 procStarted = proc.waitForStarted() |
1192 if procStarted: |
1199 if procStarted: |
1193 self.lreleaseProcRunning = True |
1200 self.lreleaseProcRunning = True |
1194 self.__lreleaseProcesses.append((proc, tempProjectFile)) |
1201 self.__lreleaseProcesses.append((proc, tempProjectFile)) |
1195 else: |
1202 else: |
1196 E5MessageBox.critical(self, |
1203 E5MessageBox.critical( |
|
1204 self, |
1197 self.trUtf8('Process Generation Error'), |
1205 self.trUtf8('Process Generation Error'), |
1198 self.trUtf8( |
1206 self.trUtf8( |
1199 '<p>Could not start lrelease.<br>' |
1207 '<p>Could not start lrelease.<br>' |
1200 'Ensure that it is available as <b>{0}</b>.</p>' |
1208 'Ensure that it is available as <b>{0}</b>.</p>' |
1201 ).format(lrelease)) |
1209 ).format(lrelease)) |