예제 #1
0
 def __init__(self, parent, series_edit):
     QDoubleSpinBox.__init__(self, parent)
     self.dialog = parent
     self.db = self.original_series_name = None
     self.setMaximum(10000000)
     self.series_edit = series_edit
     series_edit.currentIndexChanged.connect(self.enable)
     series_edit.editTextChanged.connect(self.enable)
     series_edit.lineEdit().editingFinished.connect(self.increment)
     self.enable()
예제 #2
0
 def __init__(self, parent, series_edit):
     QDoubleSpinBox.__init__(self, parent)
     self.dialog = parent
     self.db = self.original_series_name = None
     self.setMaximum(10000000)
     self.series_edit = series_edit
     series_edit.currentIndexChanged.connect(self.enable)
     series_edit.editTextChanged.connect(self.enable)
     series_edit.lineEdit().editingFinished.connect(self.increment)
     self.enable()
예제 #3
0
파일: main.py 프로젝트: kmshi/calibre
 def __init__(self, *args, **kwargs):
     QDoubleSpinBox.__init__(self, *args, **kwargs)
     self.tt = _('Position in book')
     self.setToolTip(self.tt)
예제 #4
0
    def __init__(self,
                 parentWidget,
                 label        = '',
                 labelColumn  = 0,
                 value        = 0.0,
                 setAsDefault = True,
                 minimum      = 0.0,
                 maximum      = 99.0,
                 singleStep   = 1.0,
                 decimals     = 1,
                 suffix       = '',
                 spanWidth    = False
                 ):
        """
        Appends a QDoubleSpinBox (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
                      spin box. If label contains the relative path to an
                      icon (.png) file, that icon image will be used for the
                      label.

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

                      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 value: The initial value of the spin box.
        @type  value: float

        @param setAsDefault: If True, will restore I{value} when the
                             "Restore Defaults" button is clicked.
        @type  setAsDefault: bool

        @param minimum: The minimum value of the spin box.
        @type  minimum: float

        @param maximum: The maximum value of the spin box.
        @type  maximum: float

        @param singleStep: When the user uses the arrows to change the
                           spin box's value the value will be
                           incremented/decremented by the amount of the
                           singleStep. The default value is 1.0.
                           Setting a singleStep value of less than 0 does
                           nothing.
        @type  singleStep: float

        @param decimals: The precision of the spin box.
        @type  decimals: int

        @param suffix: The suffix is appended to the end of the displayed value.
                       Typical use is to display a unit of measurement.
                       The default is no suffix. The suffix is not displayed
                       for the minimum value if specialValueText() is set.
        @type  suffix: str

        @param spanWidth: If True, the spin box and its label will span the
                          width of the group box. The label will appear directly
                          above the spin box and is left justified.
        @type  spanWidth: bool

        @see: U{B{QDoubleSpinBox}<http://doc.trolltech.com/4/qdoublespinbox.html>}
        @see: B{InsertNanotube_PropertyManager._chiralityFixup()} for an example
              use of blockSignals flag
        """

        if 0: # Debugging code
            print "PropMgrSpinBox.__init__():"
            print "  label        = ", label
            print "  labelColumn  = ", labelColumn
            print "  value        = ", value
            print "  setAsDefault = ", setAsDefault
            print "  minimum      = ", minimum
            print "  maximum      = ", maximum
            print "  singleStep   = ", singleStep
            print "  decimals     = ", decimals
            print "  suffix       = ", suffix
            print "  spanWidth    = ", spanWidth

        if not parentWidget:
            return

        QDoubleSpinBox.__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 QDoubleSpinBox minimum, maximum, singleStep, decimals, then value
        self.setRange(minimum, maximum)
        self.setSingleStep(singleStep)
        self.setDecimals(decimals)

        self.setValue(value) # This must come after setDecimals().

        if setAsDefault:
            self.setDefaultValue(value)

        # Add suffix if supplied.
        if suffix:
            self.setSuffix(suffix)

        parentWidget.addPmWidget(self)