src/eric7/IconEditor/IconEditorPalette.py

branch
eric7
changeset 10428
a071d4065202
parent 9653
e67609152c5e
child 10439
21c28b0f9e41
equal deleted inserted replaced
10427:3733e2b23cf7 10428:a071d4065202
39 39
40 def __init__(self, parent=None): 40 def __init__(self, parent=None):
41 """ 41 """
42 Constructor 42 Constructor
43 43
44 @param parent reference to the parent widget (QWidget) 44 @param parent reference to the parent widget
45 @type QWidget
45 """ 46 """
46 super().__init__(parent) 47 super().__init__(parent)
47 48
48 direction = ( 49 direction = (
49 QBoxLayout.Direction.LeftToRight 50 QBoxLayout.Direction.LeftToRight
150 151
151 def previewChanged(self, pixmap): 152 def previewChanged(self, pixmap):
152 """ 153 """
153 Public slot to update the preview. 154 Public slot to update the preview.
154 155
155 @param pixmap new preview pixmap (QPixmap) 156 @param pixmap new preview pixmap
157 @type QPixmap
156 """ 158 """
157 self.__preview.setPixmap(pixmap) 159 self.__preview.setPixmap(pixmap)
158 160
159 def colorChanged(self, color): 161 def colorChanged(self, color):
160 """ 162 """
161 Public slot to update the color preview. 163 Public slot to update the color preview.
162 164
163 @param color new color (QColor) 165 @param color new color
166 @type QColor
164 """ 167 """
165 self.__currentColor = color 168 self.__currentColor = color
166 self.__currentAlpha = color.alpha() 169 self.__currentAlpha = color.alpha()
167 170
168 pm = QPixmap(90, 18) 171 pm = QPixmap(90, 18)
190 def __alphaChanged(self, val): 193 def __alphaChanged(self, val):
191 """ 194 """
192 Private slot to track changes of the alpha channel. 195 Private slot to track changes of the alpha channel.
193 196
194 @param val value of the alpha channel 197 @param val value of the alpha channel
198 @type int
195 """ 199 """
196 if val != self.__currentAlpha: 200 if val != self.__currentAlpha:
197 col = QColor(self.__currentColor) 201 col = QColor(self.__currentColor)
198 col.setAlpha(val) 202 col.setAlpha(val)
199 self.colorSelected.emit(col) 203 self.colorSelected.emit(col)
200 204
201 def setCompositingMode(self, mode): 205 def setCompositingMode(self, mode):
202 """ 206 """
203 Public method to set the compositing mode. 207 Public method to set the compositing mode.
204 208
205 @param mode compositing mode to set (QPainter.CompositionMode) 209 @param mode compositing mode to set
210 @type QPainter.CompositionMode
206 """ 211 """
207 if mode == QPainter.CompositionMode.CompositionMode_Source: 212 if mode == QPainter.CompositionMode.CompositionMode_Source:
208 self.__sourceButton.setChecked(True) 213 self.__sourceButton.setChecked(True)
209 elif mode == QPainter.CompositionMode.CompositionMode_SourceOver: 214 elif mode == QPainter.CompositionMode.CompositionMode_SourceOver:
210 self.__sourceOverButton.setChecked(True) 215 self.__sourceOverButton.setChecked(True)
212 def __compositingChanged(self, on): 217 def __compositingChanged(self, on):
213 """ 218 """
214 Private slot to handle a change of the compositing mode. 219 Private slot to handle a change of the compositing mode.
215 220
216 @param on flag indicating the checked state of the compositing button 221 @param on flag indicating the checked state of the compositing button
217 (boolean) 222 @type bool
218 """ 223 """
219 if on: 224 if on:
220 if self.__sourceButton.isChecked(): 225 if self.__sourceButton.isChecked():
221 self.compositingChanged.emit( 226 self.compositingChanged.emit(
222 QPainter.CompositionMode.CompositionMode_Source 227 QPainter.CompositionMode.CompositionMode_Source

eric ide

mercurial