23 from PyQt4
import QtCore, QtGui
27 def __init__(self, width, height, color, parent=None):
28 QtGui.QWidget.__init__(self, parent)
47 self.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
52 color = QtGui.QColorDialog.getColor(self.
color_, self)
54 if(color != self.
color_ and color.isValid()):
56 self.emit(QtCore.SIGNAL(
"colorChanged"))
64 return gfx.RGB(color.redF(), color.greenF(), color.blueF())
69 self.emit(QtCore.SIGNAL(
"colorChanged"))
73 qcolor= QtGui.QColor(color.Red()*255,color.Green()*255,color.Blue()*255,color.Alpha()*255)
79 paint = QtGui.QPainter()
81 brush = QtGui.QBrush(self.
color_)