Preferences/ConfigurationPages/InterfacePage.py

branch
Py2 comp.
changeset 3484
645c12de6b0c
parent 3178
f25fc1364c88
parent 3190
a9a94491c4fd
child 3656
441956d8fce5
equal deleted inserted replaced
3456:96232974dcdb 3484:645c12de6b0c
21 from .ConfigurationPageBase import ConfigurationPageBase 21 from .ConfigurationPageBase import ConfigurationPageBase
22 from .Ui_InterfacePage import Ui_InterfacePage 22 from .Ui_InterfacePage import Ui_InterfacePage
23 23
24 import Preferences 24 import Preferences
25 import Utilities 25 import Utilities
26 import UI.PixmapCache
26 27
27 from eric5config import getConfig 28 from eric5config import getConfig
28 29
29 30
30 class InterfacePage(ConfigurationPageBase, Ui_InterfacePage): 31 class InterfacePage(ConfigurationPageBase, Ui_InterfacePage):
36 Constructor 37 Constructor
37 """ 38 """
38 super(InterfacePage, self).__init__() 39 super(InterfacePage, self).__init__()
39 self.setupUi(self) 40 self.setupUi(self)
40 self.setObjectName("InterfacePage") 41 self.setObjectName("InterfacePage")
42
43 self.styleSheetButton.setIcon(UI.PixmapCache.getIcon("open.png"))
41 44
42 self.styleSheetCompleter = E5FileCompleter(self.styleSheetEdit) 45 self.styleSheetCompleter = E5FileCompleter(self.styleSheetEdit)
43 46
44 # set initial values 47 # set initial values
45 self.__populateStyleCombo() 48 self.__populateStyleCombo()
205 """ 208 """
206 Private method to populate the style combo box. 209 Private method to populate the style combo box.
207 """ 210 """
208 curStyle = Preferences.getUI("Style") 211 curStyle = Preferences.getUI("Style")
209 styles = sorted(list(QStyleFactory.keys())) 212 styles = sorted(list(QStyleFactory.keys()))
210 self.styleComboBox.addItem(self.trUtf8('System'), "System") 213 self.styleComboBox.addItem(self.tr('System'), "System")
211 for style in styles: 214 for style in styles:
212 self.styleComboBox.addItem(style, style) 215 self.styleComboBox.addItem(style, style)
213 currentIndex = self.styleComboBox.findData(curStyle) 216 currentIndex = self.styleComboBox.findData(curStyle)
214 if currentIndex == -1: 217 if currentIndex == -1:
215 currentIndex = 0 218 currentIndex = 0
248 except ValueError: 251 except ValueError:
249 currentIndex = 0 252 currentIndex = 0
250 self.languageComboBox.clear() 253 self.languageComboBox.clear()
251 254
252 self.languageComboBox.addItem("English (default)", "None") 255 self.languageComboBox.addItem("English (default)", "None")
253 self.languageComboBox.addItem(self.trUtf8('System'), "System") 256 self.languageComboBox.addItem(self.tr('System'), "System")
254 for locale in localeList: 257 for locale in localeList:
255 self.languageComboBox.addItem(locales[locale], locale) 258 self.languageComboBox.addItem(locales[locale], locale)
256 self.languageComboBox.setCurrentIndex(currentIndex) 259 self.languageComboBox.setCurrentIndex(currentIndex)
257 260
258 @pyqtSlot() 261 @pyqtSlot()
260 """ 263 """
261 Private method to select the style sheet file via a dialog. 264 Private method to select the style sheet file via a dialog.
262 """ 265 """
263 file = E5FileDialog.getOpenFileName( 266 file = E5FileDialog.getOpenFileName(
264 self, 267 self,
265 self.trUtf8("Select style sheet file"), 268 self.tr("Select style sheet file"),
266 self.styleSheetEdit.text(), 269 self.styleSheetEdit.text(),
267 self.trUtf8( 270 self.tr(
268 "Qt Style Sheets (*.qss);;Cascading Style Sheets (*.css);;" 271 "Qt Style Sheets (*.qss);;Cascading Style Sheets (*.css);;"
269 "All files (*)")) 272 "All files (*)"))
270 273
271 if file: 274 if file:
272 self.styleSheetEdit.setText(Utilities.toNativeSeparators(file)) 275 self.styleSheetEdit.setText(Utilities.toNativeSeparators(file))

eric ide

mercurial