57 for pattern, filetype in list(self.project.pdata["FILETYPES"].items()): |
57 for pattern, filetype in list(self.project.pdata["FILETYPES"].items()): |
58 if filetype in patterns: |
58 if filetype in patterns: |
59 patterns[filetype].append(pattern) |
59 patterns[filetype].append(pattern) |
60 self.filters = self.trUtf8("Source Files ({0});;")\ |
60 self.filters = self.trUtf8("Source Files ({0});;")\ |
61 .format(" ".join(patterns["SOURCES"])) |
61 .format(" ".join(patterns["SOURCES"])) |
62 if self.parent.getProjectType() in ["Qt4", "E4Plugin", "PySide"]: |
62 self.filters += self.trUtf8("Forms Files ({0});;")\ |
63 self.filters += self.trUtf8("Forms Files ({0});;")\ |
63 .format(" ".join(patterns["FORMS"])) |
64 .format(" ".join(patterns["FORMS"])) |
|
65 self.filters += self.trUtf8("All Files (*)") |
64 self.filters += self.trUtf8("All Files (*)") |
66 |
65 |
67 def initDialog(self): |
66 def initDialog(self): |
68 """ |
67 """ |
69 Public method to initialize the dialogs data. |
68 Public method to initialize the dialogs data. |
70 """ |
69 """ |
71 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) |
70 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) |
72 try: |
71 try: |
73 self.transPatternEdit.setText(os.path.join( |
72 self.transPatternEdit.setText(Utilities.toNativeSeparators( |
74 self.project.ppath, self.project.pdata["TRANSLATIONPATTERN"][0])) |
73 self.project.pdata["TRANSLATIONPATTERN"][0])) |
75 except IndexError: |
74 except IndexError: |
76 pass |
75 pass |
77 try: |
76 try: |
78 self.transBinPathEdit.setText(os.path.join( |
77 self.transBinPathEdit.setText(Utilities.toNativeSeparators( |
79 self.project.ppath, self.project.pdata["TRANSLATIONSBINPATH"][0])) |
78 self.project.pdata["TRANSLATIONSBINPATH"][0])) |
80 except IndexError: |
79 except IndexError: |
81 pass |
80 pass |
82 self.exceptionsList.clear() |
81 self.exceptionsList.clear() |
83 for texcept in self.project.pdata["TRANSLATIONEXCEPTIONS"]: |
82 for texcept in self.project.pdata["TRANSLATIONEXCEPTIONS"]: |
84 if texcept: |
83 if texcept: |
87 @pyqtSlot() |
86 @pyqtSlot() |
88 def on_transPatternButton_clicked(self): |
87 def on_transPatternButton_clicked(self): |
89 """ |
88 """ |
90 Private slot to display a file selection dialog. |
89 Private slot to display a file selection dialog. |
91 """ |
90 """ |
92 tp = self.transPatternEdit.text() |
91 tp = Utilities.fromNativeSeparators(self.transPatternEdit.text()) |
93 if "%language%" in tp: |
92 if "%language%" in tp: |
94 tp = tp.split("%language%")[0] |
93 tp = tp.split("%language%")[0] |
|
94 if not os.path.isabs(tp): |
|
95 tp = Utilities.fromNativeSeparators(os.path.join(self.project.ppath, tp)) |
95 tsfile = E5FileDialog.getOpenFileName( |
96 tsfile = E5FileDialog.getOpenFileName( |
96 self, |
97 self, |
97 self.trUtf8("Select translation file"), |
98 self.trUtf8("Select translation file"), |
98 tp, |
99 tp, |
99 "") |
100 "") |
100 |
101 |
101 if tsfile: |
102 if tsfile: |
102 self.transPatternEdit.setText(Utilities.toNativeSeparators(tsfile)) |
103 self.transPatternEdit.setText(self.project.getRelativePath( |
|
104 Utilities.toNativeSeparators(tsfile))) |
103 |
105 |
104 @pyqtSlot(str) |
106 @pyqtSlot(str) |
105 def on_transPatternEdit_textChanged(self, txt): |
107 def on_transPatternEdit_textChanged(self, txt): |
106 """ |
108 """ |
107 Private slot to check the translation pattern for correctness. |
109 Private slot to check the translation pattern for correctness. |
114 @pyqtSlot() |
116 @pyqtSlot() |
115 def on_transBinPathButton_clicked(self): |
117 def on_transBinPathButton_clicked(self): |
116 """ |
118 """ |
117 Private slot to display a directory selection dialog. |
119 Private slot to display a directory selection dialog. |
118 """ |
120 """ |
|
121 tbp = Utilities.fromNativeSeparators(self.transBinPathEdit.text()) |
|
122 if not os.path.isabs(tbp): |
|
123 tbp = Utilities.fromNativeSeparators(os.path.join(self.project.ppath, tbp)) |
119 directory = E5FileDialog.getExistingDirectory( |
124 directory = E5FileDialog.getExistingDirectory( |
120 self, |
125 self, |
121 self.trUtf8("Select directory for binary translations"), |
126 self.trUtf8("Select directory for binary translations"), |
122 self.transBinPathEdit.text()) |
127 tbp) |
123 |
128 |
124 if directory: |
129 if directory: |
125 self.transBinPathEdit.setText(Utilities.toNativeSeparators(directory)) |
130 self.transBinPathEdit.setText(self.project.getRelativePath( |
|
131 Utilities.toNativeSeparators(directory))) |
126 |
132 |
127 @pyqtSlot() |
133 @pyqtSlot() |
128 def on_deleteExceptionButton_clicked(self): |
134 def on_deleteExceptionButton_clicked(self): |
129 """ |
135 """ |
130 Private slot to delete the currently selected entry of the listwidget. |
136 Private slot to delete the currently selected entry of the listwidget. |