示例#1
0
 def __init__(self, *args):
     QToolButton.__init__(self, *args)
     self.animation = QPropertyAnimation(self, 'iconSize', self)
     self.animation.setDuration(60 / 72. * 1000)
     self.animation.setLoopCount(4)
     self.normal_icon_size = QSize(64, 64)
     self.animation.valueChanged.connect(self.value_changed)
     self.setCursor(Qt.PointingHandCursor)
     self.animation.finished.connect(self.animation_finished)
示例#2
0
 def __init__(self, *args):
     QToolButton.__init__(self, *args)
     self.animation = QPropertyAnimation(self, 'iconSize', self)
     self.animation.setDuration(60/72.*1000)
     self.animation.setLoopCount(4)
     self.normal_icon_size = QSize(64, 64)
     self.animation.valueChanged.connect(self.value_changed)
     self.setCursor(Qt.PointingHandCursor)
     self.animation.finished.connect(self.animation_finished)
示例#3
0
    def __init__(self, icon, text, splitter, parent=None, shortcut=None):
        QToolButton.__init__(self, parent)
        self.label = text
        self.setIcon(QIcon(icon))
        self.setCheckable(True)

        self.splitter = splitter
        splitter.state_changed.connect(self.update_state)
        self.setCursor(Qt.PointingHandCursor)
        self.shortcut = ''
        if shortcut:
            self.shortcut = shortcut
示例#4
0
    def __init__(self, icon, text, splitter, parent=None, shortcut=None):
        QToolButton.__init__(self, parent)
        self.label = text
        self.setIcon(QIcon(icon))
        self.setCheckable(True)

        self.splitter = splitter
        splitter.state_changed.connect(self.update_state)
        self.setCursor(Qt.PointingHandCursor)
        self.shortcut = ''
        if shortcut:
            self.shortcut = shortcut
示例#5
0
    def __init__(self,
                 parentWidget,
                 label='',
                 labelColumn=0,
                 text='',
                 iconPath='',
                 setAsDefault=True,
                 spanWidth=False):
        """
        Appends a QToolButton (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 iconPath: The relative path to the button's icon.
        @type  iconPath: 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{QToolButton}<http://doc.trolltech.com/4/qtoolbutton.html>}
        """

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

        QToolButton.__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 icon
        self.setIcon(geticon(iconPath))
        self.setIconSize(QSize(22, 22))

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

        parentWidget.addPmWidget(self)
示例#6
0
 def __init__(self, 
              parentWidget, 
              label        = '', 
              labelColumn  = 0,
              text         = '', 
              iconPath     = '',
              setAsDefault = True,
              spanWidth    = False 
              ):
     """
     Appends a QToolButton (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 iconPath: The relative path to the button's icon.
     @type  iconPath: 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{QToolButton}<http://doc.trolltech.com/4/qtoolbutton.html>}
     """
     
     if 0: # Debugging code
         print "PM_ToolButton.__init__():"
         print "  label        = ", label
         print "  labelColumn  = ", labelColumn
         print "  text         = ", text
         print "  iconPath     = ", iconPath
         print "  setAsDefault = ", setAsDefault
         print "  spanWidth    = ", spanWidth
     
     QToolButton.__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 icon
     self.setIcon(geticon(iconPath))
     self.setIconSize(QSize(22, 22))
     
     # Set default text
     self.defaultText  = text
     self.setAsDefault = setAsDefault
     
     parentWidget.addPmWidget(self)