py::gui::widget::color_button Class Reference

List of all members.

Public Member Functions

def __init__
def setup_ui
def set_color
def get_color
def edit

Public Attributes

 pixmap_size
 color

Private Member Functions

def __make_pixmap


Member Function Documentation

def py::gui::widget::color_button::__init__ (   self,
  parent = None 
)

00077                                           :
00078                 QPushButton.__init__(self, "", parent)
00079                 self.pixmap_size = 20, 20
00080                 self.color = None
00081                 self.setup_ui()
00082         
        def setup_ui( self ) :

def py::gui::widget::color_button::setup_ui (   self  ) 

00083                              :
00084                 self.setFixedWidth(32)
00085                 self.setIconSize(QSize(*self.pixmap_size))
00086                 QObject.connect(self, SIGNAL("clicked()"), self.edit)
00087         
        def set_color( self, color ) :

def py::gui::widget::color_button::set_color (   self,
  color 
)

00088                                      :
00089                 self.color = color
00090                 self.setIcon(QIcon(self.__make_pixmap(color)))
00091         
        def get_color( self ) :

def py::gui::widget::color_button::get_color (   self  ) 

00092                               :
00093                 return self.color
00094 
        def __make_pixmap( self, color ) :

def py::gui::widget::color_button::__make_pixmap (   self,
  color 
) [private]

00095                                          :
00096                 w, h = self.pixmap_size
00097                 pix = QPixmap(w, h)
00098                 pen = QPainter(pix)
00099                 pen.fillRect(0, 0, w, h, QBrush(QColor(color)))
00100                 pen.setPen(Qt.darkGray)
00101                 pen.drawRect(0, 0, w-1, h-1)
00102                 pen.end()
00103                 return pix
00104         
        def edit( self ) :

def py::gui::widget::color_button::edit (   self  ) 

00105                          :
00106                 if self.color :
00107                         color = QColor(self.color)
00108                 else :
00109                         color = QColor()
00110                 color = QColorDialog.getColor(color, self)
00111                 if color.isValid() :
00112                         color = str(color.name())
00113                         if color != self.color :
00114                                 self.set_color(color)
00115                                 QObject.emit(self, SIGNAL("changed"))
00116 
00117 
class link_label( QLabel ) :


Member Data Documentation

py::gui::widget::color_button::pixmap_size

py::gui::widget::color_button::color


The documentation for this class was generated from the following file:
Generated on Tue Oct 9 20:40:30 2007 for Qomics by  doxygen 1.5.3