Python PySide.QtGui.QDoubleSpinBox() Examples
The following are 18
code examples of PySide.QtGui.QDoubleSpinBox().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PySide.QtGui
, or try the search function
.
Example #1
Source File: options.py From dpa-pipe with MIT License | 5 votes |
def value(self): return QtGui.QDoubleSpinBox.value(self) # -----------------------------------------------------------------------------
Example #2
Source File: toolwidget.py From LCInterlocking with GNU Lesser General Public License v2.1 | 5 votes |
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.setMaximum(widget_config.interval_value[-1]) widget_config.widget.setValue(self.get_property_value(widget_config.name)) 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)
Example #3
Source File: preferences.py From FreeCAD_drawing_dimensioning with GNU Lesser General Public License v2.1 | 5 votes |
def generateWidget(self, dimensioningProcess): self.dimensioningProcess = dimensioningProcess groupbox = QtGui.QGroupBox("Unit Options") groupbox.setCheckable( True ) groupbox.toggled.connect( self.groupBoxToggled ) self.groupbox = groupbox checked = self.dd_parms.GetBool("show_unit_options",True) groupbox.setChecked(checked) #self.groupBoxToggled( checked ) #groupbox.setCheckState( QtCore.Qt.CheckState.Checked ) vbox = QtGui.QVBoxLayout() unitSelected = QtGui.QComboBox() unitSelected.addItem('Edit->Preference->Unit') unitSelected.addItem('mm') unitSelected.addItem('inch') unitSelected.addItem('m') unitSelected.addItem('custom') unitSelected.setCurrentIndex( self.unitSelected_combobox_index ) unitSelected.currentIndexChanged.connect( self.settingsChanged ) vbox.addWidget( unitSelected ) self.unitSelected_combobox = unitSelected spinbox = QtGui.QDoubleSpinBox() spinbox.setValue( self.customScaleValue ) spinbox.setMinimum( 0 ) spinbox.setDecimals( 6 ) spinbox.setSingleStep( 0.1 ) spinbox.setSuffix('/mm') spinbox.valueChanged.connect( self.settingsChanged ) vbox.addLayout( DimensioningTaskDialog_generate_row_hbox('custom', spinbox) ) self.customUnit_spinbox = spinbox groupbox.setLayout(vbox) self.settingsChanged() return groupbox
Example #4
Source File: preferences.py From FreeCAD_drawing_dimensioning with GNU Lesser General Public License v2.1 | 5 votes |
def generateWidget( self, dimensioningProcess ): self.dimensioningProcess = dimensioningProcess spinbox = QtGui.QDoubleSpinBox() spinbox.setValue( self.getDefaultValue() ) spinbox.setMinimum( self.spinBox_min ) spinbox.setSingleStep( self.spinBox_increment ) spinbox.setDecimals(self.spinBox_decimals) spinbox.valueChanged.connect( self.valueChanged ) self.spinbox = spinbox return DimensioningTaskDialog_generate_row_hbox( self.label, spinbox )
Example #5
Source File: SearcherTab.py From CANalyzat0r with GNU General Public License v3.0 | 5 votes |
def __init__(self, tabWidget): AbstractTab.__init__(self, tabWidget, Strings.searcherTabLoggerName, [2, 3, 4], Strings.searcherTabPacketTableViewName, Strings.searcherTabLabelInterfaceValueName) #: The currently smallest known set of packets that cause a specific action. #: Values are lists with raw data self.lastWorkingChunk = [] # Packet gap self.sleepTime = 0 #: We first search downwards in the binary search tree. If this doesn't #: succeed, we use randomization and begint to search upwards. self.downwardsSearch = True # Get all GUI elements self.buttonSearcherAddPacket = self.tabWidget.findChild( QtGui.QPushButton, "buttonSearcherAddPacket") self.doubleSpinBoxSearcherPacketGap = self.tabWidget.findChild( QtGui.QDoubleSpinBox, "doubleSpinBoxSearcherPacketGap") self.buttonSearcherInterfaceSettings = self.tabWidget.findChild( QtGui.QPushButton, "buttonSearcherInterfaceSettings") self.buttonSearcherStart = self.tabWidget.findChild( QtGui.QPushButton, "buttonSearcherStart") self.buttonSearcherDataClear = self.tabWidget.findChild( QtGui.QPushButton, "buttonSearcherDataClear") assert all(GUIElem is not None for GUIElem in [ self.buttonSearcherAddPacket, self.doubleSpinBoxSearcherPacketGap, self.buttonSearcherInterfaceSettings, self.buttonSearcherStart, self.buttonSearcherDataClear ]), "GUI Elements not found" self.buttonSearcherInterfaceSettings.clicked.connect( self.handleInterfaceSettingsDialog) self.buttonSearcherStart.clicked.connect(self.searchPackets) self.buttonSearcherAddPacket.clicked.connect(self.manualAddPacket) self.buttonSearcherDataClear.clicked.connect(self.clear) self.prepareUI()
Example #6
Source File: animate_constraint.py From FreeCAD_assembly2 with GNU Lesser General Public License v2.1 | 5 votes |
def generateWidget( self, parameterDict, constraint_to_animate ): self.parameterDict = parameterDict self.constraint_to_animate = constraint_to_animate spinbox = QtGui.QDoubleSpinBox() default = self.getDefaultValue() spinbox.setMinimum( self.spinBox_min ) spinbox.setMaximum( self.spinBox_max ) spinbox.setSingleStep( self.spinBox_increment ) spinbox.setDecimals( self.spinBox_decimalPlaces ) spinbox.setValue( default ) #spinbox.valueChanged.connect( self.valueChanged ) #self.valueChanged(default) self.spinbox = spinbox return Qt_label_widget( self.label, spinbox, self.info_button_text )
Example #7
Source File: scroll_gui.py From FRETBursts with GNU General Public License v2.0 | 5 votes |
def set_spinbox(self, parent): if self.debug: pprint('ScrollingToolQT set_spinbox\n') self.spinb = QtGui.QDoubleSpinBox(parent=parent) self.spinb.setDecimals(3) self.spinb.setRange(0.001, 60e3) self.spinb.setSuffix(" ms") self.spinb.setValue(self.width * 1e3) # set the initial width self.spinb.valueChanged.connect(self.spinbox_changed) parent.addWidget(self.spinb)
Example #8
Source File: timetrace_scroll_demo3.py From FRETBursts with GNU General Public License v2.0 | 5 votes |
def set_spinbox(self, parent): self.spinb = QtGui.QDoubleSpinBox(parent=parent) self.spinb.setDecimals(3) self.spinb.setRange(0.001, 3600.) self.spinb.setSuffix(" s") self.spinb.setValue(self.plot_width) # set the initial width self.spinb.valueChanged.connect(self.xwidth_changed) parent.addWidget(self.spinb)
Example #9
Source File: timetrace_scroll_demo2.py From FRETBursts with GNU General Public License v2.0 | 5 votes |
def set_spinbox(self, parent): self.spinb = QtGui.QDoubleSpinBox(parent=parent) self.spinb.setDecimals(3) self.spinb.setRange(0.001, 3600.) self.spinb.setSuffix(" s") self.spinb.setValue(self.width) # set the initial width self.spinb.valueChanged.connect(self.xwidth_changed) parent.addWidget(self.spinb)
Example #10
Source File: timetrace_scroll_pygraphqt.py From FRETBursts with GNU General Public License v2.0 | 5 votes |
def set_spinbox(self, parent): self.spinb = QtGui.QDoubleSpinBox(parent=parent) self.spinb.setDecimals(3) self.spinb.setRange(0.001, 3600.) self.spinb.setSuffix(" s") self.spinb.setValue(self.step) # set the initial width self.spinb.valueChanged.connect(self.xwidth_changed) parent.addWidget(self.spinb)
Example #11
Source File: timetrace_scroll_demo.py From FRETBursts with GNU General Public License v2.0 | 5 votes |
def set_spinbox(self, parent): self.spinb = QtGui.QDoubleSpinBox(parent=parent) self.spinb.setDecimals(3) self.spinb.setRange(0.001, 3600.) self.spinb.setSuffix(" s") self.spinb.setValue(self.width) # set the initial width self.spinb.valueChanged.connect(self.xwidth_changed) parent.addWidget(self.spinb)
Example #12
Source File: matplotlib_figure_mod_toolbar.py From FRETBursts with GNU General Public License v2.0 | 5 votes |
def __init__(self,fig): self.fig = fig toolbar = fig.canvas.toolbar self.line_edit = QtGui.QLineEdit() toolbar.addWidget(self.line_edit) self.line_edit.editingFinished.connect(self.do_something) self.spinbox = QtGui.QDoubleSpinBox() toolbar.addWidget(self.spinbox) self.spinbox.valueChanged.connect(self.do_something2)
Example #13
Source File: options.py From dpa-pipe with MIT License | 5 votes |
def __init__(self, name, config, parent=None): ActionOptionNumeric.__init__(self, name, config) QtGui.QDoubleSpinBox.__init__(self, parent=parent) self.setMaximum(float(self.max)) self.setMinimum(float(self.min)) self.setSingleStep(float(self.step)) self.setToolTip(self.tooltip) self.setValue(float(self.default)) self.valueChanged.connect(lambda v: self.value_changed.emit()) # -------------------------------------------------------------------------
Example #14
Source File: scroll_gui.py From FRETBursts with GNU General Public License v2.0 | 4 votes |
def __init__(self, fig, plot_fun, *args, **kwargs): if 'bins' not in kwargs: kwargs.update(bins=np.r_[:10:0.02]) if 't_max' not in kwargs: kwargs.update(t_max=-1) # Save some variables self.fig = fig self.AX = kwargs['AX'] self.plot_fun = plot_fun self.f_args = args self.f_kwargs = kwargs self.time_max = args[0].time_max() # Some handy shortcut self.draw = self.fig.canvas.draw # Create the spinboxes for setting the range mlabel = QtGui.QLabel() mlabel.setText("m:") self.m_spinbox = QtGui.QSpinBox() self.m_spinbox.setRange(2,500) self.m_spinbox.setKeyboardTracking(False) self.m_spinbox.setValue(self.f_kwargs['m']) self.m_spinbox.valueChanged.connect(self.par_changed) blabel = QtGui.QLabel() blabel.setText("bin:") self.bin_spinbox = QtGui.QDoubleSpinBox() self.bin_spinbox.setRange(1e-6,1e6) self.bin_spinbox.setDecimals(3) self.bin_spinbox.setKeyboardTracking(False) bins = self.f_kwargs['bins'] self.bin_spinbox.setValue(bins[1]-bins[0]) self.bin_spinbox.valueChanged.connect(self.par_changed) tlabel = QtGui.QLabel() tlabel.setText("t max (s):") self.tmax_spinbox = QtGui.QDoubleSpinBox() self.tmax_spinbox.setRange(0,3600) self.tmax_spinbox.setKeyboardTracking(False) if kwargs['t_max'] <= 0 or kwargs['t_max'] > self.time_max: kwargs['t_max'] = self.time_max self.tmax_spinbox.setValue(kwargs['t_max']) self.tmax_spinbox.valueChanged.connect(self.par_changed) addWidget = fig.canvas.toolbar.addWidget addWidget(mlabel); addWidget(self.m_spinbox) addWidget(blabel); addWidget(self.bin_spinbox) addWidget(tlabel); addWidget(self.tmax_spinbox) self.draw() self.save_params()
Example #15
Source File: VariablesLib.py From FreeCAD_Assembly4 with GNU Lesser General Public License v2.1 | 4 votes |
def drawUI(self): # Our main window will be a QDialog # make this dialog stay above the others, always visible self.UI.setWindowFlags( QtCore.Qt.WindowStaysOnTopHint ) self.UI.setWindowTitle('Add Variable') self.UI.setWindowIcon( QtGui.QIcon( os.path.join( Asm4.iconPath , 'FreeCad.svg' ) ) ) self.UI.setMinimumWidth(470) self.UI.resize(470,300) self.UI.setModal(False) # the layout for the main window is vertical (top to down) self.mainLayout = QtGui.QVBoxLayout(self.UI) # Define the fields for the form ( label + widget ) self.formLayout = QtGui.QFormLayout() # Variable Type, combobox showing all available App::PropertyType self.typeList = QtGui.QComboBox() self.formLayout.addRow(QtGui.QLabel('Type'),self.typeList) # Variable Name self.varName = QtGui.QLineEdit() self.formLayout.addRow(QtGui.QLabel('Name'),self.varName) # Variable Value self.varValue = QtGui.QDoubleSpinBox() self.varValue.setRange( -1000000.0, 1000000.0 ) self.formLayout.addRow(QtGui.QLabel('Value'),self.varValue) # Documentation self.description = QtGui.QTextEdit() self.formLayout.addRow(QtGui.QLabel('Description'),self.description) # apply the layout self.mainLayout.addLayout(self.formLayout) self.mainLayout.addStretch() # Buttons self.buttonLayout = QtGui.QHBoxLayout() # Cancel button self.CancelButton = QtGui.QPushButton('Cancel') # OK button self.OkButton = QtGui.QPushButton('OK') self.OkButton.setDefault(True) # the button layout self.buttonLayout.addWidget(self.CancelButton) self.buttonLayout.addStretch() self.buttonLayout.addWidget(self.OkButton) self.mainLayout.addLayout(self.buttonLayout) # finally, apply the layout to the main window self.UI.setLayout(self.mainLayout) # Actions self.CancelButton.clicked.connect(self.onCancel) self.OkButton.clicked.connect(self.onOK)
Example #16
Source File: UDSTab.py From CANalyzat0r with GNU General Public License v3.0 | 4 votes |
def __init__(self, tabWidget): AbstractTab.__init__( self, tabWidget, Strings.UDSTabLoggerName, [2, 3, 4], Strings.UDSTabPacketViewName, Strings.UDSTabLabelInterfaceValueName, allowTablePaste=False) self.active = False #: Sending takes place in a loop in a separate thread self.UDSSenderThread = None #: Adding items also takes place in a separate thread to avoid blocking the GUI thread self.itemAdderThread = None #: These values will be available in the fuzzing mode ComboBox self.UDSModeComboBoxValuePairs = [("Read Data By ID", 0), ("Routine Control", 1)] # Get all GUI elements self.comboBoxUDSMode = self.tabWidget.findChild( QtGui.QComboBox, "comboBoxUDSMode") self.lineEditUDSTabUDSID = self.tabWidget.findChild( QtGui.QLineEdit, "lineEditUDSTabUDSID") self.doubleSpinBoxUDSPacketGap = self.tabWidget.findChild( QtGui.QDoubleSpinBox, "doubleSpinBoxUDSPacketGap") self.buttonUDSInterfaceSettings = self.tabWidget.findChild( QtGui.QPushButton, "buttonUDSInterfaceSettings") self.buttonUDSTabToggleFuzzing = self.tabWidget.findChild( QtGui.QPushButton, "buttonUDSTabToggleFuzzing") self.buttonUDSClear = self.tabWidget.findChild(QtGui.QPushButton, "buttonUDSClear") self.labelUDSCountValue = self.tabWidget.findChild( QtGui.QLabel, "labelUDSCountValue") assert all(GUIElem is not None for GUIElem in [ self.comboBoxUDSMode, self.doubleSpinBoxUDSPacketGap, self. buttonUDSInterfaceSettings, self.buttonUDSTabToggleFuzzing, self. buttonUDSClear, self.labelUDSCountValue ]), "GUI Elements not found" self.buttonUDSInterfaceSettings.clicked.connect( self.handleInterfaceSettingsDialog) self.buttonUDSClear.clicked.connect(self.clear) self.comboBoxUDSMode.currentIndexChanged.connect(self.UDSModeChanged) self.buttonUDSTabToggleFuzzing.clicked.connect(self.toggleUDSFuzzing) self.prepareUI()
Example #17
Source File: toleranceDialog.py From FreeCAD_drawing_dimensioning with GNU Lesser General Public License v2.1 | 4 votes |
def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.setWindowModality(QtCore.Qt.ApplicationModal) Dialog.resize(209, 149) self.gridLayout_2 = QtGui.QGridLayout(Dialog) self.gridLayout_2.setObjectName("gridLayout_2") self.placeButton = QtGui.QPushButton(Dialog) self.placeButton.setObjectName("placeButton") self.gridLayout_2.addWidget(self.placeButton, 2, 0, 1, 1) self.gridLayout = QtGui.QGridLayout() self.gridLayout.setSizeConstraint(QtGui.QLayout.SetMaximumSize) self.gridLayout.setObjectName("gridLayout") self.label = QtGui.QLabel(Dialog) self.label.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 0, 0, 1, 1) self.label_2 = QtGui.QLabel(Dialog) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth()) self.label_2.setSizePolicy(sizePolicy) self.label_2.setMinimumSize(QtCore.QSize(61, 0)) self.label_2.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1) self.upperLineEdit = QtGui.QLineEdit(Dialog) self.upperLineEdit.setObjectName("upperLineEdit") self.gridLayout.addWidget(self.upperLineEdit, 0, 1, 1, 1) self.lowerLineEdit = QtGui.QLineEdit(Dialog) self.lowerLineEdit.setObjectName("lowerLineEdit") self.gridLayout.addWidget(self.lowerLineEdit, 1, 1, 1, 1) self.label_3 = QtGui.QLabel(Dialog) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 2, 0, 1, 1) self.scaleDoubleSpinBox = QtGui.QDoubleSpinBox(Dialog) self.scaleDoubleSpinBox.setMinimum(0.05) self.scaleDoubleSpinBox.setSingleStep(0.05) self.scaleDoubleSpinBox.setProperty("value", 0.8) self.scaleDoubleSpinBox.setObjectName("scaleDoubleSpinBox") self.gridLayout.addWidget(self.scaleDoubleSpinBox, 2, 1, 1, 1) self.gridLayout_2.addLayout(self.gridLayout, 1, 0, 1, 1) self.retranslateUi(Dialog) QtCore.QObject.connect(self.placeButton, QtCore.SIGNAL("released()"), Dialog.accept) QtCore.QObject.connect(self.upperLineEdit, QtCore.SIGNAL("returnPressed()"), Dialog.accept) QtCore.QObject.connect(self.lowerLineEdit, QtCore.SIGNAL("returnPressed()"), Dialog.accept) QtCore.QMetaObject.connectSlotsByName(Dialog)
Example #18
Source File: grid.py From FreeCAD_drawing_dimensioning with GNU Lesser General Public License v2.1 | 4 votes |
def generateWidget(self, dimensioningProcess): self.dimensioningProcess = dimensioningProcess groupbox = QtGui.QGroupBox("Grid Options") groupbox.setCheckable( True ) groupbox.toggled.connect( self.groupBoxToggled ) self.groupbox = groupbox checked = self.dd_parms.GetBool("show_grid_options",True) groupbox.setChecked(checked) vbox = QtGui.QVBoxLayout() gridOn_checkbox = QtGui.QCheckBox('grid on') gridOn_checkbox.setChecked( self.dd_parms.GetBool( 'grid_on', False )) gridOn_checkbox.stateChanged.connect( self.gridOn_checkbox_stateChanged ) vbox.addWidget( gridOn_checkbox ) self.gridOn_checkbox = gridOn_checkbox spacingSpinbox = QtGui.QDoubleSpinBox() spacingSpinbox.setValue( self.dd_parms.GetFloat( 'grid_spacing', default_grid_spacing ) ) spacingSpinbox.setMinimum( 0.01 ) spacingSpinbox.setDecimals( 2 ) spacingSpinbox.setSingleStep( 0.5 ) spacingSpinbox.setSuffix('mm') spacingSpinbox.valueChanged.connect( self.spacingSpinbox_valueChanged ) vbox.addLayout( DimensioningTaskDialog_generate_row_hbox('spacing', spacingSpinbox) ) self.spacingSpinbox = spacingSpinbox displayPeriodSpinbox = QtGui.QSpinBox() displayPeriodSpinbox.setValue( min( self.dd_parms.GetInt( 'grid_display_period', default_grid_display_period ), 200) ) displayPeriodSpinbox.setMinimum( 0 ) displayPeriodSpinbox.valueChanged.connect( self.displayPeriodSpinbox_valueChanged ) vbox.addLayout( DimensioningTaskDialog_generate_row_hbox('display period', displayPeriodSpinbox) ) self.displayPeriodSpinbox = displayPeriodSpinbox clr = QtGui.QColor(*unsignedToRGB(self.dd_parms.GetUnsigned( 'grid_color', default_grid_clr )) ) graphicsScene = QtGui.QGraphicsScene(0,0,30,30) pen = QtGui.QPen( QtGui.QColor(0,0,0,0) ) pen.setWidth(0.0) rect = ClickRect(-100, -100, 200, 200) rect.setPen(pen) rect.clickFun = self.specifyNewGridColor graphicsScene.addItem(rect) self.graphicsScene = graphicsScene #protect from garbage collector self.colorRect = rect self.colorRect.setBrush( QtGui.QBrush( clr ) ) colorBox = QtGui.QGraphicsView( self.graphicsScene ) colorBox.setMaximumWidth( 60 ) colorBox.setMaximumHeight( 30 ) colorBox.setHorizontalScrollBarPolicy( QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff ) colorBox.setVerticalScrollBarPolicy( QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOff ) vbox.addLayout( DimensioningTaskDialog_generate_row_hbox( 'color', colorBox ) ) lineWidthSpinbox = QtGui.QDoubleSpinBox() lineWidthSpinbox.setValue( self.dd_parms.GetFloat( 'grid_line_width', default_grid_line_width ) ) lineWidthSpinbox.setMinimum( 0. ) lineWidthSpinbox.setDecimals( 2 ) lineWidthSpinbox.setSingleStep( 0.05 ) lineWidthSpinbox.valueChanged.connect( self.lineWidthSpinbox_valueChanged ) vbox.addLayout( DimensioningTaskDialog_generate_row_hbox('lineWidth', lineWidthSpinbox) ) self.lineWidthSpinbox = lineWidthSpinbox groupbox.setLayout(vbox) return groupbox