37 |
37 |
38 class ProjectTranslationsBrowser(ProjectBaseBrowser): |
38 class ProjectTranslationsBrowser(ProjectBaseBrowser): |
39 """ |
39 """ |
40 A class used to display the translations part of the project. |
40 A class used to display the translations part of the project. |
41 |
41 |
42 @signal linguistFile(str) emitted to open a translation file with |
|
43 Qt-Linguist |
|
44 @signal appendStdout(str) emitted after something was received from |
42 @signal appendStdout(str) emitted after something was received from |
45 a QProcess on stdout |
43 a QProcess on stdout |
46 @signal appendStderr(str) emitted after something was received from |
44 @signal appendStderr(str) emitted after something was received from |
47 a QProcess on stderr |
45 a QProcess on stderr |
48 @signal sourceFile(str) emitted to open a translation file in an editor |
|
49 @signal closeSourceWindow(str) emitted after a file has been |
|
50 removed/deleted from the project |
|
51 @signal trpreview(list of str, bool = False) emitted to preview |
|
52 translations in the translations previewer |
|
53 @signal showMenu(str, QMenu) emitted when a menu is about to be shown. |
46 @signal showMenu(str, QMenu) emitted when a menu is about to be shown. |
54 The name of the menu and a reference to the menu are given. |
47 The name of the menu and a reference to the menu are given. |
55 """ |
48 """ |
56 appendStdout = pyqtSignal(str) |
49 appendStdout = pyqtSignal(str) |
57 appendStderr = pyqtSignal(str) |
50 appendStderr = pyqtSignal(str) |
886 self.appendStdout.emit(s) |
879 self.appendStdout.emit(s) |
887 |
880 |
888 def __readStderrLupdate(self): |
881 def __readStderrLupdate(self): |
889 """ |
882 """ |
890 Private slot to handle the readyReadStandardError signal of the |
883 Private slot to handle the readyReadStandardError signal of the |
891 pylupdate process. |
884 pylupdate4/pylupdate5/pyside-lupdate process. |
892 """ |
885 """ |
893 proc = self.sender() |
886 proc = self.sender() |
894 if proc is not None: |
887 if proc is not None: |
895 self.__readStderr(proc, '{0}: '.format(self.pylupdate)) |
888 self.__readStderr(proc, '{0}: '.format(self.pylupdate)) |
896 else: |
889 else: |
984 # all done |
977 # all done |
985 self.pylupdateProcRunning = False |
978 self.pylupdateProcRunning = False |
986 |
979 |
987 def __generateTSFile(self, noobsolete=False, generateAll=True): |
980 def __generateTSFile(self, noobsolete=False, generateAll=True): |
988 """ |
981 """ |
989 Private method used to run pylupdate/pylupdate4 to generate the .ts |
982 Private method used to run pylupdate4/pylupdate5/pyside-lupdate to |
990 files. |
983 generate the .ts files. |
991 |
984 |
992 @param noobsolete flag indicating whether obsolete entries should be |
985 @param noobsolete flag indicating whether obsolete entries should be |
993 kept (boolean) |
986 kept (boolean) |
994 @param generateAll flag indicating whether all translations should be |
987 @param generateAll flag indicating whether all translations should be |
995 generated (boolean) |
988 generated (boolean) |
1034 ok = False |
1027 ok = False |
1035 if not ok: |
1028 if not ok: |
1036 return |
1029 return |
1037 |
1030 |
1038 if self.project.getProjectType() in ["Qt4", "Qt4C"]: |
1031 if self.project.getProjectType() in ["Qt4", "Qt4C"]: |
1039 self.pylupdate = 'pylupdate4' |
1032 self.pylupdate = Utilities.generatePyQtToolPath('pylupdate4') |
1040 if Utilities.isWindowsPlatform(): |
|
1041 self.pylupdate = \ |
|
1042 Utilities.getWindowsExecutablePath(self.pylupdate) |
|
1043 elif self.project.getProjectType() in ["PyQt5", "PyQt5C"]: |
1033 elif self.project.getProjectType() in ["PyQt5", "PyQt5C"]: |
1044 self.pylupdate = 'pylupdate5' |
1034 self.pylupdate = Utilities.generatePyQtToolPath('pylupdate5') |
1045 if Utilities.isWindowsPlatform(): |
|
1046 self.pylupdate = \ |
|
1047 Utilities.getWindowsExecutablePath(self.pylupdate) |
|
1048 elif self.project.getProjectType() in ["E6Plugin"]: |
1035 elif self.project.getProjectType() in ["E6Plugin"]: |
1049 if PYQT_VERSION < 0x050000: |
1036 if PYQT_VERSION < 0x050000: |
1050 self.pylupdate = 'pylupdate4' |
1037 self.pylupdate = Utilities.generatePyQtToolPath('pylupdate4') |
1051 else: |
1038 else: |
1052 self.pylupdate = 'pylupdate5' |
1039 self.pylupdate = Utilities.generatePyQtToolPath('pylupdate5') |
1053 if Utilities.isWindowsPlatform(): |
|
1054 self.pylupdate = \ |
|
1055 Utilities.getWindowsExecutablePath(self.pylupdate) |
|
1056 elif self.project.getProjectType() in ["PySide", "PySideC"]: |
1040 elif self.project.getProjectType() in ["PySide", "PySideC"]: |
1057 self.pylupdate = Utilities.generatePySideToolPath('pyside-lupdate') |
1041 self.pylupdate = Utilities.generatePySideToolPath('pyside-lupdate') |
1058 else: |
1042 else: |
1059 return |
1043 return |
1060 |
1044 |