Preferences/ConfigurationPages/InterfacePage.py

changeset 12
1d8dd9706f46
parent 7
c679fb30c8f3
child 13
1af94a91f439
equal deleted inserted replaced
11:b0996e4a289e 12:1d8dd9706f46
13 from PyQt4.QtCore import pyqtSlot, QTranslator, qVersion 13 from PyQt4.QtCore import pyqtSlot, QTranslator, qVersion
14 from PyQt4.QtGui import QStyleFactory, QFileDialog 14 from PyQt4.QtGui import QStyleFactory, QFileDialog
15 15
16 from E4Gui.E4Completers import E4FileCompleter 16 from E4Gui.E4Completers import E4FileCompleter
17 17
18 from ConfigurationPageBase import ConfigurationPageBase 18 from .ConfigurationPageBase import ConfigurationPageBase
19 from Ui_InterfacePage import Ui_InterfacePage 19 from .Ui_InterfacePage import Ui_InterfacePage
20 20
21 import Preferences 21 import Preferences
22 import Utilities 22 import Utilities
23 23
24 from eric4config import getConfig 24 from eric4config import getConfig
180 Preferences.setUILayout(layout) 180 Preferences.setUILayout(layout)
181 181
182 Preferences.setUI("SingleCloseButton", 182 Preferences.setUI("SingleCloseButton",
183 self.tabsCloseButtonCheckBox.isChecked()) 183 self.tabsCloseButtonCheckBox.isChecked())
184 184
185 for key in self.uiColours.keys(): 185 for key in list(self.uiColours.keys()):
186 Preferences.setUI(key, self.uiColours[key]) 186 Preferences.setUI(key, self.uiColours[key])
187 187
188 def __populateStyleCombo(self): 188 def __populateStyleCombo(self):
189 """ 189 """
190 Private method to populate the style combo box. 190 Private method to populate the style combo box.
191 """ 191 """
192 curStyle = Preferences.getUI("Style") 192 curStyle = Preferences.getUI("Style")
193 styles = QStyleFactory.keys() 193 styles = sorted(list(QStyleFactory.keys()))
194 styles.sort()
195 self.styleComboBox.addItem(self.trUtf8('System'), "System") 194 self.styleComboBox.addItem(self.trUtf8('System'), "System")
196 for style in styles: 195 for style in styles:
197 self.styleComboBox.addItem(style, style) 196 self.styleComboBox.addItem(style, style)
198 currentIndex = self.styleComboBox.findData(curStyle) 197 currentIndex = self.styleComboBox.findData(curStyle)
199 if currentIndex == -1: 198 if currentIndex == -1:
211 glob.glob(os.path.join(getConfig('ericTranslationsDir'), "eric4_*.qm")) + \ 210 glob.glob(os.path.join(getConfig('ericTranslationsDir'), "eric4_*.qm")) + \
212 glob.glob(os.path.join(Utilities.getConfigDir(), "eric4_*.qm")) 211 glob.glob(os.path.join(Utilities.getConfigDir(), "eric4_*.qm"))
213 locales = {} 212 locales = {}
214 for fn in fnlist: 213 for fn in fnlist:
215 locale = os.path.basename(fn)[6:-3] 214 locale = os.path.basename(fn)[6:-3]
216 if not locales.has_key(locale): 215 if locale not in locales:
217 translator = QTranslator() 216 translator = QTranslator()
218 translator.load(fn) 217 translator.load(fn)
219 locales[locale] = \ 218 locales[locale] = \
220 translator.translate("InterfacePage", "English", 219 translator.translate("InterfacePage", "English",
221 "Translate this with your language") + \ 220 "Translate this with your language") + \
222 " ({0})".format(locale) 221 " ({0})".format(locale)
223 localeList = locales.keys() 222 localeList = sorted(list(locales.keys()))
224 localeList.sort()
225
226 try: 223 try:
227 uiLanguage = Preferences.getUILanguage() 224 uiLanguage = Preferences.getUILanguage()
228 if uiLanguage == "None" or uiLanguage is None: 225 if uiLanguage == "None" or uiLanguage is None:
229 currentIndex = 0 226 currentIndex = 0
230 elif uiLanguage == "System": 227 elif uiLanguage == "System":

eric ide

mercurial