eric7/Preferences/ConfigurationPages/InterfacePage.py

branch
eric7
changeset 8583
aac629a05f8b
parent 8358
144a6b854f70
child 8587
78971b458d25
diff -r ae6032e4b4ef -r aac629a05f8b eric7/Preferences/ConfigurationPages/InterfacePage.py
--- a/eric7/Preferences/ConfigurationPages/InterfacePage.py	Sun Sep 05 18:07:03 2021 +0200
+++ b/eric7/Preferences/ConfigurationPages/InterfacePage.py	Mon Sep 06 19:52:37 2021 +0200
@@ -11,15 +11,17 @@
 import os
 
 from PyQt6.QtCore import pyqtSlot, QTranslator
-from PyQt6.QtWidgets import QStyleFactory
+from PyQt6.QtWidgets import QStyleFactory, QDialog, QColorDialog
 
 from EricWidgets.EricPathPicker import EricPathPickerModes
+from EricWidgets.EricIconBar import EricIconBar
 
 from .ConfigurationPageBase import ConfigurationPageBase
 from .Ui_InterfacePage import Ui_InterfacePage
 
 import Preferences
 import Utilities
+import UI.PixmapCache
 
 from eric7config import getConfig
 
@@ -42,6 +44,11 @@
             "All files (*)"))
         self.styleSheetPicker.setDefaultDirectory(getConfig("ericStylesDir"))
         
+        self.sampleLabel.setPixmap(
+            UI.PixmapCache.getPixmap("sbDebugViewer48"))
+        self.highlightedSampleLabel.setPixmap(
+            UI.PixmapCache.getPixmap("sbDebugViewer48"))
+        
         # set initial values
         self.__populateStyleCombo()
         self.__populateLanguageCombo()
@@ -98,7 +105,8 @@
         self.numbersCheckBox.setChecked(
             Preferences.getUI("ShowNumbersViewer"))
         
-        self.delaySpinBox.setValue(Preferences.getUI("SidebarDelay"))
+        self.__iconBarColor = Preferences.getUI("IconBarColor")
+        self.__setIconBarColorSamples()
         
     def save(self):
         """
@@ -194,7 +202,7 @@
             "ShowNumbersViewer",
             self.numbersCheckBox.isChecked())
         
-        Preferences.setUI("SidebarDelay", self.delaySpinBox.value())
+        Preferences.setUI("IconBarColor", self.__iconBarColor)
         
     def __populateStyleCombo(self):
         """
@@ -274,6 +282,29 @@
         """
         Preferences.resetLayout()
     
+    def __setIconBarColorSamples(self):
+        """
+        Private method to set the colors of the icon bar color samples.
+        """
+        self.sampleLabel.setStyleSheet(
+            EricIconBar.LabelStyleSheetTemplate
+            .format(self.__iconBarColor.name()))
+        self.highlightedSampleLabel.setStyleSheet(
+            EricIconBar.LabelStyleSheetTemplate
+            .format(self.__iconBarColor.darker().name()))
+    
+    @pyqtSlot()
+    def on_iconBarButton_clicked(self):
+        """
+        Private slot to select the icon bar color.
+        """
+        colDlg = QColorDialog(self)
+        # Set current colour last to avoid conflicts with alpha channel
+        colDlg.setCurrentColor(self.__iconBarColor)
+        if colDlg.exec() == QDialog.DialogCode.Accepted:
+            self.__iconBarColor = colDlg.selectedColor()
+            self.__setIconBarColorSamples()
+
 
 def create(dlg):
     """

eric ide

mercurial