Python PyQt5.QtWidgets.QDoubleSpinBox() Examples

The following are 20 code examples of PyQt5.QtWidgets.QDoubleSpinBox(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PyQt5.QtWidgets , or try the search function .
Example #1
Source File: define_channel.py    From asammdf with GNU Lesser General Public License v3.0 6 votes vote down vote up
def op2_constant_changed(self, index):
        if self.op2_type.currentText() == "int":
            if self.op2_value is not None:
                self.op2_value.setParent(None)
                self.op2_value = None
            self.op2_value = QtWidgets.QSpinBox()
            self.op2_value.setRange(-2147483648, 2147483647)
            self.gridLayout.addWidget(self.op2_value, 2, 3)
        else:
            if self.op2_value is not None:
                self.op2_value.setParent(None)
                self.op2_value = None
            self.op2_value = QtWidgets.QDoubleSpinBox()
            self.op2_value.setDecimals(6)
            self.op2_value.setRange(-(2 ** 64), 2 ** 64 - 1)
            self.gridLayout.addWidget(self.op2_value, 2, 3) 
Example #2
Source File: main_gui.py    From simnibs with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self):
        #self.position_struc = sim_struct.POSITION()
        self.p1 = []
        self.p2 = []
        #self.ogl_object = None
        #self.electrode.definition = 'plane'
        self.didt_box = QtWidgets.QDoubleSpinBox()
        self.didt_box.setSuffix("x10e6 A/s")
        self.didt_box.setMinimum(0)
        self.didt_box.setMaximum(200)
        self.didt_box.setSingleStep(0.5)
        self.didt_box.setValue(1)

        self.dist_box = QtWidgets.QDoubleSpinBox()
        self.dist_box.setSuffix("mm")
        self.dist_box.setMinimum(0.)
        self.dist_box.setMaximum(200)
        self.dist_box.setSingleStep(1)
        self.dist_box.setValue(4)

        self.position_item = QtWidgets.QTableWidgetItem('')
        self.position_item.setFlags(self.position_item.flags() ^ QtCore.Qt.ItemIsEditable)

        self.name_item = QtWidgets.QTableWidgetItem('') 
Example #3
Source File: define_channel.py    From asammdf with GNU Lesser General Public License v3.0 6 votes vote down vote up
def op1_constant_changed(self, index):
        if self.op1_type.currentText() == "int":
            if self.op1_value is not None:
                self.op1_value.setParent(None)
                self.op1_value = None
            self.op1_value = QtWidgets.QSpinBox()
            self.op1_value.setRange(-2147483648, 2147483647)
            self.gridLayout.addWidget(self.op1_value, 0, 3)
        else:
            if self.op1_value is not None:
                self.op1_value.setParent(None)
                self.op1_value = None
            self.op1_value = QtWidgets.QDoubleSpinBox()
            self.op1_value.setDecimals(6)
            self.op1_value.setRange(-(2 ** 64), 2 ** 64 - 1)
            self.gridLayout.addWidget(self.op1_value, 0, 3) 
Example #4
Source File: range_editor.py    From asammdf with GNU Lesser General Public License v3.0 6 votes vote down vote up
def cell_pressed(self, row, column, range=(0, 0), color="#000000"):

        for col in (0, 1):
            box = QtWidgets.QDoubleSpinBox(self.table)
            box.setSuffix(f" {self.unit}")
            box.setRange(-(10 ** 10), 10 ** 10)
            box.setDecimals(6)
            box.setValue(range[col])

            self.table.setCellWidget(row, col, box)

        button = QtWidgets.QPushButton("", self.table)
        button.setStyleSheet(f"background-color: {color};")
        self.table.setCellWidget(row, 2, button)
        button.clicked.connect(partial(self.select_color, button=button))

        button = QtWidgets.QPushButton("Delete", self.table)
        self.table.setCellWidget(row, 3, button)
        button.clicked.connect(partial(self.delete_row, row=row)) 
Example #5
Source File: average3.py    From picasso with MIT License 6 votes vote down vote up
def __init__(self, window):
        super().__init__(window)
        self.window = window
        self.setWindowTitle("Parameters")
        self.setModal(False)
        grid = QtWidgets.QGridLayout(self)

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

        self.iterations = QtWidgets.QSpinBox()
        self.iterations.setRange(1, 1)
        self.iterations.setValue(1) 
Example #6
Source File: average.py    From picasso with MIT License 6 votes vote down vote up
def __init__(self, window):
        super().__init__(window)
        self.window = window
        self.setWindowTitle("Parameters")
        self.setModal(False)
        grid = QtWidgets.QGridLayout(self)

        grid.addWidget(QtWidgets.QLabel("Oversampling:"), 0, 0)
        self.oversampling = QtWidgets.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(QtWidgets.QLabel("Iterations:"), 1, 0)
        self.iterations = QtWidgets.QSpinBox()
        self.iterations.setRange(0, 1e7)
        self.iterations.setValue(10)
        grid.addWidget(self.iterations, 1, 1) 
Example #7
Source File: model_wizard.py    From CvStudio with MIT License 6 votes vote down vote up
def __init__(self, parent=None):
        super(BaseModelSelectionPage, self).__init__(parent)
        self.setTitle("Base Model Selection")
        self._layout = QVBoxLayout(self)
        _model_section_widget = QWidget()
        _section_layout = QFormLayout(_model_section_widget)
        self.ds_picker = DatasetPicker()
        self.arch_picker = ModelPicker()
        self._num_of_epochs_picker = QSpinBox()
        self._num_of_workers_picker = QSpinBox()
        self._batch_size_picker = QSpinBox()
        self._learning_rate_picker = QDoubleSpinBox()
        self._learning_momentum_picker = QDoubleSpinBox()
        self._learning_weight_decay_picker = QDoubleSpinBox()
        self._learning_weight_decay_picker = QDoubleSpinBox()
        _section_layout.addRow(self.tr("Dataset: "), self.ds_picker)
        _section_layout.addRow(self.tr("Architecture: "), self.arch_picker)
        _section_layout.addRow(self.tr("Number of epochs: "), self._num_of_epochs_picker)
        _section_layout.addRow(self.tr("Number of workers: "), self._num_of_workers_picker)
        _section_layout.addRow(self.tr("Batch Size: "), self._batch_size_picker)
        _section_layout.addRow(self.tr("Learning rate: "), self._learning_rate_picker)
        self._layout.addWidget(GUIUtilities.wrap_with_groupbox(_model_section_widget, "Model Details")) 
Example #8
Source File: VSWRAnalysis.py    From nanovna-saver with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, app):
        super().__init__(app)

        self._widget = QtWidgets.QWidget()
        self.layout = QtWidgets.QFormLayout()
        self._widget.setLayout(self.layout)

        self.input_vswr_limit = QtWidgets.QDoubleSpinBox()
        self.input_vswr_limit.setValue(self.vswr_limit_value)
        self.input_vswr_limit.setSingleStep(0.1)
        self.input_vswr_limit.setMinimum(1)
        self.input_vswr_limit.setMaximum(25)
        self.input_vswr_limit.setDecimals(2)

        self.checkbox_move_marker = QtWidgets.QCheckBox()
        self.layout.addRow(QtWidgets.QLabel("<b>Settings</b>"))
        self.layout.addRow("VSWR limit", self.input_vswr_limit)
        self.layout.addRow(VSWRAnalysis.QHLine())

        self.results_label = QtWidgets.QLabel("<b>Results</b>")
        self.layout.addRow(self.results_label) 
Example #9
Source File: fade_edit.py    From linux-show-player with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, *args, mode=FadeComboBox.Mode.FadeOut, **kwargs):
        super().__init__(*args, **kwargs)
        self.setLayout(QGridLayout())

        self.fadeDurationSpin = QDoubleSpinBox(self)
        self.fadeDurationSpin.setRange(0, 3600)
        self.layout().addWidget(self.fadeDurationSpin, 0, 0)

        self.fadeDurationLabel = QLabel(self)
        self.fadeDurationLabel.setAlignment(Qt.AlignCenter)
        self.layout().addWidget(self.fadeDurationLabel, 0, 1)

        self.fadeTypeCombo = FadeComboBox(self, mode=mode)
        self.layout().addWidget(self.fadeTypeCombo, 1, 0)

        self.fadeTypeLabel = QLabel(self)
        self.fadeTypeLabel.setAlignment(Qt.AlignCenter)
        self.layout().addWidget(self.fadeTypeLabel, 1, 1)

        self.retranslateUi() 
Example #10
Source File: define_channel.py    From asammdf with GNU Lesser General Public License v3.0 5 votes vote down vote up
def function_changed(self, index):
        function = self.function.currentText()
        if function in [
            "arccos",
            "arcsin",
            "arctan",
            "cos",
            "deg2rad",
            "degrees",
            "rad2deg",
            "radians",
            "sin",
            "tan",
            "floor",
            "rint",
            "fix",
            "trunc",
            "cumprod",
            "cumsum",
            "diff",
            "exp",
            "log10",
            "log",
            "log2",
            "absolute",
            "cbrt",
            "sqrt",
            "square",
        ]:
            if self.func_arg1 is not None:
                self.func_arg1.setParent(None)
                self.func_arg1 = None
                self.func_arg2.setParent(None)
                self.func_arg2 = None
        else:
            if self.func_arg1 is None:
                self.func_arg1 = QtWidgets.QDoubleSpinBox()
                self.func_arg1.setDecimals(6)
                self.func_arg1.setRange(-(2 ** 64), 2 ** 64 - 1)
                self.gridLayout_2.addWidget(self.func_arg1, 0, 2)

                self.func_arg2 = QtWidgets.QDoubleSpinBox()
                self.func_arg2.setDecimals(6)
                self.func_arg2.setRange(-(2 ** 64), 2 ** 64 - 1)
                self.gridLayout_2.addWidget(self.func_arg2, 0, 3)

            if function == "round":
                self.func_arg2.setEnabled(False)
            else:
                self.func_arg2.setEnabled(True) 
Example #11
Source File: demoSpinBox.py    From Qt5-Python-GUI-Programming-Cookbook with MIT License 5 votes vote down vote up
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(580, 162)
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(16, 30, 81, 20))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.label.setFont(font)
        self.label.setObjectName("label")
        self.lineEditBookPrice = QtWidgets.QLineEdit(Dialog)
        self.lineEditBookPrice.setGeometry(QtCore.QRect(120, 30, 113, 20))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.lineEditBookPrice.setFont(font)
        self.lineEditBookPrice.setObjectName("lineEditBookPrice")
        self.spinBoxBookQty = QtWidgets.QSpinBox(Dialog)
        self.spinBoxBookQty.setGeometry(QtCore.QRect(290, 30, 42, 22))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.spinBoxBookQty.setFont(font)
        self.spinBoxBookQty.setObjectName("spinBoxBookQty")
        self.lineEditBookAmount = QtWidgets.QLineEdit(Dialog)
        self.lineEditBookAmount.setGeometry(QtCore.QRect(390, 30, 113, 20))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.lineEditBookAmount.setFont(font)
        self.lineEditBookAmount.setObjectName("lineEditBookAmount")
        self.label_2 = QtWidgets.QLabel(Dialog)
        self.label_2.setGeometry(QtCore.QRect(10, 70, 81, 21))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.label_2.setFont(font)
        self.label_2.setObjectName("label_2")
        self.lineEditSugarPrice = QtWidgets.QLineEdit(Dialog)
        self.lineEditSugarPrice.setGeometry(QtCore.QRect(120, 70, 113, 20))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.lineEditSugarPrice.setFont(font)
        self.lineEditSugarPrice.setObjectName("lineEditSugarPrice")
        self.doubleSpinBoxSugarWeight = QtWidgets.QDoubleSpinBox(Dialog)
        self.doubleSpinBoxSugarWeight.setGeometry(QtCore.QRect(290, 70, 62, 22))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.doubleSpinBoxSugarWeight.setFont(font)
        self.doubleSpinBoxSugarWeight.setObjectName("doubleSpinBoxSugarWeight")
        self.lineEditSugarAmount = QtWidgets.QLineEdit(Dialog)
        self.lineEditSugarAmount.setGeometry(QtCore.QRect(390, 70, 113, 20))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.lineEditSugarAmount.setFont(font)
        self.lineEditSugarAmount.setObjectName("lineEditSugarAmount")
        self.labelTotalAmount = QtWidgets.QLabel(Dialog)
        self.labelTotalAmount.setGeometry(QtCore.QRect(396, 120, 121, 20))
        font = QtGui.QFont()
        font.setPointSize(12)
        self.labelTotalAmount.setFont(font)
        self.labelTotalAmount.setObjectName("labelTotalAmount")

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
Example #12
Source File: MainWindow.py    From 3d-nii-visualizer with MIT License 5 votes vote down vote up
def create_new_picker(max_value, min_value, step, picker_value, value_changed_func):
        if isinstance(max_value, int):
            picker = QtWidgets.QSpinBox()
        else:
            picker = QtWidgets.QDoubleSpinBox()

        picker.setMaximum(max_value)
        picker.setMinimum(min_value)
        picker.setSingleStep(step)
        picker.setValue(picker_value)
        picker.valueChanged.connect(value_changed_func)
        return picker 
Example #13
Source File: steps.py    From visma with GNU General Public License v3.0 5 votes vote down vote up
def stepsPref(workspace):

    workspace.sizeChangeText = QLabel("Steps font size: " + str(round(workspace.stepsFontSize, 1)) + "x")
    workspace.sizeChangeBox = QDoubleSpinBox()
    workspace.sizeChangeBox.setFixedSize(200, 30)
    workspace.sizeChangeBox.setRange(0.1, 10)
    workspace.sizeChangeBox.setValue(1)
    workspace.sizeChangeBox.setSingleStep(0.1)
    workspace.sizeChangeBox.setSuffix('x')
    workspace.sizeChangeBox.valueChanged.connect(lambda: sizeChange(workspace))
    return workspace.sizeChangeText, workspace.sizeChangeBox 
Example #14
Source File: OptionsWidget.py    From pyweed with GNU Lesser General Public License v3.0 5 votes vote down vote up
def setInputValue(self, key, value):
        """
        Set the input value based on a string from the options
        """
        one_input = self.inputs.get(key)
        if one_input:
            if isinstance(one_input, QtWidgets.QDateTimeEdit):
                # Ugh, complicated conversion from UTCDateTime
                dt = QtCore.QDateTime.fromString(value, QtCore.Qt.ISODate)
                one_input.setDateTime(dt)
            elif isinstance(one_input, QtWidgets.QDoubleSpinBox):
                # Float value
                one_input.setValue(float(value))
            elif isinstance(one_input, QtWidgets.QComboBox):
                # Combo box
                index = one_input.findText(value)
                if index > -1:
                    one_input.setCurrentIndex(index)
            elif isinstance(one_input, QtWidgets.QLineEdit):
                # Text input
                one_input.setText(value)
            elif isinstance(one_input, QtWidgets.QAbstractButton):
                # Radio/checkbox button
                one_input.setChecked(strtobool(str(value)))
            else:
                raise Exception("Don't know how to set an input for %s (%s)" % (key, one_input)) 
Example #15
Source File: main_gui.py    From simnibs with GNU General Public License v3.0 5 votes vote down vote up
def set_direction_layout(self):
        box_text = "Direction Reference"
        self.direction_box = QtWidgets.QGroupBox(box_text)

        load_ref = self.reference is not None and len(self.reference) == 3

        Layout = QtWidgets.QGridLayout()

        self.check = QtWidgets.QCheckBox('Define Reference Coordinates')

        Layout.addWidget(self.check, 0,0,1,3)

        self.label_x2 = QtWidgets.QLabel("X:")
        Layout.addWidget(self.label_x2,1,1)
        self.ref_x = QtWidgets.QDoubleSpinBox()
        self.ref_x.setRange(-1000, 1000)
        if load_ref: self.ref_x.setValue(self.reference[0])
        #self.ref_x.valueChanged.connect(self.update_stimulator)
        Layout.addWidget(self.ref_x,2,1)

        self.label_y2 = QtWidgets.QLabel("Y:")
        Layout.addWidget(self.label_y2,1,2)
        self.ref_y = QtWidgets.QDoubleSpinBox()
        self.ref_y.setRange(-1000, 1000)
        if load_ref: self.ref_y.setValue(self.reference[1])
        #self.ref_y.valueChanged.connect(self.update_stimulator)
        Layout.addWidget(self.ref_y,2,2)

        self.label_z2 = QtWidgets.QLabel("Z:")
        Layout.addWidget(self.label_z2,1,3)
        self.ref_z = QtWidgets.QDoubleSpinBox()
        self.ref_z.setRange(-1000, 1000)
        if load_ref: self.ref_z.setValue(self.reference[2])
        #self.ref_z.valueChanged.connect(self.update_stimulator)
        Layout.addWidget(self.ref_z,2,3)

        self.direction_box.setLayout(Layout)

    #Returns the positions 
Example #16
Source File: main_gui.py    From simnibs with GNU General Public License v3.0 5 votes vote down vote up
def set_position_layout(self):
        self.position_box = QtWidgets.QGroupBox("Position")
        load_pos = self.centre is not None and len(self.centre) == 3

        Layout = QtWidgets.QGridLayout()
        self.eeg_pos_selector = QtWidgets.QComboBox()
        self.eeg_pos_selector.activated.connect(self.select_eeg_pos)
        Layout.addWidget(self.eeg_pos_selector, 1,0)
        self.eeg_pos_selector.setEnabled(False)

        self.label_x = QtWidgets.QLabel("X:")
        Layout.addWidget(self.label_x,0,1)
        self.pos_x = QtWidgets.QDoubleSpinBox()
        self.pos_x.setRange(-1000,1000)
        if load_pos: self.pos_x.setValue(self.centre[0])
        #self.pos_x.valueChanged.connect(self.update_center)
        Layout.addWidget(self.pos_x,1,1)

        self.label_y = QtWidgets.QLabel("Y:")
        Layout.addWidget(self.label_y,0,2)
        self.pos_y = QtWidgets.QDoubleSpinBox()
        self.pos_y.setRange(-1000,1000)
        if load_pos: self.pos_y.setValue(self.centre[1])
       # self.pos_y.valueChanged.connect(self.update_center)
        Layout.addWidget(self.pos_y,1,2)

        self.label_z = QtWidgets.QLabel("Z:")
        Layout.addWidget(self.label_z,0,3)
        self.pos_z = QtWidgets.QDoubleSpinBox()
        self.pos_z.setRange(-1000,1000)
        if load_pos: self.pos_z.setValue(self.centre[2])
        #self.pos_z.valueChanged.connect(self.update_center)
        Layout.addWidget(self.pos_z,1,3)

        self.position_box.setLayout(Layout) 
Example #17
Source File: main_gui.py    From simnibs with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        self.electrode = sim_struct.ELECTRODE()
        #self.electrode.definition = 'plane'
        self.centre = None
        self.pos_ydir = None
        self.current_box = QtWidgets.QDoubleSpinBox()
        self.current_box.setDecimals(3)
        self.current_box.setSuffix("mA")
        self.current_box.setMinimum(-10)
        self.current_box.setMaximum(10)
        self.current_box.setSingleStep(0.25)
        self.current = self.current_box.value()

        self.position_item = QtWidgets.QTableWidgetItem('')
        self.position_item.setFlags(self.position_item.flags() ^ QtCore.Qt.ItemIsEditable)

        self.shape_size_item = QtWidgets.QTableWidgetItem('')
        self.shape_size_item.setFlags(self.shape_size_item.flags() ^ QtCore.Qt.ItemIsEditable)

        #self.color_item = QtWidgets.QTableWidgetItem('')

        self.name_item = QtWidgets.QTableWidgetItem('')

        self.transf_matrix = []


#Defies a row in the table on the TMS poslist tab 
Example #18
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 #19
Source File: main_gui.py    From simnibs with GNU General Public License v3.0 4 votes vote down vote up
def setTensorThings(self):
        tensorBox = QtWidgets.QGroupBox('Brain Anisotropy')
        layout = QtWidgets.QVBoxLayout()

        cond_type_CBox = QtWidgets.QComboBox()
        cond_type_CBox.addItems(['scalar','volume normalized','direct mapping','mean conductivity'])
        cond_type_CBox.currentIndexChanged.connect(self.changeCondType)
        if self.simulist.anisotropy_type == 'vn':
            cond_type_CBox.setCurrentIndex(1)
        elif self.simulist.anisotropy_type == 'dir':
            cond_type_CBox.setCurrentIndex(2)
        elif self.simulist.anisotropy_type == 'mc':
            cond_type_CBox.setCurrentIndex(3)
        #layout.addWidget(cond_type_CBox, 0, QtCore.Qt.Alignment(1))
        layout.addWidget(cond_type_CBox, 0)

        layout.addWidget(QtWidgets.QLabel('Maximum ratio between eigenvalues:'), 1)

        aniso_maxratio_sbox = QtWidgets.QDoubleSpinBox()
        aniso_maxratio_sbox.setSingleStep(0.1)
        aniso_maxratio_sbox.setDecimals(2)
        aniso_maxratio_sbox.setMinimum(1)
        aniso_maxratio_sbox.setValue(self.simulist.aniso_maxratio)
        aniso_maxratio_sbox.valueChanged.connect(self.changeCondType)

        layout.addWidget(aniso_maxratio_sbox, 0)

        layout.addWidget(QtWidgets.QLabel('Maximum eigenvalue:'), 1)

        aniso_maxcond_sbox = QtWidgets.QDoubleSpinBox()
        aniso_maxcond_sbox.setSingleStep(0.1)
        aniso_maxcond_sbox.setDecimals(2)
        aniso_maxcond_sbox.setMinimum(1e-2)
        aniso_maxcond_sbox.setValue(self.simulist.aniso_maxcond)
        aniso_maxcond_sbox.valueChanged.connect(self.changeCondType)

        layout.addWidget(aniso_maxcond_sbox, 0)
 
        tensorBox.setLayout(layout)
        tensorBox.cond_type_CBox = cond_type_CBox
        tensorBox.aniso_maxratio_sbox = aniso_maxratio_sbox
        tensorBox.aniso_maxcond_sbox = aniso_maxcond_sbox

        return tensorBox 
Example #20
Source File: electrodeGUI.py    From simnibs with GNU General Public License v3.0 4 votes vote down vote up
def set_shape_size_layout(self):

        self.shape_size = QtWidgets.QGroupBox("Shape and Size")
        layout = QtWidgets.QGridLayout()

        self.shape_selector = QtWidgets.QComboBox()
        self.shape_selector.addItem("Rectangular")
        self.shape_selector.addItem("Elliptical")
        if self.electrode_struct.shape == 'ellipse':
            self.shape_selector.setCurrentIndex(1)
        self.shape_selector.activated.connect(self.update_electrode)

        layout.addWidget(self.shape_selector,0,0)

        self.dim_x = QtWidgets.QDoubleSpinBox()
        if self.electrode_struct.dimensions is not None:
             self.dim_x.setValue(self.electrode_struct.dimensions[0]/10.0)
        else:
            self.dim_x.setValue(5.0)
        self.dim_x.setSuffix(" cm")
        self.dim_x.setSingleStep(0.5)
        self.dim_x.setMinimum(0.5)

        layout.addWidget(self.dim_x, 0, 1)
        self.dim_x.valueChanged.connect(self.update_electrode)


        self.dim_y = QtWidgets.QDoubleSpinBox()
        if self.electrode_struct.dimensions is not None:
            self.dim_y.setValue(self.electrode_struct.dimensions[1]/10)
        else:
            self.dim_y.setValue(5.0)
        self.dim_y.setSuffix(" cm")
        self.dim_y.setSingleStep(0.5)
        self.dim_y.setMinimum(0.5)

        layout.addWidget(self.dim_y, 0, 2)
        self.dim_y.valueChanged.connect(self.update_electrode)


        self.shape_size.setLayout(layout)

    #Type and thickness box