Preferences/ConfigurationPages/InterfacePage.py

changeset 4577
e79a139aacc4
parent 4095
c78cdc1a3c14
child 4631
5c1a96925da4
equal deleted inserted replaced
4576:a258569d44db 4577:e79a139aacc4
13 import os 13 import os
14 14
15 from PyQt5.QtCore import pyqtSlot, QTranslator 15 from PyQt5.QtCore import pyqtSlot, QTranslator
16 from PyQt5.QtWidgets import QStyleFactory 16 from PyQt5.QtWidgets import QStyleFactory
17 17
18 from E5Gui.E5Completers import E5FileCompleter 18 from E5Gui.E5PathPicker import E5PathPickerModes
19 from E5Gui import E5FileDialog
20 19
21 from .ConfigurationPageBase import ConfigurationPageBase 20 from .ConfigurationPageBase import ConfigurationPageBase
22 from .Ui_InterfacePage import Ui_InterfacePage 21 from .Ui_InterfacePage import Ui_InterfacePage
23 22
24 import Preferences 23 import Preferences
25 import Utilities 24 import Utilities
26 import UI.PixmapCache
27 25
28 from eric6config import getConfig 26 from eric6config import getConfig
29 27
30 28
31 class InterfacePage(ConfigurationPageBase, Ui_InterfacePage): 29 class InterfacePage(ConfigurationPageBase, Ui_InterfacePage):
38 """ 36 """
39 super(InterfacePage, self).__init__() 37 super(InterfacePage, self).__init__()
40 self.setupUi(self) 38 self.setupUi(self)
41 self.setObjectName("InterfacePage") 39 self.setObjectName("InterfacePage")
42 40
43 self.styleSheetButton.setIcon(UI.PixmapCache.getIcon("open.png")) 41 self.styleSheetPicker.setMode(E5PathPickerModes.OpenFileMode)
44 42 self.styleSheetPicker.setFilters(self.tr(
45 self.styleSheetCompleter = E5FileCompleter(self.styleSheetEdit) 43 "Qt Style Sheets (*.qss);;Cascading Style Sheets (*.css);;"
44 "All files (*)"))
46 45
47 # set initial values 46 # set initial values
48 self.__populateStyleCombo() 47 self.__populateStyleCombo()
49 self.__populateLanguageCombo() 48 self.__populateLanguageCombo()
50 49
61 60
62 self.uiCaptionShowsFilenameGroupBox.setChecked( 61 self.uiCaptionShowsFilenameGroupBox.setChecked(
63 Preferences.getUI("CaptionShowsFilename")) 62 Preferences.getUI("CaptionShowsFilename"))
64 self.filenameLengthSpinBox.setValue( 63 self.filenameLengthSpinBox.setValue(
65 Preferences.getUI("CaptionFilenameLength")) 64 Preferences.getUI("CaptionFilenameLength"))
66 self.styleSheetEdit.setText(Preferences.getUI("StyleSheet")) 65 self.styleSheetPicker.setText(Preferences.getUI("StyleSheet"))
67 66
68 if Preferences.getUI("TopLeftByLeft"): 67 if Preferences.getUI("TopLeftByLeft"):
69 self.tlLeftButton.setChecked(True) 68 self.tlLeftButton.setChecked(True)
70 else: 69 else:
71 self.tlTopButton.setChecked(True) 70 self.tlTopButton.setChecked(True)
139 Preferences.setUI( 138 Preferences.setUI(
140 "CaptionFilenameLength", 139 "CaptionFilenameLength",
141 self.filenameLengthSpinBox.value()) 140 self.filenameLengthSpinBox.value())
142 Preferences.setUI( 141 Preferences.setUI(
143 "StyleSheet", 142 "StyleSheet",
144 self.styleSheetEdit.text()) 143 self.styleSheetPicker.text())
145 144
146 # save the dockarea corner settings 145 # save the dockarea corner settings
147 Preferences.setUI( 146 Preferences.setUI(
148 "TopLeftByLeft", 147 "TopLeftByLeft",
149 self.tlLeftButton.isChecked()) 148 self.tlLeftButton.isChecked())
245 for locale in localeList: 244 for locale in localeList:
246 self.languageComboBox.addItem(locales[locale], locale) 245 self.languageComboBox.addItem(locales[locale], locale)
247 self.languageComboBox.setCurrentIndex(currentIndex) 246 self.languageComboBox.setCurrentIndex(currentIndex)
248 247
249 @pyqtSlot() 248 @pyqtSlot()
250 def on_styleSheetButton_clicked(self):
251 """
252 Private method to select the style sheet file via a dialog.
253 """
254 file = E5FileDialog.getOpenFileName(
255 self,
256 self.tr("Select style sheet file"),
257 self.styleSheetEdit.text(),
258 self.tr(
259 "Qt Style Sheets (*.qss);;Cascading Style Sheets (*.css);;"
260 "All files (*)"))
261
262 if file:
263 self.styleSheetEdit.setText(Utilities.toNativeSeparators(file))
264
265 @pyqtSlot()
266 def on_resetLayoutButton_clicked(self): 249 def on_resetLayoutButton_clicked(self):
267 """ 250 """
268 Private method to reset layout to factory defaults. 251 Private method to reset layout to factory defaults.
269 """ 252 """
270 Preferences.resetLayout() 253 Preferences.resetLayout()

eric ide

mercurial