11 import shutil |
11 import shutil |
12 import fnmatch |
12 import fnmatch |
13 |
13 |
14 from PyQt4.QtCore import * |
14 from PyQt4.QtCore import * |
15 from PyQt4.QtGui import * |
15 from PyQt4.QtGui import * |
|
16 |
|
17 from E5Gui import E5MessageBox |
16 |
18 |
17 from .ProjectBrowserModel import ProjectBrowserFileItem, \ |
19 from .ProjectBrowserModel import ProjectBrowserFileItem, \ |
18 ProjectBrowserSimpleDirectoryItem, ProjectBrowserDirectoryItem, \ |
20 ProjectBrowserSimpleDirectoryItem, ProjectBrowserDirectoryItem, \ |
19 ProjectBrowserTranslationType |
21 ProjectBrowserTranslationType |
20 from .ProjectBaseBrowser import ProjectBaseBrowser |
22 from .ProjectBaseBrowser import ProjectBaseBrowser |
827 @param exitCode exit code of the process (integer) |
829 @param exitCode exit code of the process (integer) |
828 @param exitStatus exit status of the process (QProcess.ExitStatus) |
830 @param exitStatus exit status of the process (QProcess.ExitStatus) |
829 """ |
831 """ |
830 self.pylupdateProcRunning = False |
832 self.pylupdateProcRunning = False |
831 if exitStatus == QProcess.NormalExit and exitCode == 0: |
833 if exitStatus == QProcess.NormalExit and exitCode == 0: |
832 QMessageBox.information(None, |
834 E5MessageBox.information(self, |
833 self.trUtf8("Translation file generation"), |
835 self.trUtf8("Translation file generation"), |
834 self.trUtf8("The generation of the translation files (*.ts)" |
836 self.trUtf8("The generation of the translation files (*.ts)" |
835 " was successful.")) |
837 " was successful.")) |
836 else: |
838 else: |
837 QMessageBox.critical(None, |
839 QMessageBox.critical(self, |
838 self.trUtf8("Translation file generation"), |
840 self.trUtf8("Translation file generation"), |
839 self.trUtf8("The generation of the translation files (*.ts) has failed.")) |
841 self.trUtf8("The generation of the translation files (*.ts) has failed.")) |
840 self.pylupdateProc = None |
842 self.pylupdateProc = None |
841 self.pylupdate = "" |
843 self.pylupdate = "" |
842 try: |
844 try: |
966 """ |
968 """ |
967 Private slot to handle the finished signal of the lrelease process. |
969 Private slot to handle the finished signal of the lrelease process. |
968 """ |
970 """ |
969 self.lreleaseProcRunning = False |
971 self.lreleaseProcRunning = False |
970 if exitStatus == QProcess.NormalExit and exitCode == 0: |
972 if exitStatus == QProcess.NormalExit and exitCode == 0: |
971 QMessageBox.information(None, |
973 E5MessageBox.information(self, |
972 self.trUtf8("Translation file release"), |
974 self.trUtf8("Translation file release"), |
973 self.trUtf8("The release of the translation files (*.qm)" |
975 self.trUtf8("The release of the translation files (*.qm)" |
974 " was successful.")) |
976 " was successful.")) |
975 if self.project.pdata["TRANSLATIONSBINPATH"]: |
977 if self.project.pdata["TRANSLATIONSBINPATH"]: |
976 target = os.path.join(self.project.ppath, |
978 target = os.path.join(self.project.ppath, |
980 qmFile = os.path.join(self.project.ppath, |
982 qmFile = os.path.join(self.project.ppath, |
981 langFile.replace('.ts', '.qm')) |
983 langFile.replace('.ts', '.qm')) |
982 if os.path.exists(qmFile): |
984 if os.path.exists(qmFile): |
983 shutil.move(qmFile, target) |
985 shutil.move(qmFile, target) |
984 else: |
986 else: |
985 QMessageBox.critical(None, |
987 QMessageBox.critical(self, |
986 self.trUtf8("Translation file release"), |
988 self.trUtf8("Translation file release"), |
987 self.trUtf8("The release of the translation files (*.qm) has failed.")) |
989 self.trUtf8("The release of the translation files (*.qm) has failed.")) |
988 self.lreleaseProc = None |
990 self.lreleaseProc = None |
989 try: |
991 try: |
990 os.remove(self.tmpProject) |
992 os.remove(self.tmpProject) |