def __selectColor(self): """ Private slot to select a new drawing color. """ col = KQColorDialog.getColor(self.__currentColor) col.setAlpha(self.__currentAlpha) if col.isValid(): self.emit(SIGNAL("colorSelected(QColor)"), col)
def on_allBackgroundColoursButton_clicked(self): """ Private method used to select the background colour of all styles of a selected lexer. """ colour = KQColorDialog.getColor(self.lexer.paper(self.style)) if colour.isValid(): pl = self.sampleText.palette() pl.setColor(QPalette.Base, colour) self.sampleText.setPalette(pl) self.sampleText.repaint() for style in self.lexer.ind2style.values(): self.lexer.setPaper(colour, style)
def selectColour(self, button, colourVar): """ Public method used by the colour selection buttons. @param button reference to a QButton to show the colour on @param colourVar reference to the variable containing the colour (QColor) @return selected colour (QColor) """ colour = KQColorDialog.getColor(colourVar) if colour.isValid(): size = button.iconSize() pm = QPixmap(size.width(), size.height()) pm.fill(colour) button.setIcon(QIcon(pm)) else: colour = colourVar return colour
def on_backgroundButton_clicked(self): """ Private method used to select the background colour of the selected style and lexer. """ colour = KQColorDialog.getColor(self.lexer.paper(self.style)) if colour.isValid(): pl = self.sampleText.palette() pl.setColor(QPalette.Base, colour) self.sampleText.setPalette(pl) self.sampleText.repaint() if len(self.styleElementList.selectedItems()) > 1: for selItem in self.styleElementList.selectedItems(): style = self.lexer.ind2style[self.styleElementList.row(selItem)] self.lexer.setPaper(colour, style) else: self.lexer.setPaper(colour, self.style)