eric7/Preferences/ConfigurationPages/InterfacePage.py

branch
eric7
changeset 8583
aac629a05f8b
parent 8358
144a6b854f70
child 8587
78971b458d25
equal deleted inserted replaced
8582:ae6032e4b4ef 8583:aac629a05f8b
9 9
10 import glob 10 import glob
11 import os 11 import os
12 12
13 from PyQt6.QtCore import pyqtSlot, QTranslator 13 from PyQt6.QtCore import pyqtSlot, QTranslator
14 from PyQt6.QtWidgets import QStyleFactory 14 from PyQt6.QtWidgets import QStyleFactory, QDialog, QColorDialog
15 15
16 from EricWidgets.EricPathPicker import EricPathPickerModes 16 from EricWidgets.EricPathPicker import EricPathPickerModes
17 from EricWidgets.EricIconBar import EricIconBar
17 18
18 from .ConfigurationPageBase import ConfigurationPageBase 19 from .ConfigurationPageBase import ConfigurationPageBase
19 from .Ui_InterfacePage import Ui_InterfacePage 20 from .Ui_InterfacePage import Ui_InterfacePage
20 21
21 import Preferences 22 import Preferences
22 import Utilities 23 import Utilities
24 import UI.PixmapCache
23 25
24 from eric7config import getConfig 26 from eric7config import getConfig
25 27
26 28
27 class InterfacePage(ConfigurationPageBase, Ui_InterfacePage): 29 class InterfacePage(ConfigurationPageBase, Ui_InterfacePage):
39 self.styleSheetPicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) 41 self.styleSheetPicker.setMode(EricPathPickerModes.OPEN_FILE_MODE)
40 self.styleSheetPicker.setFilters(self.tr( 42 self.styleSheetPicker.setFilters(self.tr(
41 "Qt Style Sheets (*.qss);;Cascading Style Sheets (*.css);;" 43 "Qt Style Sheets (*.qss);;Cascading Style Sheets (*.css);;"
42 "All files (*)")) 44 "All files (*)"))
43 self.styleSheetPicker.setDefaultDirectory(getConfig("ericStylesDir")) 45 self.styleSheetPicker.setDefaultDirectory(getConfig("ericStylesDir"))
46
47 self.sampleLabel.setPixmap(
48 UI.PixmapCache.getPixmap("sbDebugViewer48"))
49 self.highlightedSampleLabel.setPixmap(
50 UI.PixmapCache.getPixmap("sbDebugViewer48"))
44 51
45 # set initial values 52 # set initial values
46 self.__populateStyleCombo() 53 self.__populateStyleCombo()
47 self.__populateLanguageCombo() 54 self.__populateLanguageCombo()
48 self.__populateShellPositionCombo() 55 self.__populateShellPositionCombo()
96 Preferences.getUI("ShowIrc")) 103 Preferences.getUI("ShowIrc"))
97 # bottom side 104 # bottom side
98 self.numbersCheckBox.setChecked( 105 self.numbersCheckBox.setChecked(
99 Preferences.getUI("ShowNumbersViewer")) 106 Preferences.getUI("ShowNumbersViewer"))
100 107
101 self.delaySpinBox.setValue(Preferences.getUI("SidebarDelay")) 108 self.__iconBarColor = Preferences.getUI("IconBarColor")
109 self.__setIconBarColorSamples()
102 110
103 def save(self): 111 def save(self):
104 """ 112 """
105 Public slot to save the Interface configuration. 113 Public slot to save the Interface configuration.
106 """ 114 """
192 # bottom side 200 # bottom side
193 Preferences.setUI( 201 Preferences.setUI(
194 "ShowNumbersViewer", 202 "ShowNumbersViewer",
195 self.numbersCheckBox.isChecked()) 203 self.numbersCheckBox.isChecked())
196 204
197 Preferences.setUI("SidebarDelay", self.delaySpinBox.value()) 205 Preferences.setUI("IconBarColor", self.__iconBarColor)
198 206
199 def __populateStyleCombo(self): 207 def __populateStyleCombo(self):
200 """ 208 """
201 Private method to populate the style combo box. 209 Private method to populate the style combo box.
202 """ 210 """
272 """ 280 """
273 Private method to reset layout to factory defaults. 281 Private method to reset layout to factory defaults.
274 """ 282 """
275 Preferences.resetLayout() 283 Preferences.resetLayout()
276 284
285 def __setIconBarColorSamples(self):
286 """
287 Private method to set the colors of the icon bar color samples.
288 """
289 self.sampleLabel.setStyleSheet(
290 EricIconBar.LabelStyleSheetTemplate
291 .format(self.__iconBarColor.name()))
292 self.highlightedSampleLabel.setStyleSheet(
293 EricIconBar.LabelStyleSheetTemplate
294 .format(self.__iconBarColor.darker().name()))
295
296 @pyqtSlot()
297 def on_iconBarButton_clicked(self):
298 """
299 Private slot to select the icon bar color.
300 """
301 colDlg = QColorDialog(self)
302 # Set current colour last to avoid conflicts with alpha channel
303 colDlg.setCurrentColor(self.__iconBarColor)
304 if colDlg.exec() == QDialog.DialogCode.Accepted:
305 self.__iconBarColor = colDlg.selectedColor()
306 self.__setIconBarColorSamples()
307
277 308
278 def create(dlg): 309 def create(dlg):
279 """ 310 """
280 Module function to create the configuration page. 311 Module function to create the configuration page.
281 312

eric ide

mercurial