Preferences/ConfigurationPages/InterfacePage.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2677
3d4277929fb3
parent 3010
befeff46ec0f
child 3058
0a02c433f52d
equal deleted inserted replaced
3056:9986ec0e559a 3057:10516539f238
206 configuration page. 206 configuration page.
207 """ 207 """
208 self.languageComboBox.clear() 208 self.languageComboBox.clear()
209 209
210 fnlist = glob.glob("eric5_*.qm") + \ 210 fnlist = glob.glob("eric5_*.qm") + \
211 glob.glob(os.path.join(getConfig('ericTranslationsDir'), "eric5_*.qm")) + \ 211 glob.glob(os.path.join(
212 getConfig('ericTranslationsDir'), "eric5_*.qm")) + \
212 glob.glob(os.path.join(Utilities.getConfigDir(), "eric5_*.qm")) 213 glob.glob(os.path.join(Utilities.getConfigDir(), "eric5_*.qm"))
213 locales = {} 214 locales = {}
214 for fn in fnlist: 215 for fn in fnlist:
215 locale = os.path.basename(fn)[6:-3] 216 locale = os.path.basename(fn)[6:-3]
216 if locale not in locales: 217 if locale not in locales:
217 translator = QTranslator() 218 translator = QTranslator()
218 translator.load(fn) 219 translator.load(fn)
219 locales[locale] = \ 220 locales[locale] = translator.translate(
220 translator.translate("InterfacePage", "English", 221 "InterfacePage", "English",
221 "Translate this with your language") + \ 222 "Translate this with your language") + \
222 " ({0})".format(locale) 223 " ({0})".format(locale)
223 localeList = sorted(list(locales.keys())) 224 localeList = sorted(list(locales.keys()))
224 try: 225 try:
225 uiLanguage = Preferences.getUILanguage() 226 uiLanguage = Preferences.getUILanguage()
226 if uiLanguage == "None" or uiLanguage is None: 227 if uiLanguage == "None" or uiLanguage is None:
246 """ 247 """
247 file = E5FileDialog.getOpenFileName( 248 file = E5FileDialog.getOpenFileName(
248 self, 249 self,
249 self.trUtf8("Select style sheet file"), 250 self.trUtf8("Select style sheet file"),
250 self.styleSheetEdit.text(), 251 self.styleSheetEdit.text(),
251 self.trUtf8("Qt Style Sheets (*.qss);;Cascading Style Sheets (*.css);;" 252 self.trUtf8(
252 "All files (*)")) 253 "Qt Style Sheets (*.qss);;Cascading Style Sheets (*.css);;"
254 "All files (*)"))
253 255
254 if file: 256 if file:
255 self.styleSheetEdit.setText(Utilities.toNativeSeparators(file)) 257 self.styleSheetEdit.setText(Utilities.toNativeSeparators(file))
256 258
257 @pyqtSlot() 259 @pyqtSlot()
258 def on_resetLayoutButton_clicked(self): 260 def on_resetLayoutButton_clicked(self):
259 """ 261 """
260 Private method to reset layout to factory defaults 262 Private method to reset layout to factory defaults.
261 """ 263 """
262 Preferences.resetLayout() 264 Preferences.resetLayout()
263 265
264 266
265 def create(dlg): 267 def create(dlg):
266 """ 268 """
267 Module function to create the configuration page. 269 Module function to create the configuration page.
268 270
269 @param dlg reference to the configuration dialog 271 @param dlg reference to the configuration dialog
272 @return reference to the instantiated page (ConfigurationPageBase)
270 """ 273 """
271 page = InterfacePage() 274 page = InterfacePage()
272 return page 275 return page

eric ide

mercurial