Esempio n. 1
0
 def __init__(self, data, name, text, parent):
     QPushButton.__init__(self, text, parent)
     self.ic = QPixmap(self.iconSize())
     color = data[name]
     self.data, self.name = data, name
     if color is not None:
         self.current_color = read_color(color).color()
         self.ic.fill(self.current_color)
     else:
         self.ic.fill(Qt.transparent)
         self.current_color = color
     self.update_tooltip()
     self.setIcon(QIcon(self.ic))
     self.clicked.connect(self.choose_color)
Esempio n. 2
0
 def __init__(self, data, name, text, parent):
     QPushButton.__init__(self, text, parent)
     self.ic = QPixmap(self.iconSize())
     color = data[name]
     self.data, self.name = data, name
     if color is not None:
         self.current_color = read_color(color).color()
         self.ic.fill(self.current_color)
     else:
         self.ic.fill(Qt.transparent)
         self.current_color = color
     self.update_tooltip()
     self.setIcon(QIcon(self.ic))
     self.clicked.connect(self.choose_color)
Esempio n. 3
0
 def __init__(self, text=None):
     QPushButton.__init__(self, text)
Esempio n. 4
0
 def __init__(self, text=None):
     QPushButton.__init__(self, text)
Esempio n. 5
0
 def __init__(self, initial_color=None, parent=None, choose_text=None):
     QPushButton.__init__(self, parent)
     self._color = None
     self.choose_text = choose_text or _('Choose &color')
     self.color = initial_color
     self.clicked.connect(self.choose_color)
Esempio n. 6
0
 def __init__(self, text, action, parent):
     QPushButton.__init__(self, text, parent)
     self.clicked.connect(lambda : parent.search_triggered.emit(action))
Esempio n. 7
0
 def __init__(self, text, action, parent):
     QPushButton.__init__(self, text, parent)
     self.clicked.connect(lambda: parent.search_triggered.emit(action))
Esempio n. 8
0
    def __init__(self,
                 parentWidget,
                 label='',
                 labelColumn=0,
                 text='',
                 setAsDefault=True,
                 spanWidth=False):
        """
        Appends a QPushButton (Qt) widget to the bottom of I{parentWidget}, 
        a Property Manager group box.
        
        @param parentWidget: The parent group box containing this widget.
        @type  parentWidget: PM_GroupBox
        
        @param label: The label that appears to the left or right of the 
                      checkbox. 
                      
                      If spanWidth is True, the label will be displayed on
                      its own row directly above the list widget.
                      
                      To suppress the label, set I{label} to an 
                      empty string.
        @type  label: str
        
        @param labelColumn: The column number of the label in the group box
                            grid layout. The only valid values are 0 (left 
                            column) and 1 (right column). The default is 0 
                            (left column).
        @type  labelColumn: int
        
        @param text: The button's text.
        @type  text: str
        
        @param setAsDefault: if True, will restore <text> as the button's text
                         when the "Restore Defaults" button is clicked.
        @type  setAsDefault: bool
        
        @param spanWidth: if True, the widget and its label will span the width
                      of the group box. Its label will appear directly above
                      the widget (unless the label is empty) and is left justified.
        @type  spanWidth: bool
        
        @see: U{B{QPushButton}<http://doc.trolltech.com/4/qpushbutton.html>}
        """

        if 0:  # Debugging code
            print "PM_PushButton.__init__():"
            print "  label        = ", label
            print "  labelColumn  = ", labelColumn
            print "  text         = ", text
            print "  setAsDefault = ", setAsDefault
            print "  spanWidth    = ", spanWidth

        QPushButton.__init__(self)

        self.parentWidget = parentWidget
        self.label = label
        self.labelColumn = labelColumn
        self.setAsDefault = setAsDefault
        self.spanWidth = spanWidth

        if label:  # Create this widget's QLabel.
            self.labelWidget = QLabel()
            self.labelWidget.setText(label)

        # Set text
        self.setText(text)

        # Set default text
        self.defaultText = text
        self.setAsDefault = setAsDefault

        parentWidget.addPmWidget(self)
Esempio n. 9
0
 def __init__(self, initial_color=None, parent=None, choose_text=None):
     QPushButton.__init__(self, parent)
     self._color = None
     self.choose_text = choose_text or _('Choose &color')
     self.color = initial_color
     self.clicked.connect(self.choose_color)
Esempio n. 10
0
    def __init__(self,
                 parentWidget,
                 label        = '',
                 labelColumn  = 0,
                 text         = '',
                 setAsDefault = True,
                 spanWidth    = False
                 ):
        """
        Appends a QPushButton (Qt) widget to the bottom of I{parentWidget},
        a Property Manager group box.

        @param parentWidget: The parent group box containing this widget.
        @type  parentWidget: PM_GroupBox

        @param label: The label that appears to the left or right of the
                      checkbox.

                      If spanWidth is True, the label will be displayed on
                      its own row directly above the list widget.

                      To suppress the label, set I{label} to an
                      empty string.
        @type  label: str

        @param labelColumn: The column number of the label in the group box
                            grid layout. The only valid values are 0 (left
                            column) and 1 (right column). The default is 0
                            (left column).
        @type  labelColumn: int

        @param text: The button's text.
        @type  text: str

        @param setAsDefault: if True, will restore <text> as the button's text
                         when the "Restore Defaults" button is clicked.
        @type  setAsDefault: bool

        @param spanWidth: if True, the widget and its label will span the width
                      of the group box. Its label will appear directly above
                      the widget (unless the label is empty) and is left justified.
        @type  spanWidth: bool

        @see: U{B{QPushButton}<http://doc.trolltech.com/4/qpushbutton.html>}
        """

        if 0: # Debugging code
            print "PM_PushButton.__init__():"
            print "  label        = ", label
            print "  labelColumn  = ", labelColumn
            print "  text         = ", text
            print "  setAsDefault = ", setAsDefault
            print "  spanWidth    = ", spanWidth

        QPushButton.__init__(self)

        self.parentWidget = parentWidget
        self.label        = label
        self.labelColumn  = labelColumn
        self.setAsDefault = setAsDefault
        self.spanWidth    = spanWidth

        if label: # Create this widget's QLabel.
            self.labelWidget = QLabel()
            self.labelWidget.setText(label)

        # Set text
        self.setText(text)

        # Set default text
        self.defaultText=text
        self.setAsDefault = setAsDefault

        parentWidget.addPmWidget(self)