eric7/Preferences/ConfigurationPages/InterfacePage.py

branch
eric7
changeset 8587
78971b458d25
parent 8583
aac629a05f8b
child 8588
84dfb28716e2
equal deleted inserted replaced
8586:6a315398a554 8587:78971b458d25
42 self.styleSheetPicker.setFilters(self.tr( 42 self.styleSheetPicker.setFilters(self.tr(
43 "Qt Style Sheets (*.qss);;Cascading Style Sheets (*.css);;" 43 "Qt Style Sheets (*.qss);;Cascading Style Sheets (*.css);;"
44 "All files (*)")) 44 "All files (*)"))
45 self.styleSheetPicker.setDefaultDirectory(getConfig("ericStylesDir")) 45 self.styleSheetPicker.setDefaultDirectory(getConfig("ericStylesDir"))
46 46
47 self.sampleLabel.setPixmap( 47 for iconBarSize in EricIconBar.BarSizes:
48 UI.PixmapCache.getPixmap("sbDebugViewer48")) 48 self.iconSizeComboBox.addItem(
49 self.highlightedSampleLabel.setPixmap( 49 EricIconBar.BarSizes[iconBarSize][2], iconBarSize)
50 UI.PixmapCache.getPixmap("sbDebugViewer48"))
51 50
52 # set initial values 51 # set initial values
53 self.__populateStyleCombo() 52 self.__populateStyleCombo()
54 self.__populateLanguageCombo() 53 self.__populateLanguageCombo()
55 self.__populateShellPositionCombo() 54 self.__populateShellPositionCombo()
103 Preferences.getUI("ShowIrc")) 102 Preferences.getUI("ShowIrc"))
104 # bottom side 103 # bottom side
105 self.numbersCheckBox.setChecked( 104 self.numbersCheckBox.setChecked(
106 Preferences.getUI("ShowNumbersViewer")) 105 Preferences.getUI("ShowNumbersViewer"))
107 106
107 self.iconSizeComboBox.setCurrentIndex(
108 self.iconSizeComboBox.findData(Preferences.getUI("IconBarSize")))
108 self.__iconBarColor = Preferences.getUI("IconBarColor") 109 self.__iconBarColor = Preferences.getUI("IconBarColor")
109 self.__setIconBarColorSamples() 110 self.__setIconBarSamples()
111
112 # connect the icon size combo box after initialization is complete
113 self.iconSizeComboBox.currentIndexChanged.connect(
114 self.__setIconBarSamples)
110 115
111 def save(self): 116 def save(self):
112 """ 117 """
113 Public slot to save the Interface configuration. 118 Public slot to save the Interface configuration.
114 """ 119 """
200 # bottom side 205 # bottom side
201 Preferences.setUI( 206 Preferences.setUI(
202 "ShowNumbersViewer", 207 "ShowNumbersViewer",
203 self.numbersCheckBox.isChecked()) 208 self.numbersCheckBox.isChecked())
204 209
205 Preferences.setUI("IconBarColor", self.__iconBarColor) 210 Preferences.setUI(
211 "IconBarSize",
212 self.iconSizeComboBox.currentData())
213 Preferences.setUI(
214 "IconBarColor",
215 self.__iconBarColor)
206 216
207 def __populateStyleCombo(self): 217 def __populateStyleCombo(self):
208 """ 218 """
209 Private method to populate the style combo box. 219 Private method to populate the style combo box.
210 """ 220 """
280 """ 290 """
281 Private method to reset layout to factory defaults. 291 Private method to reset layout to factory defaults.
282 """ 292 """
283 Preferences.resetLayout() 293 Preferences.resetLayout()
284 294
285 def __setIconBarColorSamples(self): 295 @pyqtSlot()
286 """ 296 def __setIconBarSamples(self):
287 Private method to set the colors of the icon bar color samples. 297 """
288 """ 298 Private slot to set the colors of the icon bar color samples.
299 """
300 iconBarSize = self.iconSizeComboBox.currentData()
301 iconSize, borderSize = EricIconBar.BarSizes[iconBarSize][:2]
302 size = iconSize + 2 * borderSize
303
304 self.sampleLabel.setFixedSize(size, size)
289 self.sampleLabel.setStyleSheet( 305 self.sampleLabel.setStyleSheet(
290 EricIconBar.LabelStyleSheetTemplate 306 EricIconBar.LabelStyleSheetTemplate
291 .format(self.__iconBarColor.name())) 307 .format(self.__iconBarColor.name()))
308 self.sampleLabel.setPixmap(
309 UI.PixmapCache.getIcon("sbDebugViewer48")
310 .pixmap(iconSize, iconSize)
311 )
312
313 self.highlightedSampleLabel.setFixedSize(size, size)
292 self.highlightedSampleLabel.setStyleSheet( 314 self.highlightedSampleLabel.setStyleSheet(
293 EricIconBar.LabelStyleSheetTemplate 315 EricIconBar.LabelStyleSheetTemplate
294 .format(self.__iconBarColor.darker().name())) 316 .format(self.__iconBarColor.darker().name()))
317 self.highlightedSampleLabel.setPixmap(
318 UI.PixmapCache.getIcon("sbDebugViewer48")
319 .pixmap(iconSize, iconSize)
320 )
295 321
296 @pyqtSlot() 322 @pyqtSlot()
297 def on_iconBarButton_clicked(self): 323 def on_iconBarButton_clicked(self):
298 """ 324 """
299 Private slot to select the icon bar color. 325 Private slot to select the icon bar color.
301 colDlg = QColorDialog(self) 327 colDlg = QColorDialog(self)
302 # Set current colour last to avoid conflicts with alpha channel 328 # Set current colour last to avoid conflicts with alpha channel
303 colDlg.setCurrentColor(self.__iconBarColor) 329 colDlg.setCurrentColor(self.__iconBarColor)
304 if colDlg.exec() == QDialog.DialogCode.Accepted: 330 if colDlg.exec() == QDialog.DialogCode.Accepted:
305 self.__iconBarColor = colDlg.selectedColor() 331 self.__iconBarColor = colDlg.selectedColor()
306 self.__setIconBarColorSamples() 332 self.__setIconBarSamples()
307 333
308 334
309 def create(dlg): 335 def create(dlg):
310 """ 336 """
311 Module function to create the configuration page. 337 Module function to create the configuration page.

eric ide

mercurial