Python PySide.QtGui 模块,QDoubleSpinBox() 实例源码

我们从Python开源项目中,提取了以下8个代码示例,用于说明如何使用PySide.QtGui.QDoubleSpinBox()

项目:FreeCAD-PCB    作者:marmni    | 项目源码 | 文件源码
def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)

        self.form = self
        self.form.setWindowTitle(u"Create drill center")
        self.form.setWindowIcon(QtGui.QIcon(":/data/img/drill-icon.png"))
        #
        self.holeSize = QtGui.QDoubleSpinBox()
        self.holeSize.setValue(0.4)
        self.holeSize.setMinimum(0.1)
        self.holeSize.setSuffix('mm')
        self.holeSize.setSingleStep(0.1)
        #
        self.pcbColor = kolorWarstwy()
        self.pcbColor.setColor(getFromSettings_Color_1('CenterDrillColor', 4294967295))
        self.pcbColor.setToolTip(u"Click to change color")
        #
        lay = QtGui.QGridLayout(self)
        lay.addWidget(QtGui.QLabel('Hole size'), 0, 0, 1, 1)
        lay.addWidget(self.holeSize, 0, 1, 1, 1)
        lay.addWidget(QtGui.QLabel(u'Color:'), 1, 0, 1, 1)
        lay.addWidget(self.pcbColor, 1, 1, 1, 1)
项目:RvMake    作者:Ahuge    | 项目源码 | 文件源码
def __init__(self):
        rv.rvtypes.MinorMode.__init__(self)
        self.init("pyside_example", None, None)

        self.loader = QUiLoader()
        uifile = QFile(os.path.join(self.supportPath(pyside_example, "pyside_example"), "control.ui"))
        uifile.open(QFile.ReadOnly)
        self.dialog = self.loader.load(uifile)
        uifile.close()

        self.enableCheckBox  = self.dialog.findChild(QCheckBox, "enableCheckBox")

        #
        # To retrieve the current RV session window and
        # use it as a Qt QMainWindow, we do the following:
        self.rvSessionQObject = rv.qtutils.sessionWindow()


        # have to hold refs here so they don't get deleted
        self.radialDistortDials = self.findSet(QDial, ["k1Dial", "k2Dial", "k3Dial"])

        self.radialDistortSpins = self.findSet(QDoubleSpinBox, ["k1SpinBox", "k2SpinBox", "k3SpinBox"])

        self.lastRadialDistort = [0,0,0]

        self.hookup(self.enableCheckBox, self.radialDistortSpins, self.radialDistortDials, "#RVLensWarp", self.lastRadialDistort)
项目:FreeCAD-PCB    作者:marmni    | 项目源码 | 文件源码
def __init__(self, parent=None):
        QtGui.QDoubleSpinBox.__init__(self, parent)

        self.setStyleSheet('''
            QDoubleSpinBox
            {
              border:0px;
            }
        ''')
项目:LCInterlocking    作者:execuc    | 项目源码 | 文件源码
def create_item(self, widget_config, grid, row_index):
        widget_config.widget_title = QtGui.QLabel(self.form)
        widget_config.widget_title.setText("%s : " % widget_config.show_name)

        if widget_config.type == float and not hasattr(widget_config, 'step'):
            widget_config.widget = QtGui.QLabel(self.form)
            widget_config.widget.setText("%f" % self.get_property_value(widget_config.name))
        elif widget_config.type == float:
            widget_config.widget = QtGui.QDoubleSpinBox(self.form)
            widget_config.widget.setDecimals(widget_config.decimals)
            widget_config.widget.setSingleStep(widget_config.step)
            widget_config.widget.setMinimum(widget_config.interval_value[0])
            widget_config.widget.setValue(self.get_property_value(widget_config.name))
            widget_config.widget.setMaximum(widget_config.interval_value[-1])
        elif widget_config.type == bool:
            widget_config.widget = QtGui.QCheckBox("", self.form)
            state = QtCore.Qt.Checked if self.get_property_value(widget_config.name) == True else QtCore.Qt.Unchecked
            widget_config.widget.setCheckState(state)
        elif widget_config.type == list:
            widget_config.widget = QtGui.QComboBox(self.form)
            widget_config.widget.addItems(widget_config.interval_value)
            default_value_index = 0
            for str_value in widget_config.interval_value:
                if self.get_property_value(widget_config.name) == str_value:
                    break
                default_value_index += 1
            if default_value_index == len(widget_config.interval_value):
                raise ValueError("Default value not found for list" + widget_config.name)
            widget_config.widget.setCurrentIndex(default_value_index)
            widget_config.widget.currentIndexChanged.connect(self.listchangeIndex)
        elif widget_config.type == str:
            widget_config.widget = QtGui.QLineEdit(self.form)
            widget_config.widget.setText(self.get_property_value(widget_config.name))
        else:
            raise ValueError("Undefined widget type")

        grid.addWidget(widget_config.widget_title, row_index, 0)
        grid.addWidget(widget_config.widget, row_index, 1)
项目:TWTools    作者:ZeX2    | 项目源码 | 文件源码
def setupUi(self):
        """Bruh"""
        self.setGeometry(50, 50, 300, 150)
        self.setWindowTitle("ZeZe's TWTools - Input Speeds")
        self.setWindowIcon(QtGui.QIcon(resource_path("images/icon.png")))

        """Background color"""
        self.backgroundPalette = QtGui.QPalette()
        self.backgroundColor = QtGui.QColor(217, 204, 170)
        self.backgroundPalette.setColor(QtGui.QPalette.Background, self.backgroundColor)
        self.setPalette(self.backgroundPalette)

        """Form layout"""
        self.formLayout = QtGui.QFormLayout(self)
        self.formLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)

        """World speed label & input box"""
        self.world_speedLabel = QtGui.QLabel("World Speed:", self)
        self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.world_speedLabel)

        self.world_speedBox = QtGui.QDoubleSpinBox(self)
        self.world_speedBox.setDecimals(1)
        self.world_speedBox.setMaximum(1000.0)
        self.world_speedBox.setSingleStep(0.5)
        self.world_speedBox.setProperty("value", 1.0)
        self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.world_speedBox)

        """Unit speed label & input box"""
        self.unit_speedLabel = QtGui.QLabel("Unit Speed:", self)
        self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.unit_speedLabel)

        self.unit_speedBox = QtGui.QDoubleSpinBox(self)
        self.unit_speedBox.setDecimals(1)
        self.unit_speedBox.setMaximum(1000.0)
        self.unit_speedBox.setSingleStep(0.5)
        self.unit_speedBox.setProperty("value", 1.0)
        self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.unit_speedBox)

        """Spacer"""
        self.Spacer = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.formLayout.setItem(2, QtGui.QFormLayout.FieldRole, self.Spacer)

        """Ok button"""
        self.okButton = QtGui.QPushButton("Ok", self)
        self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.okButton)
        self.okButton.clicked.connect(self.get_data)
项目:FreeCAD-PCB    作者:marmni    | 项目源码 | 文件源码
def __init__(self, parent=None):
        reload(PCBconf)

        QtGui.QWidget.__init__(self, parent)
        freecadSettings = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/PCB")

        self.form = self
        self.form.setWindowTitle(u"Create PCB")
        self.form.setWindowIcon(QtGui.QIcon(":/data/img/board.png"))
        #
        self.gruboscPlytki = QtGui.QDoubleSpinBox(self)
        self.gruboscPlytki.setSingleStep(0.1)
        self.gruboscPlytki.setValue(freecadSettings.GetFloat("boardThickness", 1.5))
        self.gruboscPlytki.setSuffix(u" mm")
        #
        self.pcbBorder = QtGui.QLineEdit('')
        self.pcbBorder.setReadOnly(True)

        pickPcbBorder = pickSketch(self.pcbBorder)
        #
        self.pcbHoles = QtGui.QLineEdit('')
        self.pcbHoles.setReadOnly(True)

        pickPcbHoles = pickSketch(self.pcbHoles)
        #
        self.pcbColor = kolorWarstwy()
        self.pcbColor.setColor(self.pcbColor.PcbColorToRGB(PCBconf.PCB_COLOR))
        self.pcbColor.setToolTip(u"Click to change color")
        #
        lay = QtGui.QGridLayout()
        lay.addWidget(QtGui.QLabel(u'Border:'), 0, 0, 1, 1)
        lay.addWidget(self.pcbBorder, 0, 1, 1, 1)
        lay.addWidget(pickPcbBorder, 0, 2, 1, 1)
        lay.addWidget(QtGui.QLabel(u'Holes:'), 1, 0, 1, 1)
        lay.addWidget(self.pcbHoles, 1, 1, 1, 1)
        lay.addWidget(pickPcbHoles, 1, 2, 1, 1)
        lay.addWidget(QtGui.QLabel(u'Thickness:'), 2, 0, 1, 1)
        lay.addWidget(self.gruboscPlytki, 2, 1, 1, 2)
        lay.addWidget(QtGui.QLabel(u'Color:'), 3, 0, 1, 1)
        lay.addWidget(self.pcbColor, 3, 1, 1, 2)
        #
        self.setLayout(lay)
项目:FreeCAD-PCB    作者:marmni    | 项目源码 | 文件源码
def addRow(self, rowType):
        self.insertRow(self.rowCount())
        row = self.rowCount() - 1

        b = QtGui.QCheckBox("")
        b.setToolTip(u"Active")
        self.setCellWidget(row, 0, b)

        a = QtGui.QTableWidgetItem(rowType)
        a.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
        self.setItem(row, 1, a)

        c = QtGui.QComboBox()
        c.addItems(["True", "False"])
        self.setCellWidget(row, 2, c)

        d = QtGui.QDoubleSpinBox()
        d.setSingleStep(0.1)
        d.setRange(-1000, 1000)
        d.setSuffix("mm")
        self.setCellWidget(row, 3, d)

        e = QtGui.QDoubleSpinBox()
        e.setSingleStep(0.1)
        e.setRange(-1000, 1000)
        e.setSuffix("mm")
        self.setCellWidget(row, 4, e)

        f = QtGui.QDoubleSpinBox()
        f.setSingleStep(0.1)
        f.setRange(-1000, 1000)
        f.setSuffix("mm")
        self.setCellWidget(row, 5, f)

        g = QtGui.QDoubleSpinBox()
        g.setSingleStep(0.1)
        g.setValue(1.27)
        g.setSuffix("mm")
        self.setCellWidget(row, 6, g)

        color = kolorWarstwy()
        color.setToolTip(u"Click to change color")
        self.setCellWidget(row, 7, color)

        i = QtGui.QComboBox()
        i.addItems(["bottom-left", "bottom-center", "bottom-right", "center-left", "center", "center-right", "top-left", "top-center", "top-right"])
        i.setCurrentIndex(4)
        self.setCellWidget(row, 8, i)

        #
        self.setColumnWidth(0, 25)
项目:FreeCAD-PCB    作者:marmni    | 项目源码 | 文件源码
def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        #
        self.listaBibliotek = QtGui.QComboBox()
        self.listaBibliotekInfo = QtGui.QLabel(' ')
        #
        self.positionX = QtGui.QDoubleSpinBox()
        self.positionX.setSingleStep(0.1)
        self.positionX.setRange(-1000, 1000)
        self.positionX.setSuffix(' mm')
        self.positionY = QtGui.QDoubleSpinBox()
        self.positionY.setSingleStep(0.1)
        self.positionY.setRange(-1000, 1000)
        self.positionY.setSuffix(' mm')
        self.positionZ = QtGui.QDoubleSpinBox()
        self.positionZ.setSingleStep(0.1)
        self.positionZ.setRange(-1000, 1000)
        self.positionZ.setSuffix(' mm')
        self.rotationRX = QtGui.QDoubleSpinBox()
        self.rotationRX.setSingleStep(0.1)
        self.rotationRX.setRange(-360, 360)
        self.rotationRX.setSuffix(' deg')
        self.rotationRY = QtGui.QDoubleSpinBox()
        self.rotationRY.setSingleStep(0.1)
        self.rotationRY.setRange(-360, 360)
        self.rotationRY.setSuffix(' deg')
        self.rotationRZ = QtGui.QDoubleSpinBox()
        self.rotationRZ.setSingleStep(0.1)
        self.rotationRZ.setRange(-360, 360)
        self.rotationRZ.setSuffix(' deg')
        #
        translationFrame = QtGui.QGroupBox(u'Translation:')
        translationFrameLay = QtGui.QFormLayout(translationFrame)
        translationFrameLay.addRow(QtGui.QLabel('X:'), self.positionX)
        translationFrameLay.addRow(QtGui.QLabel('Y:'), self.positionY)
        translationFrameLay.addRow(QtGui.QLabel('Z:'), self.positionZ)
        translationFrameLay.setContentsMargins(5, 5, 5, 5)
        #
        rotationFrame = QtGui.QGroupBox(u'Rotation:')
        rotationFrameLay = QtGui.QFormLayout(rotationFrame)
        rotationFrameLay.addRow(QtGui.QLabel('RX:'), self.rotationRX)
        rotationFrameLay.addRow(QtGui.QLabel('RY:'), self.rotationRY)
        rotationFrameLay.addRow(QtGui.QLabel('RZ:'), self.rotationRZ)
        rotationFrameLay.setContentsMargins(5, 5, 5, 5)
        #
        libraryFrame = QtGui.QGroupBox(u'Library:')
        libraryFrameLay = QtGui.QVBoxLayout(libraryFrame)
        libraryFrameLay.addWidget(self.listaBibliotek)
        libraryFrameLay.addWidget(self.listaBibliotekInfo)
        #
        self.resetButton = QtGui.QPushButton(u'Reset')
        self.resetButton.setMaximumWidth(60)
        #
        lay = QtGui.QGridLayout()
        lay.addWidget(libraryFrame, 0, 0, 1, 2)
        lay.addWidget(translationFrame, 1, 0, 1, 1)
        lay.addWidget(rotationFrame, 1, 1, 1, 1)
        lay.addItem(QtGui.QSpacerItem(1, 10), 2, 0, 1, 2)
        lay.addWidget(self.resetButton, 3, 1, 1, 1, QtCore.Qt.AlignRight)
        lay.setRowStretch(4, 5)
        self.setLayout(lay)