Python PyQt4.QtGui 模块,QSpinBox() 实例源码

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

项目:picasso    作者:jungmannlab    | 项目源码 | 文件源码
def __init__(self, window):
        super().__init__(window)
        self.window = window
        self.setWindowTitle('Parameters')
        self.setModal(False)
        grid = QtGui.QGridLayout(self)

        grid.addWidget(QtGui.QLabel('Oversampling:'), 0, 0)
        self.oversampling = QtGui.QDoubleSpinBox()
        self.oversampling.setRange(1, 200)
        self.oversampling.setValue(4)
        self.oversampling.setDecimals(1)
        self.oversampling.setKeyboardTracking(False)
        self.oversampling.valueChanged.connect(self.window.updateLayout)
        grid.addWidget(self.oversampling, 0, 1)

        self.iterations = QtGui.QSpinBox()
        self.iterations.setRange(1, 1)
        self.iterations.setValue(1)
项目:dxf2gcode    作者:cnc-club    | 项目源码 | 文件源码
def __init__(self, text, unit = None, minimum = None, maximum = None, parent = None):
        """
        Initialization of the CfgSpinBox class (used for int values).
        @param text: text string associated with the SpinBox
        @param minimum: min value (int)
        @param minimum: max value (int)
        """
        QWidget.__init__(self, parent)

        self.spinbox = QSpinBox(parent)
        if unit is not None:
            self.setUnit(unit)

        self.setSpec({'minimum': minimum, 'maximum': maximum, 'comment': ''})

        self.label = QLabel(text, parent)
        self.layout = QHBoxLayout(parent);

        self.spinbox.setMinimumWidth(200) #Provide better alignment with other items
        self.layout.addWidget(self.label)
        self.layout.addStretch()
        self.layout.addWidget(self.spinbox)
        self.setLayout(self.layout)
项目:ProStep    作者:Gaultus    | 项目源码 | 文件源码
def setupUi(self, Dialog):
        Dialog.setObjectName(_fromUtf8("Dialog"))
        Dialog.resize(400, 113)
        self.buttonBox = QtGui.QDialogButtonBox(Dialog)
        self.buttonBox.setGeometry(QtCore.QRect(40, 60, 341, 32))
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
        self.label = QtGui.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(10, 30, 71, 16))
        self.label.setObjectName(_fromUtf8("label"))
        self.textEdit = QtGui.QTextEdit(Dialog)
        self.textEdit.setGeometry(QtCore.QRect(90, 30, 291, 21))
        self.textEdit.setObjectName(_fromUtf8("textEdit"))
        self.sbRepeats = QtGui.QSpinBox(Dialog)
        self.sbRepeats.setGeometry(QtCore.QRect(90, 60, 50, 21))
        self.sbRepeats.setObjectName(_fromUtf8("textEdit"))
        self.sbRepeats.setMinimum(1)
        self.sbRepeats.setMaximum(99)

        self.retranslateUi(Dialog)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), self.Accept)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), self.Reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
        self.dlg = Dialog
项目:ProStep    作者:Gaultus    | 项目源码 | 文件源码
def setupUi(self, Dialog):
        self.dlg = Dialog
        Dialog.setObjectName(_fromUtf8("Dialog"))
        Dialog.resize(385, 114)
        self.buttonBox = QtGui.QDialogButtonBox(Dialog)
        self.buttonBox.setGeometry(QtCore.QRect(10, 50, 341, 32))
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
        self.label = QtGui.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(20, 20, 71, 16))
        self.label.setObjectName(_fromUtf8("label"))
        self.spinBox = QtGui.QSpinBox(Dialog)
        self.spinBox.setGeometry(QtCore.QRect(100, 20, 42, 22))
        self.spinBox.setObjectName(_fromUtf8("spinBox"))
        self.spinBox.setMinimum(-80)
        self.spinBox.setMaximum(80)

        self.retranslateUi(Dialog)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), self.accept)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), self.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
项目:ProStep    作者:Gaultus    | 项目源码 | 文件源码
def setupUi(self, Dialog):
        Dialog.setObjectName(_fromUtf8("Dialog"))
        Dialog.resize(400, 113)
        self.buttonBox = QtGui.QDialogButtonBox(Dialog)
        self.buttonBox.setGeometry(QtCore.QRect(40, 60, 341, 32))
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
        self.label = QtGui.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(10, 30, 71, 16))
        self.label.setObjectName(_fromUtf8("label"))
        self.textEdit = QtGui.QTextEdit(Dialog)
        self.textEdit.setGeometry(QtCore.QRect(90, 30, 291, 21))
        self.textEdit.setObjectName(_fromUtf8("textEdit"))
        self.sbRepeats = QtGui.QSpinBox(Dialog)
        self.sbRepeats.setGeometry(QtCore.QRect(90, 60, 50, 21))
        self.sbRepeats.setObjectName(_fromUtf8("textEdit"))
        self.sbRepeats.setMinimum(1)
        self.sbRepeats.setMaximum(99)

        self.retranslateUi(Dialog)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), self.Accept)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), self.Reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
        self.dlg = Dialog
项目:ProStep    作者:Gaultus    | 项目源码 | 文件源码
def setupUi(self, Dialog):
        self.dlg = Dialog
        Dialog.setObjectName(_fromUtf8("Dialog"))
        Dialog.resize(385, 114)
        self.buttonBox = QtGui.QDialogButtonBox(Dialog)
        self.buttonBox.setGeometry(QtCore.QRect(10, 50, 341, 32))
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
        self.label = QtGui.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(20, 20, 71, 16))
        self.label.setObjectName(_fromUtf8("label"))
        self.spinBox = QtGui.QSpinBox(Dialog)
        self.spinBox.setGeometry(QtCore.QRect(100, 20, 42, 22))
        self.spinBox.setObjectName(_fromUtf8("spinBox"))
        self.spinBox.setMinimum(-80)
        self.spinBox.setMaximum(80)

        self.retranslateUi(Dialog)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), self.accept)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), self.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
项目:ProStep    作者:Gaultus    | 项目源码 | 文件源码
def setupUi(self, Dialog):
        self.dlg = Dialog
        Dialog.setObjectName(_fromUtf8("Dialog"))
        Dialog.resize(385, 114)
        self.buttonBox = QtGui.QDialogButtonBox(Dialog)
        self.buttonBox.setGeometry(QtCore.QRect(10, 50, 341, 32))
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
        self.label = QtGui.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(20, 20, 71, 16))
        self.label.setObjectName(_fromUtf8("label"))
        self.spinBox = QtGui.QSpinBox(Dialog)
        self.spinBox.setGeometry(QtCore.QRect(100, 20, 42, 22))
        self.spinBox.setObjectName(_fromUtf8("spinBox"))
        self.spinBox.setMinimum(-80)
        self.spinBox.setMaximum(80)

        self.retranslateUi(Dialog)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), self.accept)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), self.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
项目:ProStep    作者:Gaultus    | 项目源码 | 文件源码
def setupUi(self, Dialog):
        Dialog.setObjectName(_fromUtf8("Dialog"))
        Dialog.resize(400, 113)
        self.buttonBox = QtGui.QDialogButtonBox(Dialog)
        self.buttonBox.setGeometry(QtCore.QRect(40, 60, 341, 32))
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
        self.label = QtGui.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(10, 30, 71, 16))
        self.label.setObjectName(_fromUtf8("label"))
        self.textEdit = QtGui.QTextEdit(Dialog)
        self.textEdit.setGeometry(QtCore.QRect(90, 30, 291, 21))
        self.textEdit.setObjectName(_fromUtf8("textEdit"))
        self.sbRepeats = QtGui.QSpinBox(Dialog)
        self.sbRepeats.setGeometry(QtCore.QRect(90, 60, 50, 21))
        self.sbRepeats.setObjectName(_fromUtf8("textEdit"))
        self.sbRepeats.setMinimum(1)
        self.sbRepeats.setMaximum(99)

        self.retranslateUi(Dialog)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), self.Accept)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), self.Reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
        self.dlg = Dialog
项目:ProStep    作者:Gaultus    | 项目源码 | 文件源码
def setupUi(self, Dialog):
        self.dlg = Dialog
        Dialog.setObjectName(_fromUtf8("Dialog"))
        Dialog.resize(385, 114)
        self.buttonBox = QtGui.QDialogButtonBox(Dialog)
        self.buttonBox.setGeometry(QtCore.QRect(10, 50, 341, 32))
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
        self.label = QtGui.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(20, 20, 71, 16))
        self.label.setObjectName(_fromUtf8("label"))
        self.spinBox = QtGui.QSpinBox(Dialog)
        self.spinBox.setGeometry(QtCore.QRect(100, 20, 42, 22))
        self.spinBox.setObjectName(_fromUtf8("spinBox"))
        self.spinBox.setMinimum(-80)
        self.spinBox.setMaximum(80)

        self.retranslateUi(Dialog)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), self.accept)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), self.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
项目:picasso    作者:jungmannlab    | 项目源码 | 文件源码
def __init__(self, window):
        super().__init__(window)
        self.window = window
        self.setWindowTitle('Parameters')
        self.setModal(False)
        grid = QtGui.QGridLayout(self)

        grid.addWidget(QtGui.QLabel('Oversampling:'), 0, 0)
        self.oversampling = QtGui.QDoubleSpinBox()
        self.oversampling.setRange(1, 1e7)
        self.oversampling.setValue(10)
        self.oversampling.setDecimals(1)
        self.oversampling.setKeyboardTracking(False)
        self.oversampling.valueChanged.connect(self.window.view.update_image)
        grid.addWidget(self.oversampling, 0, 1)

        grid.addWidget(QtGui.QLabel('Iterations:'), 1, 0)
        self.iterations = QtGui.QSpinBox()
        self.iterations.setRange(0, 1e7)
        self.iterations.setValue(10)
        grid.addWidget(self.iterations, 1, 1)
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def setData(self, sysex):
        self.sysex = sysex
        data = sysex[5:-2]
        self.receiving = True
#        if self.data:
#            for i, v in enumerate(self.data):
#                if v != data[i]:
#                    print 'value {} changed from {} to {}'.format(i, v, data[i])
        for w, p in self.param_dict.items():
            if isinstance(w, QtGui.QSpinBox):
                w.setValue(data[p.index] + p.delta)
            elif isinstance(w, PopupSpin):
                w.setIndex(data[p.index])
            elif isinstance(w, QtGui.QComboBox):
                w.setCurrentIndex(data[p.index])
            else:
                w.setChecked(data[p.index])

        self.data = data
        self.original_data = data[:]
        self.receiving = False
        self.show()
项目:ddt4all    作者:cedricp    | 项目源码 | 文件源码
def __init__(self, dataitem, parent=None):
        super(otherPanel, self).__init__(parent)
        self.setFrameStyle(gui.QFrame.Sunken)
        self.setFrameShape(gui.QFrame.Box)
        self.data = dataitem

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

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

        self.inputnob = gui.QSpinBox()
        self.inputnob.setRange(1, 10240)
        self.inputtype = gui.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()
项目:SamuROI    作者:samuroi    | 项目源码 | 文件源码
def __init__(self, parent, *args, **kwargs):
        super(PostProcessorToolbar, self).__init__(parent, *args, **kwargs)

        self.toggle_detrend = self.addAction("Detrend")
        self.toggle_detrend.setToolTip("Apply linear detrend on all traces bevore plotting.")
        self.toggle_detrend.setCheckable(True)
        self.toggle_detrend.triggered.connect(self.update_posprocessor)

        self.toggle_smoothen = self.addAction("Smoothen")
        tooltip = "Apply moving average filter with N frames on all traces bevore plotting. \n" + \
                  "Select N with spin box to the right."
        self.toggle_smoothen.setToolTip(tooltip)

        self.toggle_smoothen.setCheckable(True)
        self.toggle_smoothen.triggered.connect(self.update_posprocessor)

        self.spin_smoothen = QtGui.QSpinBox(value=3)

        self.spin_smoothen.setMinimum(2)
        self.spin_smoothen.setToolTip("Choose the number of frames for the moving average.")
        self.spin_smoothen.valueChanged.connect(self.spin_smoothen_changed)
        self.setToolTip("If both postprocessors are active, detrend will be applied first.")
        self.addWidget(self.spin_smoothen)
项目:mol    作者:MaurizioB    | 项目源码 | 文件源码
def set_data(self, widget, hint):
            item = self.index.model().itemFromIndex(self.index)
            if isinstance(widget, QtGui.QComboBox) or isinstance(widget, ParamCombo):
                found = widget.model().findItems(widget.currentText(), QtCore.Qt.MatchFixedString, widget.modelColumn())+widget.name_model.findItems(widget.currentText(), QtCore.Qt.MatchFixedString, widget.modelColumn())
                if found:
                    id = found[0].row()
                    text = widget.model().item(id, widget.modelColumn()).text()
                else:
                    id = widget.currentIndex()
                    text = widget.model().item(widget.currentIndex(), widget.modelColumn()).text()
                item.setData(id, IdRole)
                item.setText(text)
            elif isinstance(widget, QtGui.QSpinBox):
                if self.index.column() == 1:
                    item.setData(widget.value()-1, IdRole)
                    if widget.value() == 0:
                        item.setText('All')
                else:
                    item.setData(widget.value(), IdRole)
            else:
                item.setText(widget.valid)
                item.setData(widget.sysex, SysExRole)
项目:j3dview    作者:blank63    | 项目源码 | 文件源码
def __init__(self,*args,**kwargs):
        QtGui.QSpinBox.__init__(self,*args,**kwargs)
        PropertyWidget.__init__(self)
        self.setKeyboardTracking(False)
        self.valueChanged.connect(self.on_valueChanged)
项目:j3dview    作者:blank63    | 项目源码 | 文件源码
def __init__(self,*args,**kwargs):
        QtGui.QSpinBox.__init__(self,*args,**kwargs)
        PropertyWidget.__init__(self)
        self.setKeyboardTracking(False)
        self.valueChanged.connect(self.on_valueChanged)
项目:CPNSimulatorGui    作者:chris-kuhr    | 项目源码 | 文件源码
def setupUi(self, TokenDialog):
        TokenDialog.setObjectName(_fromUtf8("TokenDialog"))
        TokenDialog.resize(361, 213)
        self.centralwidget = QtGui.QWidget(TokenDialog)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.verticalLayoutWidget = QtGui.QWidget(self.centralwidget)
        self.verticalLayoutWidget.setGeometry(QtCore.QRect(0, 0, 361, 211))
        self.verticalLayoutWidget.setObjectName(_fromUtf8("verticalLayoutWidget"))
        self.verticalLayout = QtGui.QVBoxLayout(self.verticalLayoutWidget)
        self.verticalLayout.setMargin(0)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.listWidget = QtGui.QListWidget(self.verticalLayoutWidget)
        self.listWidget.setObjectName(_fromUtf8("listWidget"))
        self.verticalLayout.addWidget(self.listWidget)
        self.horizontalLayout_2 = QtGui.QHBoxLayout()
        self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
        self.checkBox = QtGui.QCheckBox(self.verticalLayoutWidget)
        self.checkBox.setObjectName(_fromUtf8("checkBox"))
        self.horizontalLayout_2.addWidget(self.checkBox)
        self.spinBox = QtGui.QSpinBox(self.verticalLayoutWidget)
        self.spinBox.setMinimumSize(QtCore.QSize(50, 0))
        self.spinBox.setMaximumSize(QtCore.QSize(50, 16777215))
        self.spinBox.setObjectName(_fromUtf8("spinBox"))
        self.horizontalLayout_2.addWidget(self.spinBox)
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.pushButton = QtGui.QPushButton(self.verticalLayoutWidget)
        self.pushButton.setObjectName(_fromUtf8("pushButton"))
        self.horizontalLayout.addWidget(self.pushButton)
        self.pushButton_2 = QtGui.QPushButton(self.verticalLayoutWidget)
        self.pushButton_2.setObjectName(_fromUtf8("pushButton_2"))
        self.horizontalLayout.addWidget(self.pushButton_2)
        self.verticalLayout.addLayout(self.horizontalLayout)
        TokenDialog.setCentralWidget(self.centralwidget)

        self.retranslateUi(TokenDialog)
        QtCore.QMetaObject.connectSlotsByName(TokenDialog)
项目:LearningPyQt    作者:manashmndl    | 项目源码 | 文件源码
def setupUi(self, PlotterCreator):
        PlotterCreator.setObjectName(_fromUtf8("PlotterCreator"))
        PlotterCreator.resize(183, 99)
        self.horizontalLayout_3 = QtGui.QHBoxLayout(PlotterCreator)
        self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
        self.verticalLayout = QtGui.QVBoxLayout()
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.graphLabel = QtGui.QLabel(PlotterCreator)
        self.graphLabel.setObjectName(_fromUtf8("graphLabel"))
        self.horizontalLayout.addWidget(self.graphLabel)
        self.graphSpinBox = QtGui.QSpinBox(PlotterCreator)
        self.graphSpinBox.setMinimum(1)
        self.graphSpinBox.setMaximum(10)
        self.graphSpinBox.setObjectName(_fromUtf8("graphSpinBox"))
        self.horizontalLayout.addWidget(self.graphSpinBox)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.horizontalLayout_2 = QtGui.QHBoxLayout()
        self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
        self.label = QtGui.QLabel(PlotterCreator)
        self.label.setObjectName(_fromUtf8("label"))
        self.horizontalLayout_2.addWidget(self.label)
        self.noOfDataLineEdit = QtGui.QLineEdit(PlotterCreator)
        self.noOfDataLineEdit.setObjectName(_fromUtf8("noOfDataLineEdit"))
        self.horizontalLayout_2.addWidget(self.noOfDataLineEdit)
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.pushButton = QtGui.QPushButton(PlotterCreator)
        self.pushButton.setObjectName(_fromUtf8("pushButton"))
        self.verticalLayout.addWidget(self.pushButton)
        self.horizontalLayout_3.addLayout(self.verticalLayout)

        self.retranslateUi(PlotterCreator)
        QtCore.QMetaObject.connectSlotsByName(PlotterCreator)
项目:dxf2gcode    作者:cnc-club    | 项目源码 | 文件源码
def getValue(self):
        """
        @return: the current value of the QSpinBox
        """
        return self.spinbox.value()
项目:dxf2gcode    作者:cnc-club    | 项目源码 | 文件源码
def getValue(self):
        """
        @return: the current value of the QSpinBox
        """
        return str(self.lineedit.text())
项目:dxf2gcode    作者:cnc-club    | 项目源码 | 文件源码
def getValue(self):
        """
        @return the current value of the QSpinBox (string list)
        """
        item_list = str(self.lineedit.text()).split(self.separator)
        i = 0
        while i < len(item_list):
            item_list[i] = item_list[i].strip(' ') #remove leading and trailing whitespaces
            i += 1
        return item_list
项目:dxf2gcode    作者:cnc-club    | 项目源码 | 文件源码
def setCellValue(self, line, column, value):
        """
        This function is reimplemented to use QTextEdit into the table, thus allowing multi-lines custom GCODE to be stored
        @param line: line number (int)
        @param column: column number (int)
        @param value: cell content (string or int or float)
        """
        if column > 0:
            #we use QDoubleSpinBox for storing the values
            spinbox = CorrectedDoubleSpinBox()
            spinbox.setMinimum(0)
            spinbox.setMaximum(1000000000) #Default value is 99
            computed_value = 0.0
            try: computed_value = float(value) #Convert the value to float
            except ValueError: pass
            spinbox.setValue(computed_value)
        else:
            #tool number is an integer
            spinbox = QSpinBox()
            spinbox.setMinimum(0)
            spinbox.setMaximum(1000000000) #Default value is 99

            computed_value = 0
            try:
                computed_value = int(value) #Convert the value to int (we may receive a string for example)
            except ValueError:
                computed_value = self.max_tool_number + 1
            self.max_tool_number = max(self.max_tool_number, computed_value) #Store the max value for the tool number, so that we can automatically increment this value for new tools
            spinbox.setValue(computed_value) #first column is the key, it must be an int

        self.tablewidget.setCellWidget(line, column, spinbox)
项目:olive-gui    作者:dturevski    | 项目源码 | 文件源码
def __init__(self):
        super(DistinctionWidget, self).__init__()
        hbox = QtGui.QHBoxLayout()
        self.special = QtGui.QCheckBox(Lang.value('DSTN_Special'))
        hbox.addWidget(self.special)
        self.lo = QtGui.QSpinBox()
        hbox.addWidget(self.lo)
        self.hi = QtGui.QSpinBox()
        hbox.addWidget(self.hi)
        self.name = QtGui.QComboBox()
        self.name.addItems(
            ['X' * 15 for i in DistinctionWidget.names])  # spacers
        hbox.addWidget(self.name)
        self.comment = QtGui.QLineEdit()
        hbox.addWidget(self.comment)
        hbox.addStretch(1)
        self.setLayout(hbox)

        self.special.stateChanged.connect(self.onChanged)
        self.name.currentIndexChanged.connect(self.onChanged)
        self.lo.valueChanged.connect(self.onChanged)
        self.hi.valueChanged.connect(self.onChanged)
        self.comment.textChanged.connect(self.onChanged)

        Mainframe.sigWrapper.sigModelChanged.connect(self.onModelChanged)
        Mainframe.sigWrapper.sigLangChanged.connect(self.onLangChanged)
        self.skip_model_changed = False
        self.onLangChanged()
项目:picasso    作者:jungmannlab    | 项目源码 | 文件源码
def __init__(self, window):
        super().__init__(window)
        self.window = window
        self.setWindowTitle('Structure')
        self.showMaximized()
        self.layout_grid = QtGui.QGridLayout(self)

        self.figure = plt.figure()
        self.canvas = FigureCanvasQTAgg(self.figure)
        self.label = QtGui.QLabel()

        self.layout_grid.addWidget(self.label,0,0,1,5)
        self.layout_grid.addWidget(self.canvas,1,0,8,5)

        self.buttons = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Yes | QtGui.QDialogButtonBox.No | QtGui.QDialogButtonBox.Cancel,
                                              QtCore.Qt.Horizontal,
                                              self)
        self.layout_grid.addWidget(self.buttons,10,0,1,3)
        self.layout_grid.addWidget(QtGui.QLabel('No clusters:'),10,3,1,1)

        self.n_clusters_spin = QtGui.QSpinBox()

        self.layout_grid.addWidget(self.n_clusters_spin,10,4,1,1)


        self.buttons.button(QtGui.QDialogButtonBox.Yes).clicked.connect(self.on_accept)

        self.buttons.button(QtGui.QDialogButtonBox.No).clicked.connect(self.on_reject)

        self.buttons.button(QtGui.QDialogButtonBox.Cancel).clicked.connect(self.on_cancel)

        self.start_clusters = 0
        self.n_clusters_spin.valueChanged.connect(self.on_cluster)
        self.n_lines = 12
        self.layout_grid.addWidget(QtGui.QLabel('Select'),11,4,1,1)
        self.layout_grid.addWidget(QtGui.QLabel('X-Center'),11,0,1,1)
        self.layout_grid.addWidget(QtGui.QLabel('Y-Center'),11,1,1,1)
        self.layout_grid.addWidget(QtGui.QLabel('Z-Center'),11,2,1,1)
        self.layout_grid.addWidget(QtGui.QLabel('Counts'),11,3,1,1)
        self.checks = []
项目:picasso    作者:jungmannlab    | 项目源码 | 文件源码
def __init__(self, window):
        super().__init__(window)
        self.window = window
        self.setWindowTitle('Structure')
        self.layout_grid = QtGui.QGridLayout(self)

        self.figure = plt.figure()
        self.canvas = FigureCanvasQTAgg(self.figure)
        self.label = QtGui.QLabel()

        self.layout_grid.addWidget(self.label,0,0,1,5)
        self.layout_grid.addWidget(self.canvas,1,0,1,5)

        self.buttons = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Yes | QtGui.QDialogButtonBox.No | QtGui.QDialogButtonBox.Cancel,
                                              QtCore.Qt.Horizontal,
                                              self)
        self.layout_grid.addWidget(self.buttons,2,0,1,3)
        self.layout_grid.addWidget(QtGui.QLabel('No clusters:'),2,3,1,1)

        self.n_clusters_spin = QtGui.QSpinBox()

        self.layout_grid.addWidget(self.n_clusters_spin,2,4,1,1)


        self.buttons.button(QtGui.QDialogButtonBox.Yes).clicked.connect(self.on_accept)

        self.buttons.button(QtGui.QDialogButtonBox.No).clicked.connect(self.on_reject)

        self.buttons.button(QtGui.QDialogButtonBox.Cancel).clicked.connect(self.on_cancel)

        self.start_clusters = 0
        self.n_clusters_spin.valueChanged.connect(self.on_cluster)
        self.n_lines = 4
        self.layout_grid.addWidget(QtGui.QLabel('Select'),3,3,1,1)
        self.layout_grid.addWidget(QtGui.QLabel('X-Center'),3,0,1,1)
        self.layout_grid.addWidget(QtGui.QLabel('Y-Center'),3,1,1,1)
        self.layout_grid.addWidget(QtGui.QLabel('Counts'),3,2,1,1)
        self.checks = []
项目:picasso    作者:jungmannlab    | 项目源码 | 文件源码
def __init__(self, window):
        super().__init__(window)
        self.window = window
        self.setWindowTitle('Enter movie info')
        vbox = QtGui.QVBoxLayout(self)
        grid = QtGui.QGridLayout()
        grid.addWidget(QtGui.QLabel('Byte Order:'), 0, 0)
        self.byte_order = QtGui.QComboBox()
        self.byte_order.addItems(['Little Endian (loads faster)', 'Big Endian'])
        grid.addWidget(self.byte_order, 0, 1)
        grid.addWidget(QtGui.QLabel('Data Type:'), 1, 0)
        self.dtype = QtGui.QComboBox()
        self.dtype.addItems(['float16', 'float32', 'float64', 'int8', 'int16', 'int32', 'uint8', 'uint16', 'uint32'])
        grid.addWidget(self.dtype, 1, 1)
        grid.addWidget(QtGui.QLabel('Frames:'), 2, 0)
        self.frames = QtGui.QSpinBox()
        self.frames.setRange(1, 1e9)
        grid.addWidget(self.frames, 2, 1)
        grid.addWidget(QtGui.QLabel('Height:'), 3, 0)
        self.movie_height = QtGui.QSpinBox()
        self.movie_height.setRange(1, 1e9)
        grid.addWidget(self.movie_height, 3, 1)
        grid.addWidget(QtGui.QLabel('Width'), 4, 0)
        self.movie_width = QtGui.QSpinBox()
        self.movie_width.setRange(1, 1e9)
        grid.addWidget(self.movie_width, 4, 1)
        self.save = QtGui.QCheckBox('Save info to yaml file')
        self.save.setChecked(True)
        grid.addWidget(self.save, 5, 0, 1, 2)
        vbox.addLayout(grid)
        hbox = QtGui.QHBoxLayout()
        vbox.addLayout(hbox)
        # OK and Cancel buttons
        self.buttons = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel,
                                              QtCore.Qt.Horizontal,
                                              self)
        vbox.addWidget(self.buttons)
        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)

    # static method to create the dialog and return (date, time, accepted)
项目:picasso    作者:jungmannlab    | 项目源码 | 文件源码
def __init__(self, window):
        super().__init__(window)
        self.window = window
        self.setWindowTitle('Contrast')
        self.resize(200, 0)
        self.setModal(False)
        grid = QtGui.QGridLayout(self)
        black_label = QtGui.QLabel('Black:')
        grid.addWidget(black_label, 0, 0)
        self.black_spinbox = QtGui.QSpinBox()
        self.black_spinbox.setKeyboardTracking(False)
        self.black_spinbox.setRange(0, 999999)
        self.black_spinbox.valueChanged.connect(self.on_contrast_changed)
        grid.addWidget(self.black_spinbox, 0, 1)
        white_label = QtGui.QLabel('White:')
        grid.addWidget(white_label, 1, 0)
        self.white_spinbox = QtGui.QSpinBox()
        self.white_spinbox.setKeyboardTracking(False)
        self.white_spinbox.setRange(0, 999999)
        self.white_spinbox.valueChanged.connect(self.on_contrast_changed)
        grid.addWidget(self.white_spinbox, 1, 1)
        self.auto_checkbox = QtGui.QCheckBox('Auto')
        self.auto_checkbox.setTristate(False)
        self.auto_checkbox.setChecked(True)
        self.auto_checkbox.stateChanged.connect(self.on_auto_changed)
        grid.addWidget(self.auto_checkbox, 2, 0, 1, 2)
        self.silent_contrast_change = False
项目:ddt4all    作者:cedricp    | 项目源码 | 文件源码
def __init__(self, dataitem, parent=None):
        super(numericListPanel, self).__init__(parent)
        self.setFrameStyle(gui.QFrame.Sunken)
        self.setFrameShape(gui.QFrame.Box)
        self.data = dataitem

        layoutv = gui.QVBoxLayout()
        layout = gui.QGridLayout()
        labelnob = gui.QLabel(_("Number of bits"))
        lablelsigned = gui.QLabel(_("Signed"))
        newitem = gui.QPushButton(_("Add item"))
        delitem = gui.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 = gui.QSpinBox()
        self.inputnob.setRange(1, 32)
        self.inputsigned = gui.QCheckBox()

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

        layoutv.addLayout(layout)

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

        layoutv.addWidget(self.itemtable)

        self.setLayout(layoutv)
        self.init()
项目:ddt4all    作者:cedricp    | 项目源码 | 文件源码
def add_item(self):
        value = -999
        self.itemtable.setRowCount(self.itemtable.rowCount() + 1)
        newrow = self.itemtable.rowCount() - 1
        spinvalue = gui.QSpinBox()
        spinvalue.setRange(-1000000, 1000000)
        spinvalue.setValue(value)
        self.itemtable.setCellWidget(newrow, 0, spinvalue)
        self.itemtable.setItem(newrow, 1, gui.QTableWidgetItem(_("New item")))
        self.itemtable.setItem(newrow, 0, gui.QTableWidgetItem(str(value).zfill(5)))
        self.itemtable.resizeRowsToContents()
        self.itemtable.resizeColumnsToContents()
项目:ddt4all    作者:cedricp    | 项目源码 | 文件源码
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 = gui.QSpinBox()
            spinvalue.setRange(-1000000,1000000)
            spinvalue.setValue(int(v))
            self.itemtable.setCellWidget(count, 0, spinvalue)
            self.itemtable.setItem(count, 0, gui.QTableWidgetItem(str(v).zfill(5)))
            self.itemtable.setItem(count, 1, gui.QTableWidgetItem(k))
            count += 1

        headerstrings = core.QString(_("Value;Text")).split(";")
        self.itemtable.setHorizontalHeaderLabels(headerstrings)
        self.itemtable.resizeColumnsToContents()
        self.itemtable.resizeRowsToContents()
        self.itemtable.sortItems(0, core.Qt.AscendingOrder)
        #self.itemtable.setSortingEnabled(True)
项目:ddt4all    作者:cedricp    | 项目源码 | 文件源码
def __init__(self, iscan=True):
        gui.QSpinBox.__init__(self)
        self.set_can(iscan)
项目:SamuROI    作者:samuroi    | 项目源码 | 文件源码
def __init__(self, parent, *args, **kwargs):
        super(SplitJoinToolbar, self).__init__(parent=parent, *args, **kwargs)

        self.btn_split_single = self.addAction("split\nselection")
        self.btn_split_single.setToolTip("Split selecteded branches.")
        self.btn_split_single.setEnabled(True)
        self.btn_split_single.triggered.connect(self.split_selected)

        self.btn_split_single = self.addAction("split\nall")
        self.btn_split_single.setToolTip("Split all branches.")
        self.btn_split_single.triggered.connect(self.split_all)

        self.split_length_widget = QtGui.QSpinBox(value=5)
        self.split_length_widget.setToolTip("Choose the spliting length.")
        self.addWidget(self.split_length_widget)

        self.addSeparator()

        self.btn_split_segment = self.addAction("1/2")
        self.btn_split_segment.setToolTip("Split selected segment in two equal parts.")
        self.btn_split_segment.setEnabled(False)
        # self.btn_split_segment.triggered.connect(lambda: self.app.split_segment())

        self.btn_merge_segment_left = self.addAction("<+")
        self.btn_merge_segment_left.setToolTip("Merge selected segment with preceeding segment.")
        self.btn_merge_segment_left.setEnabled(False)
        # self.btn_merge_segment_left.triggered.connect(lambda: self.app.join_segments(next=False))

        self.btn_merge_segment_right = self.addAction("+>")
        self.btn_merge_segment_right.setToolTip("Merge selected segment with next segment.")
        self.btn_merge_segment_right.setEnabled(False)
        # self.btn_merge_segment_right.triggered.connect(lambda: self.app.join_segments(next=True))
项目:mol    作者:MaurizioB    | 项目源码 | 文件源码
def createEditor(self, parent, option, index):
            self.index = index
            if index.column() == 2:
                model = index.model()
                ev_type = model.itemFromIndex(model.index(self.index.row(), 0)).data(EventRole).toPyObject()
                if ev_type == SYSEX:
                    return SysExEditor(parent, index.data(SysExRole).toPyObject())
#                combo = QtGui.QComboBox(parent)
#                if ev_type == CTRL:
#                    combo.addItems(['{} - {}'.format(id, Controllers[id]) for id in sorted(Controllers.keys())])
#                elif ev_type in [NOTEON, NOTEOFF]:
#                    combo.addItems(['{} - {}'.format(id, NoteNames[id].title()) for id in sorted(NoteNames.keys())])
                combo = ParamCombo(parent)
                combo.setModelColumn(0 if ev_type==CTRL else 1)
                combo.setCurrentIndex(index.data(EventIdRole).toPyObject())
                combo.setMinimumWidth(option.rect.width())
#                combo.activated.connect(lambda i: parent.setFocus())
                return combo
            spin = QtGui.QSpinBox(parent)
            spin.wheelEvent = lambda event: spin.stepBy(-spin.singleStep() if event.delta() > 0 else spin.singleStep())
            if index.column() == 1:
                if not self.all_channels:
                    spin.setMinimum(1)
                else:
                    spin.setMinimum(0)
                    spin.setSpecialValueText('All')
                spin.setMaximum(16)
                spin.setValue(index.data(IdRole).toPyObject()+1)
            else:
                spin.setMinimum(0)
                spin.setMaximum(127)
            return spin
项目:PortableApps.com-DevelopmentToolkit    作者:3D1T0R    | 项目源码 | 文件源码
def _fill(self, field, value):
        if isinstance(value, Undefined):
            return

        if isinstance(field, QtGui.QComboBox):
            index = field.findText(value)
            if index > -1:
                field.setCurrentIndex(index)
            elif field.isEditable():
                field.setEditText(index)
            # else fail silently
        elif isinstance(field, QtGui.QCheckBox):
            if value == 'true':
                field.setChecked(True)
            elif value == 'false':
                field.setChecked(False)
            # else fail silently
        elif isinstance(field, QtGui.QLineEdit):
            field.setText(value)
            field.setCursorPosition(0)
        elif isinstance(field, QtGui.QSpinBox):
            try:
                value = int(value)
            except ValueError:
                pass
            else:
                field.setValue(value)
        else:
            raise TypeError("Field %s type %s is invalid." % (field,
                type(field)))
项目:MidiMemo    作者:MaurizioB    | 项目源码 | 文件源码
def createEditor(self, parent, option, index):
            self.index = index
            if index.column() == 0:
                combo = QtGui.QComboBox(parent)
                combo.addItems(['{} - {}'.format(id, Controllers[id]) for id in sorted(Controllers.keys())[1:]])
                combo.setCurrentIndex(index.data(UserRole).toPyObject()-1)
                return combo
            spin = QtGui.QSpinBox(parent)
            spin.setMaximum(127)
            return spin
项目:sardana    作者:sardana-org    | 项目源码 | 文件源码
def _fillList(self):
        self._comboList = []
        self._spinList = []
        self.tableWidget.clear()
        self._setTableHeaders()

        self.tableWidget.setRowCount(len(self.listOfItems))
        self.tableWidget.clearSelection()
        # self.tableWidget.setItemSelected(None)

        # self.tableWidget.selectRow(-1)

        self.editButton.setObjectName("editButton")
        i = 0
        for item in self.listOfItems:
            self.tableWidget.setCellWidget(i, 0, QtGui.QLabel(item.text()))
            self._comboList.append(QtGui.QComboBox())
            self._comboList[i].setObjectName("hostComboBox_%d" % i)
            if item.getHostName() == "":
                self._comboList[i].addItem("None")
            else:
                self._comboList[i].addItem(item.getHostName())
            self._comboList[i].addItems(self._hostList)
            self._comboList[i].addItem("None")
            self._comboList[i].insertSeparator(len(self._hostList) + 1)
            QtCore.QObject.connect(self._comboList[i], QtCore.SIGNAL(
                "currentIndexChanged(int)"), self.hostChanged)
            self.tableWidget.setCellWidget(i, 1, self._comboList[i])
            self._spinList.append(QtGui.QSpinBox())
            self._spinList[i].setRange(*SardanaManager().get_level_range())
            self._spinList[i].setObjectName("levelSpinBox_%d" % i)
            QtCore.QObject.connect(self._spinList[i], QtCore.SIGNAL(
                "valueChanged(int)"), self.levelChanged)
            self.tableWidget.setCellWidget(i, 2, self._spinList[i])

            if (item.getHostName() == "") or (item.getHostName() is None):
                self._spinList[i].setDisabled(True)
                self._spinList[i].setValue(0)
            else:
                self._spinList[i].setValue(int(item.getLevel()))
            i += 1
项目:CPNSimulatorGui    作者:chris-kuhr    | 项目源码 | 文件源码
def __init__(self, parent=None, title="Choose Colour and Amount of the Token"):
        '''Create token dialog.

        :param parent: Parent `gui.DiagramEditor`.
        :param title: Window Tilte
        '''
        super(TokenDialog, self).__init__(parent)
        self.setWindowTitle(title)

        self.editor = parent

        self.resize(361, 213)
        self.verticalLayout = QtGui.QVBoxLayout(self)
        self.verticalLayout.setMargin(0)
        self.listWidget = QtGui.QListWidget(self)
        self.verticalLayout.addWidget(self.listWidget)

        self.horizontalLayout_2 = QtGui.QHBoxLayout()
        self.checkBox = QtGui.QCheckBox(self)
        self.checkBox.setText("Initial Marking")
        self.horizontalLayout_2.addWidget(self.checkBox)
        self.spinBox = QtGui.QSpinBox(self)
        self.spinBox.setMinimumSize(QtCore.QSize(50, 0))
        self.spinBox.setMaximumSize(QtCore.QSize(50, 16777215))
        self.horizontalLayout_2.addWidget(self.spinBox)
        self.verticalLayout.addLayout(self.horizontalLayout_2)

        self.horizontalLayout = QtGui.QHBoxLayout()
        self.pushButton = QtGui.QPushButton(self)
        self.pushButton.setText("Ok")
        self.horizontalLayout.addWidget(self.pushButton)
        self.pushButton_2 = QtGui.QPushButton(self)
        self.pushButton_2.setText("Cancel")
        self.horizontalLayout.addWidget(self.pushButton_2)
        self.verticalLayout.addLayout(self.horizontalLayout)

        self.listEntry = ""
        self.initMarking = False
        self.countToken = 1

        self.spinBox.setValue(self.countToken)

        for idx in range(0, self.editor.colorListWidget.count()-1 ):
            self.listWidget.addItem( QtGui.QListWidgetItem( self.editor.colorListWidget.item(idx) ) )

        self.listWidget.itemSelectionChanged.connect(self.setListEntry)
        self.checkBox.stateChanged.connect(self.setInitMarking)
        self.spinBox.valueChanged.connect(self.setCountToken)
        self.pushButton.clicked.connect(self.ok)
        self.pushButton_2.clicked.connect(self.cancel)
    #------------------------------------------------------------------------------------------------
项目:pslab-desktop-apps    作者:fossasia    | 项目源码 | 文件源码
def guisave(ui, settings):
    #for child in ui.children():  # works like getmembers, but because it traverses the hierarachy, you would have to call guisave recursively to traverse down the tree
    for name, obj in inspect.getmembers(ui):
        if isinstance(obj, QtGui.QComboBox):
            name   = obj.objectName()      # get combobox name
            index  = obj.currentIndex()    # get current index from combobox
            settings.setValue(name, index)   # save combobox selection to registry
            #print 'combo',name,index

        elif isinstance(obj, QtGui.QLineEdit):
            name = obj.objectName()
            value = obj.text()
            settings.setValue(name, value)    # save ui values, so they can be restored next time
            #print 'line',name,value

        elif isinstance(obj, QtGui.QCheckBox):
            name = obj.objectName()
            state = obj.checkState()
            settings.setValue(name, state)
            #print 'check',name,state

        elif isinstance(obj, QtGui.QDial):
            name = obj.objectName()
            value = obj.value()
            settings.setValue(name, value)
            #print 'dial',name,value

        elif isinstance(obj, QtGui.QSlider):
            name = obj.objectName()
            value = obj.value()
            settings.setValue(name, value)
            #print 'slider',name,value

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

        elif isinstance(obj, QtGui.QDoubleSpinBox):
            name = obj.objectName()
            value = obj.value()
            settings.setValue(name, value)
            #print 'doublespin',name,value


#===================================================================
# restore "ui" controls with values stored in registry "settings"
# ui = QMainWindow object
# settings = QSettings object
#===================================================================
项目:pslab-desktop-apps    作者:fossasia    | 项目源码 | 文件源码
def guirestore(ui, settings):
    for name, obj in inspect.getmembers(ui):
        if isinstance(obj, QtGui.QComboBox):
            name   = obj.objectName()
            index = int(settings.value(name))
            if index == "" or index==-1:
                continue
            obj.setCurrentIndex(index)   # preselect a combobox value by index    

        elif isinstance(obj, QtGui.QLineEdit):
            name = obj.objectName()
            value = unicode(settings.value(name))  # get stored value from registry
            obj.setText(value)  # restore lineEditFile

        elif isinstance(obj, QtGui.QCheckBox):
            name = obj.objectName()
            value = int(settings.value(name))
            if value != None:
                obj.setChecked(bool(value))   # restore checkbox

        elif isinstance(obj, QtGui.QDial):
            name   = obj.objectName()
            value = int(settings.value(name))
            if value == "":
                continue
            obj.setValue(value)

        elif isinstance(obj, QtGui.QSlider):
            name   = obj.objectName()
            value = int(settings.value(name))
            if value == "":
                continue
            obj.setValue(value)

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

        elif isinstance(obj, QtGui.QDoubleSpinBox):
            name   = obj.objectName()
            value = int(settings.value(name))
            if value == "":
                continue
            obj.setValue(value)


################################################################
项目:pslab-desktop-apps    作者:fossasia    | 项目源码 | 文件源码
def __init__(self,parent=None,**kwargs):
        super(AppWindow, self).__init__(parent)
        self.I=kwargs.get('I',None)

        self.I.NRF.write_register(self.I.NRF.SETUP_RETR,0x45)
        self.pos=0
        x = np.linspace(0,np.pi*2,500)
        self.t1 = 50+50*np.sin(x*2)
        self.t2 = 50+50*np.sin(x*4)
        self.t3 = 50+50*np.sin(x)


        self.resize(400, 120)
        self.Frame=QtGui.QFrame()
        self.Holder=QtGui.QVBoxLayout()
        self.Frame.setLayout(self.Holder)
        self.setCentralWidget(self.Frame)
        self.setWindowTitle(self.I.H.version_string+' : '+params.get('name','').replace('\n',' ') )
        self.lbl = QtGui.QLabel('Signal Strength meter:')
        self.Holder.addWidget(self.lbl)

        self.addressBox = QtGui.QLineEdit()
        self.addressBox.setText('0x010101')
        self.addressBox.returnPressed.connect(self.addAddress)
        self.addrLabel = QtGui.QLabel('address')
        self.Holder.addWidget(self.addrLabel)
        self.Holder.addWidget(self.addressBox)

        self.chanBox = QtGui.QSpinBox()
        self.chanBox.setMinimum(1); self.chanBox.setMaximum(127);self.chanBox.setValue(10);self.chanBox.valueChanged.connect(self.switchChannel)
        self.chanLabel = QtGui.QLabel('channel[0-127]: ')
        self.Holder.addWidget(self.chanLabel)
        self.Holder.addWidget(self.chanBox)


        self.slds = {}
        self.wids=[]
        self.last_chan = 100

        self.setWindowTitle('Control RGB LEDs on Wireless Nodes')
        self.timer = QtCore.QTimer()
        self.timer.timeout.connect(self.update)
        self.timer.start(1)
项目:ProStep    作者:Gaultus    | 项目源码 | 文件源码
def setupUi(self, Dialog):
        self.dlg = Dialog
        Dialog.setObjectName(_fromUtf8("Dialog"))
        Dialog.resize(800, 192)
        self.buttonBox = QtGui.QDialogButtonBox(Dialog)
        self.buttonBox.setGeometry(QtCore.QRect(30, 120, 541, 32))
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
        self.sbBanks = QtGui.QSpinBox(Dialog)
        self.sbBanks.setGeometry(QtCore.QRect(70, 30, 42, 22))
        self.sbBanks.setObjectName(_fromUtf8("sbBanks"))
        self.label = QtGui.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(10, 30, 46, 13))
        self.label.setObjectName(_fromUtf8("label"))
        self.label_2 = QtGui.QLabel(Dialog)
        self.label_2.setGeometry(QtCore.QRect(10, 70, 46, 13))
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.sbVoices = QtGui.QSpinBox(Dialog)
        self.sbVoices.setGeometry(QtCore.QRect(70, 70, 42, 22))
        self.sbVoices.setObjectName(_fromUtf8("sbVoices"))
        self.cbInputs = QtGui.QComboBox(Dialog)
        self.cbInputs.setGeometry(QtCore.QRect(140, 60, 100, 22))
        self.cbInputs.setObjectName(_fromUtf8("cbInputs"))
        self.label_3 = QtGui.QLabel(Dialog)
        self.label_3.setGeometry(QtCore.QRect(140, 30, 100, 16))
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self.label_4 = QtGui.QLabel(Dialog)
        self.label_4.setGeometry(QtCore.QRect(230, 30, 100, 13))
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.cbClocks = QtGui.QComboBox(Dialog)
        self.cbClocks.setGeometry(QtCore.QRect(230, 60, 100, 22))
        self.cbClocks.setObjectName(_fromUtf8("cbClocks"))
        self.label_5 = QtGui.QLabel(Dialog)
        self.label_5.setGeometry(QtCore.QRect(310, 30, 100, 13))
        self.label_5.setObjectName(_fromUtf8("label_5"))
        self.cbOutputs = QtGui.QComboBox(Dialog)
        self.cbOutputs.setGeometry(QtCore.QRect(310, 60, 100, 22))
        self.cbOutputs.setObjectName(_fromUtf8("cbOutputs"))

        outp= mido.get_output_names()
        inp = mido.get_input_names()

        for i in inp:
            self.cbInputs.addItem(i)
            self.cbClocks.addItem(i)
        self.outputs = QtGui.QComboBox()
        for i in outp:
            self.cbOutputs.addItem(i)

        self.sbChannel = QtGui.QSpinBox(Dialog)
        self.sbChannel.setMinimum(1)
        self.sbChannel.setMaximum(16)
        self.sbChannel.setValue(1)
        self.sbChannel.setGeometry(140,84,69,22)
        self.sbChannel.setObjectName(_fromUtf8("sbChannel"))

        self.retranslateUi(Dialog)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), self.accepted)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), self.rejected)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
项目:picasso    作者:jungmannlab    | 项目源码 | 文件源码
def add_entry(self,path):
        c = QtGui.QCheckBox(path)
        currentline = len(self.layout)
        colordrop = QtGui.QComboBox(self)
        colordrop.setEditable(True)
        colordrop.lineEdit().setMaxLength(7)
        colordrop.addItem("auto")
        colordrop.addItem("red")
        colordrop.addItem("green")
        colordrop.addItem("blue")
        colordrop.addItem("gray")
        colordrop.addItem("cyan")
        colordrop.addItem("magenta")
        colordrop.addItem("yellow")
        #self.myDropDown = QComboBox()
        #self.myDropDown.setEditable(True)
        #self.myDropDown.lineEdit().setMaxLength(45)
        intensity = QtGui.QSpinBox(self)
        intensity.setValue(1)
        colordisp = QtGui.QLabel('      ')

        palette = colordisp.palette()
        palette.setColor(QtGui.QPalette.Window, QtGui.QColor('black'))
        colordisp.setAutoFillBackground(True)
        colordisp.setPalette(palette)

        self.layout.addWidget(c, currentline, 0)
        self.layout.addWidget(colordrop, currentline, 1)
        self.layout.addWidget(colordisp, currentline, 2)
        self.layout.addWidget(intensity, currentline, 3)

        self.intensitysettings.append(intensity)
        self.colorselection.append(colordrop)
        self.colordisp_all.append(colordisp)

        self.checks.append(c)
        self.checks[-1].setChecked(True)
        self.checks[-1].stateChanged.connect(self.update_viewport)
        self.colorselection[-1].currentIndexChanged.connect(self.update_viewport)
        index = len(self.colorselection)
        self.colorselection[-1].currentIndexChanged.connect(lambda: self.set_color(index-1))
        self.intensitysettings[-1].valueChanged.connect(self.update_viewport)

        #update auto colors
        n_channels = len(self.checks)
        hues = np.arange(0, 1, 1 / n_channels)
        colors = [colorsys.hsv_to_rgb(_, 1, 1) for _ in hues]
        for n in range(n_channels):
            palette = self.colordisp_all[n].palette()
            palette.setColor(QtGui.QPalette.Window, QtGui.QColor.fromRgbF(colors[n][0], colors[n][1], colors[n][2], 1))
            self.colordisp_all[n].setPalette(palette)
项目:ddt4all    作者:cedricp    | 项目源码 | 文件源码
def __init__(self, dataitem, parent=None):
        super(numericPanel, self).__init__(parent)
        self.setFrameStyle(gui.QFrame.Sunken)
        self.setFrameShape(gui.QFrame.Box)
        self.data = dataitem

        layout = gui.QGridLayout()
        labelnob = gui.QLabel(_("Number of bit"))
        lableunit = gui.QLabel(_("Unit"))
        labelsigned = gui.QLabel(_("Signed"))
        labelformat = gui.QLabel(_("Format"))
        labeldoc = gui.QLabel(_("Value = (AX+B) / C"))
        labela = gui.QLabel("A")
        labelb = gui.QLabel("B")
        labelc = gui.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 = gui.QSpinBox()
        self.inputnob.setRange(1, 32)
        self.inputunit = gui.QLineEdit()
        self.inputsigned = gui.QCheckBox()
        self.inputformat = gui.QLineEdit()
        self.inputa = gui.QDoubleSpinBox()
        self.inputb = gui.QDoubleSpinBox()
        self.inputc = gui.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()
项目:PortableApps.com-DevelopmentToolkit    作者:3D1T0R    | 项目源码 | 文件源码
def setupUi(self, PageCompact):
        PageCompact.setObjectName("PageCompact")
        PageCompact.resize(960, 445)
        self.verticalLayout = QtGui.QVBoxLayout(PageCompact)
        self.verticalLayout.setObjectName("verticalLayout")
        self.start_button = QtGui.QCommandLinkButton(PageCompact)
        self.start_button.setObjectName("start_button")
        self.verticalLayout.addWidget(self.start_button)
        self.output = QtGui.QTextBrowser(PageCompact)
        self.output.setObjectName("output")
        self.verticalLayout.addWidget(self.output)
        self.advanced_groupbox = QtGui.QGroupBox(PageCompact)
        self.advanced_groupbox.setObjectName("advanced_groupbox")
        self.advanced_layout = QtGui.QGridLayout(self.advanced_groupbox)
        self.advanced_layout.setObjectName("advanced_layout")
        self.files_excluded_label = QtGui.QLabel(self.advanced_groupbox)
        self.files_excluded_label.setObjectName("files_excluded_label")
        self.advanced_layout.addWidget(self.files_excluded_label, 0, 0, 1, 1)
        self.files_excluded = QtGui.QLineEdit(self.advanced_groupbox)
        self.files_excluded.setObjectName("files_excluded")
        self.advanced_layout.addWidget(self.files_excluded, 0, 1, 1, 2)
        self.compression_file_size_cut_off_label = QtGui.QLabel(self.advanced_groupbox)
        self.compression_file_size_cut_off_label.setObjectName("compression_file_size_cut_off_label")
        self.advanced_layout.addWidget(self.compression_file_size_cut_off_label, 1, 0, 1, 1)
        self.compression_file_size_cut_off = QtGui.QSpinBox(self.advanced_groupbox)
        self.compression_file_size_cut_off.setMaximum(1073741824)
        self.compression_file_size_cut_off.setProperty("value", 4096)
        self.compression_file_size_cut_off.setObjectName("compression_file_size_cut_off")
        self.advanced_layout.addWidget(self.compression_file_size_cut_off, 1, 1, 1, 1)
        self.compression_file_size_cut_off_unit_label = QtGui.QLabel(self.advanced_groupbox)
        self.compression_file_size_cut_off_unit_label.setObjectName("compression_file_size_cut_off_unit_label")
        self.advanced_layout.addWidget(self.compression_file_size_cut_off_unit_label, 1, 2, 1, 1)
        spacerItem = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum)
        self.advanced_layout.addItem(spacerItem, 0, 3, 2, 1)
        self.additional_extensions_excluded_label = QtGui.QLabel(self.advanced_groupbox)
        self.additional_extensions_excluded_label.setObjectName("additional_extensions_excluded_label")
        self.advanced_layout.addWidget(self.additional_extensions_excluded_label, 0, 4, 1, 1)
        self.additional_extensions_excluded = QtGui.QLineEdit(self.advanced_groupbox)
        self.additional_extensions_excluded.setObjectName("additional_extensions_excluded")
        self.advanced_layout.addWidget(self.additional_extensions_excluded, 0, 5, 1, 1)
        self.additional_extensions_included_label = QtGui.QLabel(self.advanced_groupbox)
        self.additional_extensions_included_label.setObjectName("additional_extensions_included_label")
        self.advanced_layout.addWidget(self.additional_extensions_included_label, 1, 4, 1, 1)
        self.additional_extensions_included = QtGui.QLineEdit(self.advanced_groupbox)
        self.additional_extensions_included.setObjectName("additional_extensions_included")
        self.advanced_layout.addWidget(self.additional_extensions_included, 1, 5, 1, 1)
        self.advanced_layout.setColumnStretch(1, 1)
        self.advanced_layout.setColumnStretch(2, 1)
        self.advanced_layout.setColumnStretch(5, 2)
        self.verticalLayout.addWidget(self.advanced_groupbox)
        self.files_excluded_label.setBuddy(self.files_excluded)
        self.compression_file_size_cut_off_label.setBuddy(self.compression_file_size_cut_off)
        self.additional_extensions_excluded_label.setBuddy(self.additional_extensions_excluded)
        self.additional_extensions_included_label.setBuddy(self.additional_extensions_included)

        self.retranslateUi(PageCompact)
        QtCore.QMetaObject.connectSlotsByName(PageCompact)
项目:barium    作者:barium-project    | 项目源码 | 文件源码
def setupUi(self):
        Form = self
        Form.setObjectName(_fromUtf8("Form"))
        Form.resize(1200, 140)
        self.frame = QtGui.QFrame(Form)
        self.frame.setGeometry(QtCore.QRect(10, 10, 1181, 121))
        self.frame.setFrameShape(QtGui.QFrame.Box)
        self.frame.setFrameShadow(QtGui.QFrame.Raised)
        self.frame.setObjectName(_fromUtf8("frame"))
        self.label = QtGui.QLabel(self.frame)
        self.label.setGeometry(QtCore.QRect(10, 10, 171, 21))
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(75)
        self.label.setFont(font)
        self.label.setObjectName(_fromUtf8("label"))
        self.autoconnect_button = QtGui.QPushButton(self.frame)
        self.autoconnect_button.setGeometry(QtCore.QRect(420, 40, 371, 71))
        self.autoconnect_button.setCheckable(False)
        self.autoconnect_button.setObjectName(_fromUtf8("autoconnect_button"))
        self.frame_2 = QtGui.QFrame(self.frame)
        self.frame_2.setGeometry(QtCore.QRect(10, 40, 401, 71))
        self.frame_2.setFrameShape(QtGui.QFrame.Panel)
        self.frame_2.setFrameShadow(QtGui.QFrame.Raised)
        self.frame_2.setObjectName(_fromUtf8("frame_2"))
        self.label_2 = QtGui.QLabel(self.frame_2)
        self.label_2.setGeometry(QtCore.QRect(10, 40, 171, 21))
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.label_3 = QtGui.QLabel(self.frame_2)
        self.label_3.setGeometry(QtCore.QRect(10, 10, 151, 21))
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self.host_name_text = QtGui.QComboBox(self.frame_2)
        self.host_name_text.setGeometry(QtCore.QRect(180, 10, 211, 22))
        self.host_name_text.setEditable(True)
        self.host_name_text.setObjectName(_fromUtf8("host_name_text"))
        self.host_name_text.addItem(_fromUtf8(""))
        self.host_name_text.addItem(_fromUtf8(""))
        self.host_name_text.addItem(_fromUtf8(""))
        self.host_name_text.addItem(_fromUtf8(""))
        self.lc_power_supply_id_spinbox = QtGui.QSpinBox(self.frame_2)
        self.lc_power_supply_id_spinbox.setGeometry(QtCore.QRect(180, 40, 42, 22))
        self.lc_power_supply_id_spinbox.setToolTip(_fromUtf8(""))
        self.lc_power_supply_id_spinbox.setObjectName(_fromUtf8("lc_power_supply_id_spinbox"))
        self.lc_scalar_id_spinbox = QtGui.QSpinBox(self.frame_2)
        self.lc_scalar_id_spinbox.setGeometry(QtCore.QRect(350, 40, 42, 22))
        self.lc_scalar_id_spinbox.setObjectName(_fromUtf8("lc_scalar_id_spinbox"))
        self.label_4 = QtGui.QLabel(self.frame_2)
        self.label_4.setGeometry(QtCore.QRect(230, 40, 121, 21))
        self.label_4.setObjectName(_fromUtf8("label_4"))

        self.retranslateUi()
        QtCore.QMetaObject.connectSlotsByName(Form)
项目:barium    作者:barium-project    | 项目源码 | 文件源码
def setupLayout(self):
        self.hor_max, self.ver_max =  yield self.server.get_detector_dimensions(None)
        self.hor_min, self.ver_min = [1, 1]
        cur_bin_hor, cur_bin_ver, cur_start_hor, cur_stop_hor, cur_start_ver, cur_stop_ver = yield self.server.getImageRegion(None)
        layout = QtGui.QGridLayout()
        default_button = QtGui.QPushButton("Default")
        start_label = QtGui.QLabel("Start")
        stop_label = QtGui.QLabel("Stop")
        bin_label = QtGui.QLabel("Bin")
        hor_label = QtGui.QLabel("Horizontal")
        ver_label = QtGui.QLabel("Vertical")
        self.start_hor = QtGui.QSpinBox()
        self.stop_hor = QtGui.QSpinBox()
        self.bin_hor = QtGui.QSpinBox()
        for button in [self.start_hor, self.stop_hor, self.bin_hor]:
            button.setRange(self.hor_min, self.hor_max)
        self.start_hor.setValue(cur_start_hor)
        self.stop_hor.setValue(cur_stop_hor)
        self.bin_hor.setValue(cur_bin_hor)
        self.start_ver = QtGui.QSpinBox()
        self.stop_ver = QtGui.QSpinBox()
        self.bin_ver = QtGui.QSpinBox()
        for button in [self.start_ver, self.stop_ver, self.bin_ver]:
            button.setRange(self.ver_min, self.ver_max)
        self.start_ver.setValue(cur_start_ver)
        self.stop_ver.setValue(cur_stop_ver)
        self.bin_ver.setValue(cur_bin_ver)
        layout.addWidget(default_button, 0, 0)
        layout.addWidget(start_label, 0, 1)
        layout.addWidget(stop_label, 0, 2)
        layout.addWidget(bin_label, 0, 3)
        layout.addWidget(hor_label, 1, 0)
        layout.addWidget(self.start_hor, 1, 1)
        layout.addWidget(self.stop_hor, 1, 2)
        layout.addWidget(self.bin_hor, 1, 3)
        layout.addWidget(ver_label, 2, 0)
        layout.addWidget(self.start_ver, 2, 1)
        layout.addWidget(self.stop_ver, 2, 2)
        layout.addWidget(self.bin_ver, 2, 3)
        submit_button = QtGui.QPushButton("Submit")
        layout.addWidget(submit_button, 3, 0, 1, 2)
        cancel_button = QtGui.QPushButton("Cancel")
        layout.addWidget(cancel_button, 3, 2, 1, 2)
        default_button.clicked.connect(self.on_default)
        submit_button.clicked.connect(self.on_submit)
        cancel_button.clicked.connect(self.on_cancel)
        self.setLayout(layout)
项目:fman    作者:bfaure    | 项目源码 | 文件源码
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)
项目:Smart-Grid-Analytics    作者:Merit-Research    | 项目源码 | 文件源码
def optionsWidget(self, parent):
        main_widget = QtGui.QWidget(parent)
        layout = QtGui.QFormLayout()

        self.options_label = QtGui.QLabel("Options:", main_widget)
        self.options_label.setFont(QtGui.QFont("Arial", 10, QtGui.QFont.Bold))
        #self.options_label.setAlignment(QtCore.Qt.AlignCenter)
        self.smooth_box = QtGui.QCheckBox("Smooth data (minutes):    ", main_widget)
        self.smooth_box.stateChanged.connect(self.smoothToggled)
        self.smooth_spin = QtGui.QSpinBox(main_widget)
        self.smooth_spin.setSingleStep(5)
        self.smooth_spin.setValue(0)
        self.smooth_spin.setDisabled(True)
        self.anomaly_box = QtGui.QCheckBox("Show anomalies (minutes)", main_widget)
        self.anomaly_box.stateChanged.connect(self.anomalyToggled)
        self.anomaly_spin = QtGui.QSpinBox(main_widget)
        self.smooth_spin.setSingleStep(5)
        self.anomaly_spin.setValue(0)
        self.anomaly_spin.setDisabled(True)
        #reset = QtGui.QPushButton("Reset", main_widget)
        #reset.clicked.connect(self.resetOptions)
        update = QtGui.QPushButton("Update Graph", main_widget)
        update.clicked.connect(self.updateGraph)

        layout.addRow(self.options_label)
        layout.addRow(self.smooth_box, self.smooth_spin)
        layout.addRow(self.anomaly_box, self.anomaly_spin)
        layout.addRow(update)

        main_widget.setLayout(layout)
        return main_widget

    #==================== HELPER FUNCTIONS ====================#
    # These functions do the actual work of the program.
    # Most are called in response to an event triggered by the main window, while
    # others are helper functions which perform a simple task.

    # Return true if the given filename is valid, false otherwise
项目:Semi-automatic-Annotation    作者:Luoyadan    | 项目源码 | 文件源码
def __init__(self, typeList, curType, curID, parent = None):
        super(modifyTypeID_Dialog, self).__init__(parent)

        self.select_type = typeList[0]
        self.select_ID = curID 

        Vlayout = QtGui.QVBoxLayout(self)

        # widget for editing the date
        self.cb_label = QtGui.QLabel()
        self.cb_label.setText("LaneLine Type: ")
        self.sp_label = QtGui.QLabel()
        self.sp_label.setText("LaneLine ID: ")

        self.cb = QtGui.QComboBox()
        self.cb.addItems(typeList)
        self.cb.setCurrentIndex(typeList.index(curType))
        self.cb.currentIndexChanged.connect(self.type_change)

        self.sp = QtGui.QSpinBox()
        self.sp.setRange(-128, 127)
        self.sp.setValue(curID)
        self.sp.valueChanged.connect(self.ID_change)

        # add widgets to layout
        Hlayout1 = QtGui.QHBoxLayout(self)
        Hlayout1.addWidget(self.cb_label)
        Hlayout1.addWidget(self.sp_label)
        Vlayout.addLayout(Hlayout1)

        Hlayout2 = QtGui.QHBoxLayout(self)
        Hlayout2.addWidget(self.cb)
        Hlayout2.addWidget(self.sp)
        Vlayout.addLayout(Hlayout2)

        # OK and Cancel buttons
        buttons = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel,
            Qt.Horizontal, self)
        buttons.accepted.connect(self.accept)
        buttons.rejected.connect(self.reject)
        Vlayout.addWidget(buttons)
项目:PH5    作者:PIC-IRIS    | 项目源码 | 文件源码
def __init__ (self, settings, parent = None) :
        super (SetupDialog, self).__init__ (parent)
        self.setAttribute (QtCore.Qt.WA_DeleteOnClose)

        #outfileNameLabel = QtGui.QLabel ("Output File")
        #self.outfileName = QtGui.QLineEdit ()
        #outfileNameLabel.setBuddy (self.outfileName)

        outfileFormatLabel = QtGui.QLabel ("Output Format")
        self.outfileFormat = QtGui.QComboBox ()
        outfileFormatLabel.setBuddy(self.outfileFormat)
        self.outfileFormat.addItems(["kef",])
        self.outfileFormat.setCurrentIndex (self.outfileFormat.findText (settings['outFormat']))

        fieldSeparatorLabel = QtGui.QLabel ("Column Separator")
        self.fieldSeparator = QtGui.QComboBox ()
        fieldSeparatorLabel.setBuddy (self.fieldSeparator)
        self.fieldSeparator.addItems (["comma", "semi-colon", "colon", "tab", "space"])
        self.fieldSeparator.setCurrentIndex (self.fieldSeparator.findText (settings['colSep']))

        skipLinesLabel = QtGui.QLabel ("Skip Lines")
        self.skipLines = QtGui.QSpinBox ()
        skipLinesLabel.setBuddy (self.skipLines)
        self.skipLines.setRange (0, 12)
        self.skipLines.setValue (settings['linesSkip'])

        viewLinesLabel = QtGui.QLabel ("View Lines")
        self.viewLines = QtGui.QSpinBox ()
        viewLinesLabel.setBuddy (self.viewLines)
        self.viewLines.setRange (1, 60)
        self.viewLines.setValue (settings['linesView'])


        self.settings = settings

        buttonBox = QtGui.QDialogButtonBox (QtGui.QDialogButtonBox.Apply |
                                            QtGui.QDialogButtonBox.Close)

        grid = QtGui.QGridLayout ()
        #grid.addWidget (outfileNameLabel, 0, 0); grid.addWidget (self.outfileName, 0, 1)
        grid.addWidget (outfileFormatLabel, 0, 0); grid.addWidget (self.outfileFormat, 0, 1)
        grid.addWidget (fieldSeparatorLabel, 1, 0); grid.addWidget (self.fieldSeparator, 1, 1)
        grid.addWidget (skipLinesLabel, 2, 0); grid.addWidget (self.skipLines, 2, 1)
        grid.addWidget (viewLinesLabel, 3, 0); grid.addWidget (self.viewLines, 3, 1)

        grid.addWidget (buttonBox, 4, 0, 2, -1)
        self.setLayout (grid)

        self.connect (buttonBox.button (QtGui.QDialogButtonBox.Apply),
                      QtCore.SIGNAL ("clicked ()"), self.apply)

        self.connect (buttonBox, QtCore.SIGNAL ("rejected ()"),
                      self, QtCore.SLOT ("reject ()"))