eric6/Preferences/ConfigurationPages/DiffColoursPage.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8218
7c09585bd960
equal deleted inserted replaced
8141:27f636beebad 8143:2c730d5fd177
136 @param button reference to the button been pressed 136 @param button reference to the button been pressed
137 @type QPushButton 137 @type QPushButton
138 """ 138 """
139 colorKey = button.property("colorKey") 139 colorKey = button.property("colorKey")
140 140
141 colour = QColorDialog.getColor(self.__coloursDict[colorKey][0], self, 141 colour = QColorDialog.getColor(
142 "", QColorDialog.ShowAlphaChannel) 142 self.__coloursDict[colorKey][0], self, "",
143 QColorDialog.ColorDialogOption.ShowAlphaChannel)
143 if colour.isValid(): 144 if colour.isValid():
144 self.__coloursDict[colorKey][0] = colour 145 self.__coloursDict[colorKey][0] = colour
145 self.__updateSampleBackgroundColour(colorKey) 146 self.__updateSampleBackgroundColour(colorKey)
146 147
147 @pyqtSlot() 148 @pyqtSlot()
153 @type str 154 @type str
154 """ 155 """
155 colour = self.__coloursDict[colourKey][0] 156 colour = self.__coloursDict[colourKey][0]
156 for sample in self.__allSamples: 157 for sample in self.__allSamples:
157 pl = sample.palette() 158 pl = sample.palette()
158 pl.setColor(QPalette.Text, colour) 159 pl.setColor(QPalette.ColorRole.Text, colour)
159 sample.setPalette(pl) 160 sample.setPalette(pl)
160 sample.repaint() 161 sample.repaint()
161 162
162 def __updateSampleBackgroundColour(self, colourKey): 163 def __updateSampleBackgroundColour(self, colourKey):
163 """ 164 """
168 """ 169 """
169 sample = self.__coloursDict[colourKey][1] 170 sample = self.__coloursDict[colourKey][1]
170 if sample: 171 if sample:
171 colour = self.__coloursDict[colourKey][0] 172 colour = self.__coloursDict[colourKey][0]
172 pl = sample.palette() 173 pl = sample.palette()
173 pl.setColor(QPalette.Base, colour) 174 pl.setColor(QPalette.ColorRole.Base, colour)
174 sample.setPalette(pl) 175 sample.setPalette(pl)
175 sample.repaint() 176 sample.repaint()
176 177
177 178
178 def create(dlg): 179 def create(dlg):

eric ide

mercurial