84 hasAlpha = button.property("hasAlpha") |
84 hasAlpha = button.property("hasAlpha") |
85 |
85 |
86 colDlg = QColorDialog(self) |
86 colDlg = QColorDialog(self) |
87 if hasAlpha: |
87 if hasAlpha: |
88 colDlg.setOptions(QColorDialog.ColorDialogOption.ShowAlphaChannel) |
88 colDlg.setOptions(QColorDialog.ColorDialogOption.ShowAlphaChannel) |
89 # Set current colour last to avoid conflicts with alpha channel |
89 # Set current color last to avoid conflicts with alpha channel |
90 colDlg.setCurrentColor(self.__coloursDict[colorKey][0]) |
90 colDlg.setCurrentColor(self.__coloursDict[colorKey][0]) |
91 colDlg.currentColorChanged.connect( |
91 colDlg.currentColorChanged.connect( |
92 lambda col: self.colourChanged.emit(colorKey, col)) |
92 lambda col: self.colourChanged.emit(colorKey, col)) |
93 colDlg.exec() |
93 colDlg.exec() |
94 |
94 |
98 pm = QPixmap(size.width(), size.height()) |
98 pm = QPixmap(size.width(), size.height()) |
99 pm.fill(colour) |
99 pm.fill(colour) |
100 button.setIcon(QIcon(pm)) |
100 button.setIcon(QIcon(pm)) |
101 self.__coloursDict[colorKey][0] = colour |
101 self.__coloursDict[colorKey][0] = colour |
102 |
102 |
103 # Update colour selection |
103 # Update color selection |
104 self.colourChanged.emit(colorKey, self.__coloursDict[colorKey][0]) |
104 self.colourChanged.emit(colorKey, self.__coloursDict[colorKey][0]) |
105 |
105 |
106 def saveColours(self, prefMethod): |
106 def saveColours(self, prefMethod): |
107 """ |
107 """ |
108 Public method to save the colour selections. |
108 Public method to save the colour selections. |