18 from E5Gui import E5FileDialog |
18 from E5Gui import E5FileDialog |
19 |
19 |
20 from .Ui_TranslationPropertiesDialog import Ui_TranslationPropertiesDialog |
20 from .Ui_TranslationPropertiesDialog import Ui_TranslationPropertiesDialog |
21 |
21 |
22 import Utilities |
22 import Utilities |
|
23 import UI.PixmapCache |
23 |
24 |
24 |
25 |
25 class TranslationPropertiesDialog(QDialog, Ui_TranslationPropertiesDialog): |
26 class TranslationPropertiesDialog(QDialog, Ui_TranslationPropertiesDialog): |
26 """ |
27 """ |
27 Class implementing the Translations Properties dialog. |
28 Class implementing the Translations Properties dialog. |
34 @param new flag indicating the generation of a new project |
35 @param new flag indicating the generation of a new project |
35 @param parent parent widget of this dialog (QWidget) |
36 @param parent parent widget of this dialog (QWidget) |
36 """ |
37 """ |
37 super(TranslationPropertiesDialog, self).__init__(parent) |
38 super(TranslationPropertiesDialog, self).__init__(parent) |
38 self.setupUi(self) |
39 self.setupUi(self) |
|
40 |
|
41 self.transBinPathButton.setIcon(UI.PixmapCache.getIcon("open.png")) |
|
42 self.transPatternButton.setIcon(UI.PixmapCache.getIcon("open.png")) |
39 |
43 |
40 self.project = project |
44 self.project = project |
41 self.parent = parent |
45 self.parent = parent |
42 |
46 |
43 self.transPatternCompleter = E5FileCompleter(self.transPatternEdit) |
47 self.transPatternCompleter = E5FileCompleter(self.transPatternEdit) |
57 "FORMS": [], |
61 "FORMS": [], |
58 } |
62 } |
59 for pattern, filetype in list(self.project.pdata["FILETYPES"].items()): |
63 for pattern, filetype in list(self.project.pdata["FILETYPES"].items()): |
60 if filetype in patterns: |
64 if filetype in patterns: |
61 patterns[filetype].append(pattern) |
65 patterns[filetype].append(pattern) |
62 self.filters = self.trUtf8("Source Files ({0});;")\ |
66 self.filters = self.tr("Source Files ({0});;")\ |
63 .format(" ".join(patterns["SOURCES"])) |
67 .format(" ".join(patterns["SOURCES"])) |
64 self.filters += self.trUtf8("Forms Files ({0});;")\ |
68 self.filters += self.tr("Forms Files ({0});;")\ |
65 .format(" ".join(patterns["FORMS"])) |
69 .format(" ".join(patterns["FORMS"])) |
66 self.filters += self.trUtf8("All Files (*)") |
70 self.filters += self.tr("All Files (*)") |
67 |
71 |
68 def initDialog(self): |
72 def initDialog(self): |
69 """ |
73 """ |
70 Public method to initialize the dialogs data. |
74 Public method to initialize the dialogs data. |
71 """ |
75 """ |
96 if not os.path.isabs(tp): |
100 if not os.path.isabs(tp): |
97 tp = Utilities.fromNativeSeparators( |
101 tp = Utilities.fromNativeSeparators( |
98 os.path.join(self.project.ppath, tp)) |
102 os.path.join(self.project.ppath, tp)) |
99 tsfile = E5FileDialog.getOpenFileName( |
103 tsfile = E5FileDialog.getOpenFileName( |
100 self, |
104 self, |
101 self.trUtf8("Select translation file"), |
105 self.tr("Select translation file"), |
102 tp, |
106 tp, |
103 "") |
107 "") |
104 |
108 |
105 if tsfile: |
109 if tsfile: |
106 self.transPatternEdit.setText(self.project.getRelativePath( |
110 self.transPatternEdit.setText(self.project.getRelativePath( |
125 if not os.path.isabs(tbp): |
129 if not os.path.isabs(tbp): |
126 tbp = Utilities.fromNativeSeparators( |
130 tbp = Utilities.fromNativeSeparators( |
127 os.path.join(self.project.ppath, tbp)) |
131 os.path.join(self.project.ppath, tbp)) |
128 directory = E5FileDialog.getExistingDirectory( |
132 directory = E5FileDialog.getExistingDirectory( |
129 self, |
133 self, |
130 self.trUtf8("Select directory for binary translations"), |
134 self.tr("Select directory for binary translations"), |
131 tbp) |
135 tbp) |
132 |
136 |
133 if directory: |
137 if directory: |
134 self.transBinPathEdit.setText(self.project.getRelativePath( |
138 self.transBinPathEdit.setText(self.project.getRelativePath( |
135 Utilities.toNativeSeparators(directory))) |
139 Utilities.toNativeSeparators(directory))) |
168 """ |
172 """ |
169 Private slot to select a file to exempt from translation. |
173 Private slot to select a file to exempt from translation. |
170 """ |
174 """ |
171 texcept = E5FileDialog.getOpenFileName( |
175 texcept = E5FileDialog.getOpenFileName( |
172 self, |
176 self, |
173 self.trUtf8("Exempt file from translation"), |
177 self.tr("Exempt file from translation"), |
174 self.project.ppath, |
178 self.project.ppath, |
175 self.filters) |
179 self.filters) |
176 if texcept: |
180 if texcept: |
177 self.exceptionEdit.setText(Utilities.toNativeSeparators(texcept)) |
181 self.exceptionEdit.setText(Utilities.toNativeSeparators(texcept)) |
178 |
182 |
181 """ |
185 """ |
182 Private slot to select a file to exempt from translation. |
186 Private slot to select a file to exempt from translation. |
183 """ |
187 """ |
184 texcept = E5FileDialog.getExistingDirectory( |
188 texcept = E5FileDialog.getExistingDirectory( |
185 self, |
189 self, |
186 self.trUtf8("Exempt directory from translation"), |
190 self.tr("Exempt directory from translation"), |
187 self.project.ppath, |
191 self.project.ppath, |
188 E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) |
192 E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) |
189 if texcept: |
193 if texcept: |
190 self.exceptionEdit.setText(Utilities.toNativeSeparators(texcept)) |
194 self.exceptionEdit.setText(Utilities.toNativeSeparators(texcept)) |
191 |
195 |