Python PyQt4.QtGui.QSpinBox() Examples

The following are 20 code examples of PyQt4.QtGui.QSpinBox(). 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 PyQt4.QtGui , or try the search function .
Example #1
Source File: ScatterPlotSpeedTestTemplate_pyqt.py    From qgisSpaceSyntaxToolkit with GNU General Public License v3.0 6 votes vote down vote up
def setupUi(self, Form):
        Form.setObjectName(_fromUtf8("Form"))
        Form.resize(400, 300)
        self.gridLayout = QtGui.QGridLayout(Form)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.sizeSpin = QtGui.QSpinBox(Form)
        self.sizeSpin.setProperty("value", 10)
        self.sizeSpin.setObjectName(_fromUtf8("sizeSpin"))
        self.gridLayout.addWidget(self.sizeSpin, 1, 1, 1, 1)
        self.pixelModeCheck = QtGui.QCheckBox(Form)
        self.pixelModeCheck.setObjectName(_fromUtf8("pixelModeCheck"))
        self.gridLayout.addWidget(self.pixelModeCheck, 1, 3, 1, 1)
        self.label = QtGui.QLabel(Form)
        self.label.setObjectName(_fromUtf8("label"))
        self.gridLayout.addWidget(self.label, 1, 0, 1, 1)
        self.plot = PlotWidget(Form)
        self.plot.setObjectName(_fromUtf8("plot"))
        self.gridLayout.addWidget(self.plot, 0, 0, 1, 4)
        self.randCheck = QtGui.QCheckBox(Form)
        self.randCheck.setObjectName(_fromUtf8("randCheck"))
        self.gridLayout.addWidget(self.randCheck, 1, 2, 1, 1)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form) 
Example #2
Source File: settingDialog.py    From LabelImgTool with MIT License 6 votes vote down vote up
def createDEToptGroup(self):
        self.detgroupBox = QtGui.QGroupBox("& DET options")
        self.enable_show_label_cb = QtGui.QCheckBox('enable show label name')


        self.label_font_size_sl = QtGui.QSlider(QtCore.Qt.Horizontal)
        self.label_font_size_sl.setRange(5,50)
        self.label_font_size_sp = QtGui.QSpinBox()
        self.label_font_size_sp.setRange(5,50)
        QtCore.QObject.connect(self.label_font_size_sl, QtCore.SIGNAL("valueChanged(int)"),

                               self.label_font_size_sp, QtCore.SLOT("setValue(int)"))
        self.label_font_size_sl.valueChanged.connect(self.change_label_font_size)
        self.label_font_size_sl.setValue(self.__class__.label_font_size)
        vbox = QtGui.QVBoxLayout()
        vbox.addWidget(self.enable_show_label_cb)
        vbox.addWidget(QtGui.QLabel('label font size'))
        vbox.addWidget(self.label_font_size_sl)
        vbox.addWidget(self.label_font_size_sp)
        vbox.addStretch()
        self.detgroupBox.setLayout(vbox)
        return self.detgroupBox 
Example #3
Source File: dataeditor.py    From ddt4all with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, dataitem, parent=None):
        super(otherPanel, self).__init__(parent)
        self.setFrameStyle(widgets.QFrame.Sunken)
        self.setFrameShape(widgets.QFrame.Box)
        self.data = dataitem

        layout = widgets.QGridLayout()
        labelnob = widgets.QLabel(_("Number of bytes"))
        lableunit = widgets.QLabel(_("Unit"))

        layout.addWidget(labelnob, 0, 0)
        layout.addWidget(lableunit, 1, 0)
        layout.setRowStretch(2, 1)

        self.inputnob = widgets.QSpinBox()
        self.inputnob.setRange(1, 10240)
        self.inputtype = widgets.QComboBox()
        self.inputtype.addItem("ASCII")
        self.inputtype.addItem("BCD/HEX")

        layout.addWidget(self.inputnob, 0, 1)
        layout.addWidget(self.inputtype, 1, 1)

        self.setLayout(layout)
        self.init() 
Example #4
Source File: ScatterPlotSpeedTestTemplate_pyqt.py    From tf-pose with Apache License 2.0 5 votes vote down vote up
def setupUi(self, Form):
        Form.setObjectName(_fromUtf8("Form"))
        Form.resize(400, 300)
        self.gridLayout = QtGui.QGridLayout(Form)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.sizeSpin = QtGui.QSpinBox(Form)
        self.sizeSpin.setProperty("value", 10)
        self.sizeSpin.setObjectName(_fromUtf8("sizeSpin"))
        self.gridLayout.addWidget(self.sizeSpin, 1, 1, 1, 1)
        self.pixelModeCheck = QtGui.QCheckBox(Form)
        self.pixelModeCheck.setObjectName(_fromUtf8("pixelModeCheck"))
        self.gridLayout.addWidget(self.pixelModeCheck, 1, 3, 1, 1)
        self.label = QtGui.QLabel(Form)
        self.label.setObjectName(_fromUtf8("label"))
        self.gridLayout.addWidget(self.label, 1, 0, 1, 1)
        self.plot = PlotWidget(Form)
        self.plot.setObjectName(_fromUtf8("plot"))
        self.gridLayout.addWidget(self.plot, 0, 0, 1, 4)
        self.randCheck = QtGui.QCheckBox(Form)
        self.randCheck.setObjectName(_fromUtf8("randCheck"))
        self.gridLayout.addWidget(self.randCheck, 1, 2, 1, 1)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form) 
Example #5
Source File: main_gui.py    From pySecMaster with GNU Affero General Public License v3.0 5 votes vote down vote up
def save_settings(self, ini_name):
        """
        Technique structured from the code from: "https://stackoverflow.com
        /questions/23279125/python-pyqt4-functions-to-save-and-restore-ui-
        widget-values"

        :param ini_name: Name of the .ini file (Ex. pysecmaster.ini)
        :return:
        """

        settings = QtCore.QSettings(ini_name, QtCore.QSettings.IniFormat)

        # For child in ui.children():  # works like getmembers, but because it
        # traverses the hierarchy, you would have to call the method recursively
        # to traverse down the tree.

        for name, obj in inspect.getmembers(self):
            if isinstance(obj, QtGui.QComboBox):
                name = obj.objectName()
                text = obj.currentText()
                settings.setValue(name, text)

            elif isinstance(obj, QtGui.QLineEdit):
                name = obj.objectName()
                value = obj.text()
                settings.setValue(name, value)

            elif isinstance(obj, QtGui.QSpinBox):
                name = obj.objectName()
                value = obj.value()
                settings.setValue(name, value)

            elif isinstance(obj, QtGui.QCheckBox):
                name = obj.objectName()
                state = obj.checkState()
                settings.setValue(name, state) 
Example #6
Source File: plot_view.py    From qkit with GNU General Public License v2.0 5 votes vote down vote up
def _addTraceSelectorIndicator(self,Form,sizePolicy,TraceSelector = "", TraceIndicator="", prefix = "Trace: "):
        self.TraceSelIndLayout = QtGui.QVBoxLayout()
        self.TraceSelIndLayout.setSizeConstraint(QtGui.QLayout.SetMinimumSize)
        self.TraceSelIndLayout.setObjectName(_fromUtf8("TraceSelIndLayout"))

        self.TraceSelIndLayout.setContentsMargins(0,0,0,0)
        self.TraceSelIndLayout.setContentsMargins(QtCore.QMargins(0,0,0,0))
        self.TraceSelIndLayout.setSpacing(1)


        setattr(self,TraceSelector,QtGui.QSpinBox(Form))
        temp_SelInd = getattr(self,TraceSelector)
        temp_SelInd.setSizePolicy(sizePolicy)
        temp_SelInd.setSuffix(_fromUtf8(""))
        temp_SelInd.setMinimum(-99999)
        temp_SelInd.setMaximum(99999)
        temp_SelInd.setProperty("value", -1)
        temp_SelInd.setObjectName(_fromUtf8(TraceSelector))
        temp_SelInd.setPrefix(_translate("Form", prefix , None))

        
        self.TraceSelIndLayout.addWidget(temp_SelInd)
            
        setattr(self,TraceIndicator,QtGui.QLineEdit(Form))
        temp_SelInd = getattr(self,TraceIndicator)
        temp_SelInd.setSizePolicy(sizePolicy)
        temp_SelInd.setReadOnly(False)
        temp_SelInd.setObjectName(_fromUtf8("TraceValue"))
        self.TraceSelIndLayout.addWidget(temp_SelInd)
        self.horizontalLayout.addLayout(self.TraceSelIndLayout,stretch = -10) 
Example #7
Source File: dataeditor.py    From ddt4all with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, iscan=True):
        widgets.QSpinBox.__init__(self)
        self.set_can(iscan) 
Example #8
Source File: dataeditor.py    From ddt4all with GNU General Public License v3.0 5 votes vote down vote up
def init(self):
        if not self.data:
            return

        self.itemtable.clear()

        keys = self.data.items.keys()
        self.itemtable.setRowCount(len(keys))

        self.inputsigned.setChecked(self.data.signed)
        self.inputnob.setValue(self.data.bitscount)

        count = 0
        for k, v in self.data.items.iteritems():
            spinvalue = widgets.QSpinBox()
            spinvalue.setRange(-1000000,1000000)
            spinvalue.setValue(int(v))
            self.itemtable.setCellWidget(count, 0, spinvalue)
            self.itemtable.setItem(count, 0, widgets.QTableWidgetItem(str(v).zfill(5)))
            self.itemtable.setItem(count, 1, widgets.QTableWidgetItem(k))
            count += 1

        headerstrings = str(_("Value;Text")).split(";")
        self.itemtable.setHorizontalHeaderLabels(headerstrings)
        self.itemtable.resizeColumnsToContents()
        self.itemtable.resizeRowsToContents()
        self.itemtable.sortItems(0, core.Qt.AscendingOrder)
        #self.itemtable.setSortingEnabled(True) 
Example #9
Source File: dataeditor.py    From ddt4all with GNU General Public License v3.0 5 votes vote down vote up
def add_item(self):
        value = -999
        self.itemtable.setRowCount(self.itemtable.rowCount() + 1)
        newrow = self.itemtable.rowCount() - 1
        spinvalue = widgets.QSpinBox()
        spinvalue.setRange(-1000000, 1000000)
        spinvalue.setValue(value)
        self.itemtable.setCellWidget(newrow, 0, spinvalue)
        self.itemtable.setItem(newrow, 1, widgets.QTableWidgetItem(_("New item")))
        self.itemtable.setItem(newrow, 0, widgets.QTableWidgetItem(str(value).zfill(5)))
        self.itemtable.resizeRowsToContents()
        self.itemtable.resizeColumnsToContents() 
Example #10
Source File: dataeditor.py    From ddt4all with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, dataitem, parent=None):
        super(numericListPanel, self).__init__(parent)
        self.setFrameStyle(widgets.QFrame.Sunken)
        self.setFrameShape(widgets.QFrame.Box)
        self.data = dataitem

        layoutv = widgets.QVBoxLayout()
        layout = widgets.QGridLayout()
        labelnob = widgets.QLabel(_("Number of bits"))
        lablelsigned = widgets.QLabel(_("Signed"))
        newitem = widgets.QPushButton(_("Add item"))
        delitem = widgets.QPushButton(_("Del item"))

        newitem.clicked.connect(self.add_item)
        delitem.clicked.connect(self.def_item)

        layout.addWidget(labelnob, 0, 0)
        layout.addWidget(lablelsigned, 1, 0)
        layout.addWidget(newitem, 2, 0)
        layout.addWidget(delitem, 2, 1)

        self.inputnob = widgets.QSpinBox()
        self.inputnob.setRange(1, 32)
        self.inputsigned = widgets.QCheckBox()

        layout.addWidget(self.inputnob, 0, 1)
        layout.addWidget(self.inputsigned, 1, 1)

        layoutv.addLayout(layout)

        self.itemtable = widgets.QTableWidget()
        self.itemtable.setRowCount(1)
        self.itemtable.setColumnCount(2)
        self.itemtable.verticalHeader().hide()
        self.itemtable.setSelectionBehavior(widgets.QAbstractItemView.SelectRows)
        self.itemtable.setSelectionMode(widgets.QAbstractItemView.SingleSelection)

        layoutv.addWidget(self.itemtable)

        self.setLayout(layoutv)
        self.init() 
Example #11
Source File: MainWindow.py    From PyEngine3D with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def createEditor(self, parent, option, index):
        editor = QtGui.QSpinBox(parent)
        editor.setMinimum(0)
        editor.setMaximum(100)

        return editor 
Example #12
Source File: dataeditor.py    From ddt4all with GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, dataitem, parent=None):
        super(numericPanel, self).__init__(parent)
        self.setFrameStyle(widgets.QFrame.Sunken)
        self.setFrameShape(widgets.QFrame.Box)
        self.data = dataitem

        layout = widgets.QGridLayout()
        labelnob = widgets.QLabel(_("Number of bit"))
        lableunit = widgets.QLabel(_("Unit"))
        labelsigned = widgets.QLabel(_("Signed"))
        labelformat = widgets.QLabel(_("Format"))
        labeldoc = widgets.QLabel(_("Value = (AX+B) / C"))
        labela = widgets.QLabel("A")
        labelb = widgets.QLabel("B")
        labelc = widgets.QLabel("C")

        layout.addWidget(labelnob, 0, 0)
        layout.addWidget(lableunit, 1, 0)
        layout.addWidget(labelsigned, 2, 0)
        layout.addWidget(labelformat, 3, 0)
        layout.addWidget(labeldoc, 4, 0)
        layout.addWidget(labela, 5, 0)
        layout.addWidget(labelb, 6, 0)
        layout.addWidget(labelc, 7, 0)
        layout.setRowStretch(8, 1)

        self.inputnob = widgets.QSpinBox()
        self.inputnob.setRange(1, 32)
        self.inputunit = widgets.QLineEdit()
        self.inputsigned = widgets.QCheckBox()
        self.inputformat = widgets.QLineEdit()
        self.inputa = widgets.QDoubleSpinBox()
        self.inputb = widgets.QDoubleSpinBox()
        self.inputc = widgets.QDoubleSpinBox()
        self.inputc.setRange(-1000000, 1000000)
        self.inputb.setRange(-1000000, 1000000)
        self.inputa.setRange(-1000000, 1000000)
        self.inputa.setDecimals(4)
        self.inputb.setDecimals(4)
        self.inputc.setDecimals(4)

        layout.addWidget(self.inputnob, 0, 1)
        layout.addWidget(self.inputunit, 1, 1)
        layout.addWidget(self.inputsigned, 2, 1)
        layout.addWidget(self.inputformat, 3, 1)
        layout.addWidget(self.inputa, 5, 1)
        layout.addWidget(self.inputb, 6, 1)
        layout.addWidget(self.inputc, 7, 1)

        self.setLayout(layout)

        self.init() 
Example #13
Source File: scroll_gui.py    From FRETBursts with GNU General Public License v2.0 4 votes vote down vote up
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 #14
Source File: main.py    From openairplay with MIT License 4 votes vote down vote up
def createMessageGroupBox(self): # Add the message test GUI window grouping.
        self.messageGroupBox = QtGui.QGroupBox("Balloon Message Test:")

        typeLabel = QtGui.QLabel("Type:")

        self.typeComboBox = QtGui.QComboBox()
        self.typeComboBox.addItem("None", QtGui.QSystemTrayIcon.NoIcon)
        self.typeComboBox.addItem(self.style().standardIcon(
                QtGui.QStyle.SP_MessageBoxInformation), "Information", QtGui.QSystemTrayIcon.Information)
        self.typeComboBox.addItem(self.style().standardIcon(
                QtGui.QStyle.SP_MessageBoxWarning), "Warning", QtGui.QSystemTrayIcon.Warning)
        self.typeComboBox.addItem(self.style().standardIcon(
                QtGui.QStyle.SP_MessageBoxCritical), "Critical", QtGui.QSystemTrayIcon.Critical)
        self.typeComboBox.setCurrentIndex(1)

        self.durationLabel = QtGui.QLabel("Duration:")

        self.durationSpinBox = QtGui.QSpinBox()
        self.durationSpinBox.setRange(2, 15)
        self.durationSpinBox.setSuffix("s")
        self.durationSpinBox.setValue(5)

        durationWarningLabel = QtGui.QLabel("(some systems might ignore this hint)")
        durationWarningLabel.setIndent(10)

        titleLabel = QtGui.QLabel("Title:")

        self.titleEdit = QtGui.QLineEdit("Cannot connect to network")

        bodyLabel = QtGui.QLabel("Body:")

        self.bodyEdit = QtGui.QTextEdit()
        self.bodyEdit.setPlainText("Don't believe me. Honestly, I don't have a clue.")

        self.showMessageButton = QtGui.QPushButton("Show Message")
        self.showMessageButton.setDefault(True)

        messageLayout = QtGui.QGridLayout()
        messageLayout.addWidget(typeLabel, 0, 0)
        messageLayout.addWidget(self.typeComboBox, 0, 1, 1, 2)
        messageLayout.addWidget(self.durationLabel, 1, 0)
        messageLayout.addWidget(self.durationSpinBox, 1, 1)
        messageLayout.addWidget(durationWarningLabel, 1, 2, 1, 3)
        messageLayout.addWidget(titleLabel, 2, 0)
        messageLayout.addWidget(self.titleEdit, 2, 1, 1, 4)
        messageLayout.addWidget(bodyLabel, 3, 0)
        messageLayout.addWidget(self.bodyEdit, 3, 1, 2, 4)
        messageLayout.addWidget(self.showMessageButton, 5, 4)
        messageLayout.setColumnStretch(3, 1)
        messageLayout.setRowStretch(4, 1)
        self.messageGroupBox.setLayout(messageLayout) 
Example #15
Source File: infoDialogUI.py    From tutorials with MIT License 4 votes vote down vote up
def setupUi(self, InfoDialog):
        InfoDialog.setObjectName(_fromUtf8("InfoDialog"))
        InfoDialog.resize(281, 225)
        self.verticalLayout = QtGui.QVBoxLayout(InfoDialog)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.formLayout = QtGui.QFormLayout()
        self.formLayout.setObjectName(_fromUtf8("formLayout"))
        self.label = QtGui.QLabel(InfoDialog)
        self.label.setObjectName(_fromUtf8("label"))
        self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.label)
        self.firstName = QtGui.QLineEdit(InfoDialog)
        self.firstName.setObjectName(_fromUtf8("firstName"))
        self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.firstName)
        self.label_2 = QtGui.QLabel(InfoDialog)
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.label_2)
        self.lastName = QtGui.QLineEdit(InfoDialog)
        self.lastName.setObjectName(_fromUtf8("lastName"))
        self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.lastName)
        self.label_3 = QtGui.QLabel(InfoDialog)
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.label_3)
        self.email = QtGui.QLineEdit(InfoDialog)
        self.email.setObjectName(_fromUtf8("email"))
        self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.email)
        self.label_4 = QtGui.QLabel(InfoDialog)
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.label_4)
        self.age = QtGui.QSpinBox(InfoDialog)
        self.age.setMinimum(1)
        self.age.setObjectName(_fromUtf8("age"))
        self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.age)
        self.verticalLayout.addLayout(self.formLayout)
        self.buttonBox = QtGui.QDialogButtonBox(InfoDialog)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
        self.verticalLayout.addWidget(self.buttonBox)

        self.retranslateUi(InfoDialog)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), InfoDialog.accept)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), InfoDialog.reject)
        QtCore.QMetaObject.connectSlotsByName(InfoDialog) 
Example #16
Source File: ui_double_property.py    From stdm with GNU General Public License v2.0 4 votes vote down vote up
def setupUi(self, DoubleProperty):
        DoubleProperty.setObjectName(_fromUtf8("DoubleProperty"))
        DoubleProperty.resize(258, 166)
        self.gridLayout = QtGui.QGridLayout(DoubleProperty)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.label_3 = QtGui.QLabel(DoubleProperty)
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self.gridLayout.addWidget(self.label_3, 0, 0, 1, 1)
        self.sbPrecision = QtGui.QSpinBox(DoubleProperty)
        self.sbPrecision.setMinimum(1)
        self.sbPrecision.setMaximum(50)
        self.sbPrecision.setProperty("value", 1)
        self.sbPrecision.setObjectName(_fromUtf8("sbPrecision"))
        self.gridLayout.addWidget(self.sbPrecision, 0, 1, 1, 1)
        self.label_4 = QtGui.QLabel(DoubleProperty)
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.gridLayout.addWidget(self.label_4, 1, 0, 1, 1)
        self.sbScale = QtGui.QSpinBox(DoubleProperty)
        self.sbScale.setMaximum(20)
        self.sbScale.setObjectName(_fromUtf8("sbScale"))
        self.gridLayout.addWidget(self.sbScale, 1, 1, 1, 1)
        self.label = QtGui.QLabel(DoubleProperty)
        self.label.setObjectName(_fromUtf8("label"))
        self.gridLayout.addWidget(self.label, 2, 0, 1, 1)
        self.edtMinVal = QtGui.QLineEdit(DoubleProperty)
        self.edtMinVal.setObjectName(_fromUtf8("edtMinVal"))
        self.gridLayout.addWidget(self.edtMinVal, 2, 1, 1, 1)
        self.label_2 = QtGui.QLabel(DoubleProperty)
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.gridLayout.addWidget(self.label_2, 3, 0, 1, 1)
        self.edtMaxVal = QtGui.QLineEdit(DoubleProperty)
        self.edtMaxVal.setObjectName(_fromUtf8("edtMaxVal"))
        self.gridLayout.addWidget(self.edtMaxVal, 3, 1, 1, 1)
        self.buttonBox = QtGui.QDialogButtonBox(DoubleProperty)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
        self.gridLayout.addWidget(self.buttonBox, 4, 0, 1, 2)

        self.retranslateUi(DoubleProperty)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), DoubleProperty.accept)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), DoubleProperty.reject)
        QtCore.QMetaObject.connectSlotsByName(DoubleProperty) 
Example #17
Source File: table.py    From Writer-Tutorial with MIT License 4 votes vote down vote up
def initUI(self):

        # Rows
        rowsLabel = QtGui.QLabel("Rows: ",self)
        
        self.rows = QtGui.QSpinBox(self)

        # Columns
        colsLabel = QtGui.QLabel("Columns",self)
        
        self.cols = QtGui.QSpinBox(self)

        # Cell spacing (distance between cells)
        spaceLabel = QtGui.QLabel("Cell spacing",self)
        
        self.space = QtGui.QSpinBox(self)

        # Cell padding (distance between cell and inner text)
        padLabel = QtGui.QLabel("Cell padding",self)

        self.pad = QtGui.QSpinBox(self)
        
        self.pad.setValue(10)

        # Button
        insertButton = QtGui.QPushButton("Insert",self)
        insertButton.clicked.connect(self.insert)

        # Layout
        layout = QtGui.QGridLayout()

        layout.addWidget(rowsLabel,0,0)
        layout.addWidget(self.rows,0,1)

        layout.addWidget(colsLabel,1,0)
        layout.addWidget(self.cols,1,1)

        layout.addWidget(padLabel,2,0)
        layout.addWidget(self.pad,2,1)
        
        layout.addWidget(spaceLabel,3,0)
        layout.addWidget(self.space,3,1)

        layout.addWidget(insertButton,4,0,1,2)

        self.setWindowTitle("Insert Table")
        self.setGeometry(300,300,200,100)
        self.setLayout(layout) 
Example #18
Source File: remoteDialog.py    From LabelImgTool with MIT License 4 votes vote down vote up
def __init__(self, parent=None):
        QtGui.QDialog.__init__(self, parent)
        self.resize(320, 100)
        self.setWindowTitle('set remote db')
        self.remote_cb = QtGui.QCheckBox("use remote database")
        if self.__class__.remote_mode:
            self.remote_cb.toggle()
        self.remote_cb.stateChanged.connect(self.set_remote_mode)
        grid = QtGui.QGridLayout()
        grid.addWidget(self.remote_cb, 0, 0, 1, 1)
        grid.addWidget(
            QtGui.QLabel(
                u'dowload image thread num',
                parent=self),
            1,
            0,
            1,
            1)
        self.thread_num = QtGui.QSpinBox()
        self.thread_num.setRange(1, 10)
        self.thread_num.setValue(self.__class__.dowload_thead_num)
        self.thread_num.valueChanged.connect(self.set_thread_num)
        grid.addWidget(self.thread_num, 1, 1, 1, 1)
        grid.addWidget(
            QtGui.QLabel(
                u'remote db url[123.57.438.245/]',
                parent=self),
            2,
            0,
            1,
            1)
        self.remote_url_line = QtGui.QLineEdit(parent=self)
        if self.__class__.remote_url:
            self.remote_url_line.setText(self.__class__.remote_url)
        grid.addWidget(self.remote_url_line, 2, 1, 1, 1)
        grid.addWidget(
            QtGui.QLabel(
                u'remote image list',
                parent=self),
            3,
            0,
            1,
            1)
        self.server_image_list = QtGui.QLineEdit(parent=self)
        if self.__class__.server_image_list:
            self.server_image_list.setText(self.__class__.server_image_list)
        grid.addWidget(self.server_image_list, 3, 1, 1, 1)
        buttonBox = QtGui.QDialogButtonBox(parent=self)
        buttonBox.setOrientation(QtCore.Qt.Horizontal)
        buttonBox.setStandardButtons(
            QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok)
        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)
        layout = QtGui.QVBoxLayout()
        layout.addLayout(grid)
        spacerItem = QtGui.QSpacerItem(
            20, 48, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        layout.addItem(spacerItem)
        layout.addWidget(buttonBox)
        self.setLayout(layout) 
Example #19
Source File: main_gui.py    From pySecMaster with GNU Affero General Public License v3.0 4 votes vote down vote up
def restore_settings(self, ini_name):
        """
        Technique structured from the code from: "https://stackoverflow.com
        /questions/23279125/python-pyqt4-functions-to-save-and-restore-ui-
        widget-values"

        :param ini_name: Name/path of the .ini file (Ex. pySecMaster_gui.ini)
        """

        settings = QtCore.QSettings(ini_name, QtCore.QSettings.IniFormat)

        for name, obj in inspect.getmembers(self):
            if isinstance(obj, QtGui.QComboBox):
                name = obj.objectName()
                value = str(settings.value(name))   # .toString())

                if value == "":
                    continue

                # Get the corresponding index for specified string in combobox
                index = obj.findText(value)
                # Check if the value exists, otherwise add it to the combobox
                if index == -1:
                    obj.insertItems(0, [value])
                    index = obj.findText(value)
                    obj.setCurrentIndex(index)
                else:
                    obj.setCurrentIndex(index)

            elif isinstance(obj, QtGui.QLineEdit):
                name = obj.objectName()
                value = str(settings.value(name))
                obj.setText(value)

            elif isinstance(obj, QtGui.QSpinBox):
                name = obj.objectName()
                value = int(settings.value(name))
                obj.setValue(value)

            elif isinstance(obj, QtGui.QCheckBox):
                name = obj.objectName()
                value = settings.value(name)
                if value:
                    obj.setChecked(value)   # setCheckState enables tristate 
Example #20
Source File: table.py    From Writer with MIT License 4 votes vote down vote up
def initUI(self):

        # Rows
        rowsLabel = QtGui.QLabel("Rows: ",self)
        
        self.rows = QtGui.QSpinBox(self)

        # Columns
        colsLabel = QtGui.QLabel("Columns",self)
        
        self.cols = QtGui.QSpinBox(self)

        # Cell spacing (distance between cells)
        spaceLabel = QtGui.QLabel("Cell spacing",self)
        
        self.space = QtGui.QSpinBox(self)

        # Cell padding (distance between cell and inner text)
        padLabel = QtGui.QLabel("Cell padding",self)

        self.pad = QtGui.QSpinBox(self)
        
        self.pad.setValue(10)

        # Button
        insertButton = QtGui.QPushButton("Insert",self)
        insertButton.clicked.connect(self.insert)

        # Layout
        layout = QtGui.QGridLayout()

        layout.addWidget(rowsLabel,0,0)
        layout.addWidget(self.rows,0,1)

        layout.addWidget(colsLabel,1,0)
        layout.addWidget(self.cols,1,1)

        layout.addWidget(padLabel,2,0)
        layout.addWidget(self.pad,2,1)
        
        layout.addWidget(spaceLabel,3,0)
        layout.addWidget(self.space,3,1)

        layout.addWidget(insertButton,4,0,1,2)

        self.setWindowTitle("Insert Table")
        self.setGeometry(300,300,200,100)
        self.setLayout(layout)