14 """ |
14 """ |
15 Class implementing a palette widget for the icon editor. |
15 Class implementing a palette widget for the icon editor. |
16 |
16 |
17 @signal colorSelected(QColor) emitted after a new color has been selected |
17 @signal colorSelected(QColor) emitted after a new color has been selected |
18 """ |
18 """ |
|
19 colorSelected = pyqtSignal(QColor) |
|
20 |
19 def __init__(self, parent = None): |
21 def __init__(self, parent = None): |
20 """ |
22 """ |
21 Constructor |
23 Constructor |
22 |
24 |
23 @param parent reference to the parent widget (QWidget) |
25 @param parent reference to the parent widget (QWidget) |
72 self.__colorAlpha.setWhatsThis(self.trUtf8( |
74 self.__colorAlpha.setWhatsThis(self.trUtf8( |
73 """<b>Select alpha channel value</b>""" |
75 """<b>Select alpha channel value</b>""" |
74 """<p>Select the value for the alpha channel of the current color.</p>""" |
76 """<p>Select the value for the alpha channel of the current color.</p>""" |
75 )) |
77 )) |
76 self.__layout.addWidget(self.__colorAlpha) |
78 self.__layout.addWidget(self.__colorAlpha) |
77 self.connect(self.__colorAlpha, SIGNAL("valueChanged(int)"), |
79 self.__colorAlpha.valueChanged[int].connect(self.__alphaChanged) |
78 self.__alphaChanged) |
|
79 |
80 |
80 spacer = QSpacerItem(10, 10, QSizePolicy.Minimum, QSizePolicy.Expanding) |
81 spacer = QSpacerItem(10, 10, QSizePolicy.Minimum, QSizePolicy.Expanding) |
81 self.__layout.addItem(spacer) |
82 self.__layout.addItem(spacer) |
82 |
83 |
83 def previewChanged(self, pixmap): |
84 def previewChanged(self, pixmap): |
109 """ |
110 """ |
110 col = QColorDialog.getColor(self.__currentColor) |
111 col = QColorDialog.getColor(self.__currentColor) |
111 col.setAlpha(self.__currentAlpha) |
112 col.setAlpha(self.__currentAlpha) |
112 |
113 |
113 if col.isValid(): |
114 if col.isValid(): |
114 self.emit(SIGNAL("colorSelected(QColor)"), col) |
115 self.colorSelected.emit(col) |
115 |
116 |
116 def __alphaChanged(self, val): |
117 def __alphaChanged(self, val): |
117 """ |
118 """ |
118 Private slot to track changes of the alpha channel. |
119 Private slot to track changes of the alpha channel. |
119 |
120 |
120 @param val value of the alpha channel |
121 @param val value of the alpha channel |
121 """ |
122 """ |
122 if val != self.__currentAlpha: |
123 if val != self.__currentAlpha: |
123 col = QColor(self.__currentColor) |
124 col = QColor(self.__currentColor) |
124 col.setAlpha(val) |
125 col.setAlpha(val) |
125 self.emit(SIGNAL("colorSelected(QColor)"), col) |
126 self.colorSelected.emit(col) |