Beispiel #1
0
 def __init__(self, name="", parent_dataset=None, ax=None):
     """
     **Constructor**
     
     Keyword Arguments:
         - name {[type]} -- [description] (default: {""})
         - parent_dataset {[type]} -- [description] (default: {None})
         - ax {[type]} -- [description] (default: {None})
     """
     super().__init__(name, parent_dataset, ax)
     # add widgets specific to the theory
     tb = QToolBar()
     tb.setIconSize(QSize(24, 24))
     self.linkMeGeaction = tb.addAction(
         QIcon(':/Icon8/Images/new_icons/linkGeMe.png'), 'Link Me-Ge')
     self.linkMeGeaction.setCheckable(True)
     self.linkMeGeaction.setChecked(False)
     lbl = QLabel("<P><b>rho</b> (g/cm<sup>3</sup>)</P></br>", self)
     tb.addWidget(lbl)
     self.txtrho = QLineEdit("%.4g"%self.parameters["rho0"].value)
     self.txtrho.setReadOnly(True)
     self.txtrho.setDisabled(True)
     dvalidator = QDoubleValidator()  #prevent letters etc.
     dvalidator.setBottom(0)  #minimum allowed value
     dvalidator.setTop(10)  #maximum allowed value
     self.txtrho.setValidator(dvalidator)
     tb.addWidget(self.txtrho)
     self.thToolsLayout.insertWidget(0, tb)
     
     connection_id = self.linkMeGeaction.triggered.connect(self.linkMeGeaction_change)
     connection_id = self.txtrho.textEdited.connect(self.handle_txtrho_edited)
    def set_validator(self):

        doubleValitor = QDoubleValidator()
        doubleValitor.setBottom(0)
        doubleValitor.setDecimals(2)
        doubleValitor.setNotation(QDoubleValidator.StandardNotation)
        self.planamount.setValidator(doubleValitor)
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._cx = 0
        self._cy = 0
        self._prominence = 200
        self._distance = 10
        self._min_count = 500

        self.cx_le = SmartLineEdit(str(self._cx))
        self.cx_le.setValidator(QDoubleValidator())
        self.cy_le = SmartLineEdit(str(self._cy))
        self.cy_le.setValidator(QDoubleValidator())
        self.prominence_le = SmartLineEdit(str(self._prominence))
        validator = QDoubleValidator()
        validator.setBottom(0)
        self.prominence_le.setValidator(validator)
        self.distance_le = SmartLineEdit(str(self._distance))
        self.distance_le.setValidator(QIntValidator(1, 99999))
        self.min_count_le = SmartLineEdit(str(self._min_count))
        self.min_count_le.setValidator(QIntValidator(1, 99999))
        self.detect_btn = QPushButton("Detect")

        pixel1 = config["PIXEL_SIZE"]  # y
        pixel2 = pixel1  # x
        self._finder = ConcentricRingsFinder(pixel2, pixel1)

        self.initUI()
        self.initConnections()
Beispiel #4
0
    def createFormGroupBox(self, numbobbins, bobmax, bobmin, bobbinmax):
        """Create a form to set the new values of the BoB binning parameters"""
        self.formGroupBox = QGroupBox("Edit BoB Binning Settings")
        layout = QFormLayout()

        val_double = QDoubleValidator()
        val_double.setBottom(1)  #set smalled double allowed in the form
        val_int = QIntValidator()
        val_int.setBottom(0)  #set smalled int allowed in the form
        val_int.setTop(rch.pb_global_const.maxbobbins
                       )  #set largest int allowed in the form

        self.e1 = QLineEdit()
        self.e1.setValidator(val_int)
        self.e1.setMaxLength(6)
        self.e1.setText("%d" % numbobbins)

        self.e2 = QLineEdit()
        self.e2.setValidator(val_double)
        self.e2.setText("%.2e" % bobmax)

        self.e3 = QLineEdit()
        self.e3.setValidator(val_double)
        self.e3.setText("%.2e" % bobmin)

        self.e4 = QLineEdit()
        self.e4.setValidator(val_int)
        self.e4.setMaxLength(6)
        self.e4.setText("%d" % bobbinmax)

        layout.addRow(QLabel("Number of bins for Bob:"), self.e1)
        layout.addRow(QLabel("Maximum bin Mw (g/mol):"), self.e2)
        layout.addRow(QLabel("Minimum bin Mw (g/mol):"), self.e3)
        layout.addRow(QLabel("Maximum no. of polymers per bin:"), self.e4)
        self.formGroupBox.setLayout(layout)
Beispiel #5
0
    def __init__(self, parent=None):
        super(FileLoaderDialog, self).__init__(parent)
        self.setWindowTitle("Load Data")
        self.psf = ""
        self.dcd = ""
        production = 1

        grid = QGridLayout(self)

        buttonPsf = QPushButton("Topology")
        buttonPsf.clicked.connect(self.pick_psf)

        buttonDcd = QPushButton("Trajectory")
        buttonDcd.clicked.connect(self.pick_dcd)

        grid.addWidget(buttonPsf,0,0)
        grid.addWidget(buttonDcd,0,1)

        cutoffLabel = QLabel("distance cutoff: ")
        cutoffAngleLabel = QLabel("angle cutoff: ")
        cutoffHbondLabel = QLabel("acc-h cutoff: ")
        selection1Label = QLabel("selection 1: ")
        selection2Label = QLabel("selection 2: ")

        self.cutoffField = QLineEdit("5.0")
        posDoubleValidator = QDoubleValidator()
        posDoubleValidator.setBottom(0)
        self.cutoffField.setValidator(posDoubleValidator)
        self.cutoffAngleField = QLineEdit("120")
        self.cutoffAngleField.setValidator(posDoubleValidator)
        self.cutoffHbondField = QLineEdit("2.5")
        self.cutoffHbondField.setValidator(posDoubleValidator)

        if production:
            self.selection1Field = QLineEdit("")
            self.selection2Field = QLineEdit("")
        else:
            self.selection1Field = QLineEdit("segid RN11")
            self.selection2Field = QLineEdit("segid UBQ")

        grid.addWidget(cutoffLabel, 1, 0)
        grid.addWidget(cutoffAngleLabel, 2, 0)
        grid.addWidget(cutoffHbondLabel, 3, 0)
        grid.addWidget(selection1Label, 4, 0)
        grid.addWidget(selection2Label, 5, 0)

        grid.addWidget(self.cutoffField, 1, 1)
        grid.addWidget(self.cutoffAngleField, 2, 1)
        grid.addWidget(self.cutoffHbondField, 3, 1)
        grid.addWidget(self.selection1Field, 4, 1)
        grid.addWidget(self.selection2Field, 5, 1)

        # OK and Cancel buttons
        buttons = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel,
            Qt.Horizontal, self)
        buttons.accepted.connect(self.accept)
        buttons.rejected.connect(self.reject)
        grid.addWidget(buttons, 6, 0)
Beispiel #6
0
    def createFormGroupBox(self, parent_theory):
        """Create a form to set the new values of the parameters"""

        inner = QWidget()
        layout = QGridLayout()
        layout.setSpacing(10)

        vlayout = QVBoxLayout()
        qmessage = QLabel(
            '<p>Please check the values of monomer mass and Me used for each distribution in the mix.</p>\
<p>Note that BoB is not yet able to deal with mixtures of polymers with different Me.</p>'
        )
        qmessage.setWordWrap(True)
        vlayout.addWidget(qmessage)
        hline = QFrame()
        hline.setFrameShape(QFrame.HLine)
        hline.setFrameShadow(QFrame.Sunken)
        vlayout.addWidget(hline)
        layout.addLayout(vlayout, 0, 0, 1, -1)  #span all the columns

        layout.addWidget(QLabel('<b>App/Theory</b>'), 1, 1)
        layout.addWidget(QLabel('<b>Monomer Mass</b>'), 1, 2)
        label = QLabel('<b>M<sub>e</sub></b>')
        label.setMinimumWidth(
            100)  # prevent too small size of the QLineEdit when resizing
        layout.addWidget(label, 1, 3)

        self.lines = []
        dvalidator = QDoubleValidator()  #prevent letters etc.
        dvalidator.setBottom(0)  #minimum allowed value
        for i, dist in enumerate(
                parent_theory.dists):  #loop over the distributions in mix
            layout.addWidget(QLabel('<b>%d</b>' % (i + 1)), i + 2, 0)
            line = []

            line.append(QLabel(parent_theory.theory_names[i]))

            qline = QLineEdit()
            qline.setValidator(dvalidator)
            qline.setText("%.4g" % rch.react_dist[dist].contents.monmass)
            line.append(qline)

            qline = QLineEdit()
            qline.setValidator(dvalidator)
            qline.setText("%.4g" % rch.react_dist[dist].contents.M_e)
            line.append(qline)

            self.lines.append(line)  #save lines
            for j in range(3):
                layout.addWidget(self.lines[i][j], i + 2, j + 1)
        inner.setLayout(layout)

        #Scroll Area Properties
        self.scroll = QScrollArea()
        # self.scroll.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)
        self.scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
        self.scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
        self.scroll.setWidgetResizable(True)
        self.scroll.setWidget(inner)
Beispiel #7
0
 def set_validator(self):
     doubleValitor = QDoubleValidator()
     doubleValitor.setBottom(0)
     doubleValitor.setDecimals(2)
     doubleValitor.setNotation(QDoubleValidator.StandardNotation)
     self.lineEdit_width.setValidator(doubleValitor)
     self.lineEdit_height.setValidator(doubleValitor)
     self.lineEdit_pensize.setValidator(doubleValitor)
Beispiel #8
0
 def set_backamount_validator(self):
     doublevalidator = QDoubleValidator()
     try:
         max_float = decimal.Decimal(self.lineEdit_restamount.text())
         doublevalidator.setRange(0, max_float)
     except decimal.InvalidOperation:
         doublevalidator.setBottom(0)
     self.lineEdit_backamount.setValidator(doublevalidator)
 def set_validator(self):
     doubleValitor = QDoubleValidator()
     doubleValitor.setBottom(-1)
     doubleValitor.setDecimals(3)
     doubleValitor.setNotation(QDoubleValidator.StandardNotation)
     self.lineEdit_content.setValidator(doubleValitor)
     self.lineEdit_water.setValidator(doubleValitor)
     self.lineEdit_rdensity.setValidator(doubleValitor)
     self.lineEdit_impurity.setValidator(doubleValitor)
Beispiel #10
0
 def setup_validators(self):
     int_validator = QIntValidator()
     int_validator.setBottom(0)
     double_validator = QDoubleValidator()
     double_validator.setBottom(0.)
     self.tube_count_line.setValidator(int_validator)
     self.flowrate_line.setValidator(double_validator)
     self.value1_line.setValidator(double_validator)
     self.value2_line.setValidator(double_validator)
Beispiel #11
0
 def _createValidator(self):
     validator = QDoubleValidator(self.parent)
     if "min" in self.config:
         validator.setBottom(int(self.config["min"]))
     if "max" in self.config:
         validator.setTop(int(self.config["max"]))
     if "decimals" in self.config:
         validator.setDecimals(int(self.config["decimals"]))
     return validator
Beispiel #12
0
 def loadPositiveIntegerFloat(self, font, src, dst):
     value = getattr(font.info, src)
     if value is not None:
         value = str(value)
     else:
         value = ""
     setattr(self, dst + "Edit", QLineEdit(value, self))
     validator = QDoubleValidator(self)
     validator.setBottom(0)
     getattr(self, dst + "Edit").setValidator(validator)
Beispiel #13
0
    def set_restamount_validator(self):
        doublevalidator = QDoubleValidator()
        try:
            max_float = self.ori_detail['drawamount']
            pracamount = decimal.Decimal(self.lineEdit_pracamount.text())
            doublevalidator.setRange(0, max_float - pracamount)
        except (KeyError, decimal.InvalidOperation):
            doublevalidator.setBottom(0)

        self.lineEdit_restamount.setValidator(doublevalidator)
Beispiel #14
0
 def loadPositiveIntegerFloat(self, font, src, dst):
     value = getattr(font.info, src)
     if value is not None:
         value = str(value)
     else:
         value = ""
     setattr(self, dst + "Edit", QLineEdit(value, self))
     validator = QDoubleValidator(self)
     validator.setBottom(0)
     getattr(self, dst + "Edit").setValidator(validator)
Beispiel #15
0
 def set_validator(self):
     if self.element.attribute("NumbersOnly") != "1":
         return
     doubleValitor = QDoubleValidator()
     if is_float(self.element.attribute("Min")):
         doubleValitor.setBottom((self.element.attribute("Min")))
     if is_float(self.element.attribute("Max")):
         doubleValitor.setTop(float(self.element.attribute("Max")))
     # doubleValitor.setDecimals(2)
     doubleValitor.setNotation(QDoubleValidator.StandardNotation)
     self.setValidator(doubleValitor)
Beispiel #16
0
    def __init__(self, parent):
        super(AddCargoTypeDialog, self).__init__(parent)
        self.setupUi(self)

        double_val = QDoubleValidator(self)
        double_val.setBottom(0)
        double_val.setDecimals(2)
        self.price.setValidator(double_val)

        int_val = QIntValidator(self)
        int_val.setBottom(0)
        self.life.setValidator(int_val)
Beispiel #17
0
    def createWoundControlBox(self):
        self.woundControlBox = QGroupBox("Wound")

        checkBox = QCheckBox("Add Wound")
        checkBox.setTristate(False)
        checkBox.setChecked(False)

        layout = QVBoxLayout()

        self.woundArea = QLineEdit()

        horizbox = QHBoxLayout()

        geometryLine = QRadioButton("Line")
        geometryPolygon = QRadioButton("Polygon")
        geometryCircle = QRadioButton("Circle")
        geometryLine.setChecked(True)
        geometryLine.clicked.connect(self.setLine)
        geometryPolygon.clicked.connect(self.setPoly)
        geometryCircle.clicked.connect(self.setCircle)
        horizbox.addWidget(geometryLine, 0)
        horizbox.addWidget(geometryPolygon, 1)
        horizbox.addWidget(geometryCircle, 2)

        areaValidator = QDoubleValidator()
        areaValidator.setBottom(50.0)
        areaValidator.setTop(100000.0)
        self.woundArea.setValidator(areaValidator)
        self.woundArea.editingFinished.connect(self.toggleArea)

        # create wound angle editor widget
        self.angleEditor = QSlider(Qt.Horizontal)
        self.angleEditor.setMinimum(3)
        self.angleEditor.setMaximum(50)
        self.angleEditor.setSingleStep(1)
        self.angleEditor.setValue(1)
        self.angleEditor.setTickInterval(10)
        self.angleEditor.setTickPosition(QSlider.TicksBelow)
        self.angleEditor.sliderReleased.connect(self.toggleAngles)

        addWound = QPushButton('Add Wound')
        removeWound = QPushButton('Remove Wound')
        addWound.clicked.connect(self.setWoundTrue)
        removeWound.clicked.connect(self.setWoundFalse)

        self.cellGraphicsItems = list()

        layout.addWidget(self.woundArea, 0)
        layout.addLayout(horizbox)
        layout.addWidget(self.angleEditor, 1)
        layout.addWidget(addWound)
        layout.addWidget(removeWound)
        self.woundControlBox.setLayout(layout)
Beispiel #18
0
    def set_pracamount_validator(self):
        doublevalidator = QDoubleValidator()
        try:
            max_float = self.ori_detail['drawamount']
            doublevalidator.setRange(0, max_float)
        except KeyError:
            doublevalidator.setBottom(0)
        self.lineEdit_pracamount.setValidator(doublevalidator)

        doubleValitor = QDoubleValidator()
        doubleValitor.setRange(-360, 360)
        doubleValitor.setDecimals(2)
        doubleValitor.setNotation(QDoubleValidator.StandardNotation)
Beispiel #19
0
    def __init__(self, parent_theory):
        super().__init__(parent_theory)
        self.parent_theory = parent_theory
        self.NUMCAT_MAX = parent_theory.NUMCAT_MAX  #maximum number of catalysts
        self.make_lines(parent_theory.pvalues)
        self.createFormGroupBox(parent_theory.numcat)
        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                     | QDialogButtonBox.Cancel)
        buttonBox.accepted.connect(self.accept_)
        buttonBox.rejected.connect(self.reject)

        hwidget = QWidget()
        hlayout = QHBoxLayout()
        #set spinBox ncatalyst
        hlayout.addWidget(QLabel('<b>No. of catalysts</b>'))
        self.sb_ncatalyst = QSpinBox()
        self.sb_ncatalyst.setMinimum(1)
        self.sb_ncatalyst.setMaximum(self.NUMCAT_MAX)
        self.sb_ncatalyst.setValue(parent_theory.numcat)
        self.sb_ncatalyst.valueChanged.connect(
            self.handle_sb_ncatalyst_valueChanged)
        hlayout.addWidget(self.sb_ncatalyst)
        #set time const box
        hlayout.addStretch()
        hlayout.addWidget(QLabel('<b>Time constant</b>'))
        dvalidator = QDoubleValidator()  #prevent letters etc.
        dvalidator.setBottom(0)  #minimum allowed value
        self.time_const = QLineEdit()
        self.time_const.setValidator(dvalidator)
        self.time_const.setText('%s' % parent_theory.time_const)
        hlayout.addWidget(self.time_const)
        #set monomer concentration box
        hlayout.addStretch()
        hlayout.addWidget(QLabel('<b>Monomer conc.</b>'))
        dvalidator = QDoubleValidator()  #prevent letters etc.
        dvalidator.setBottom(0)  #minimum allowed value
        self.monomer_conc = QLineEdit()
        self.monomer_conc.setValidator(dvalidator)
        self.monomer_conc.setText('%s' % parent_theory.monomer_conc)
        hlayout.addWidget(self.monomer_conc)
        #set horizontal layout
        hwidget.setLayout(hlayout)

        #insert widgets
        self.mainLayout = QVBoxLayout()
        self.mainLayout.addWidget(hwidget)
        self.mainLayout.addWidget(self.scroll)
        self.mainLayout.addStretch()
        self.mainLayout.addWidget(buttonBox)
        self.setLayout(self.mainLayout)
        self.setWindowTitle("Enter Metallocene Polymerisation Parameters")
Beispiel #20
0
    def __init__(self, *args, **kwargs):

        self.magnet_device_le = SmartStringLineEdit(
            "SCS_CDIFFT_MAG/ASENS/CURRENT")

        self.current_threshold_le = SmartLineEdit(
            str(_DEFAULT_CURRENT_THRESHOLD))
        validator = QDoubleValidator()
        validator.setBottom(_DEFAULT_CURRENT_THRESHOLD)
        self.current_threshold_le.setValidator(validator)

        super().__init__(*args, **kwargs)

        self._non_reconfigurable_widgets.append(self.magnet_device_le)
    def onCategoryChange(self, i_row, category):
        resolution_le = SmartLineEdit(str(_DEFAULT_RESOLUTION))
        validator = QDoubleValidator()
        validator.setBottom(0.0)
        resolution_le.setValidator(validator)

        if not category or category == self._user_defined_key:
            device_id_le = SmartLineEdit()
            property_le = SmartLineEdit()
            if not category:
                device_id_le.setReadOnly(True)
                property_le.setReadOnly(True)
                resolution_le.setReadOnly(True)
            else:
                device_id_le.returnPressed.connect(functools.partial(
                    self.onCorrelationParamChangeLe, i_row))
                property_le.returnPressed.connect(functools.partial(
                    self.onCorrelationParamChangeLe, i_row))
                resolution_le.returnPressed.connect(functools.partial(
                    self.onCorrelationParamChangeLe, i_row))

            self._table.setCellWidget(i_row, 1, device_id_le)
            self._table.setCellWidget(i_row, 2, property_le)
            self._table.setCellWidget(i_row, 3, resolution_le)

            self.onCorrelationParamChangeLe(i_row)
        else:
            srcs = self._src_metadata if category in config.meta_sources \
                else self._src_instrument
            category_srcs = srcs.get(category, dict())
            device_id_cb = QComboBox()
            property_cb = QComboBox()
            for device_id in category_srcs:
                device_id_cb.addItem(device_id)
                for ppt in category_srcs[device_id]:
                    property_cb.addItem(ppt)

            device_id_cb.currentTextChanged.connect(functools.partial(
                self.onCorrelationParamChangeCb, i_row))
            property_cb.currentTextChanged.connect(functools.partial(
                self.onCorrelationParamChangeCb, i_row))
            resolution_le.returnPressed.connect(functools.partial(
                self.onCorrelationParamChangeCb, i_row))

            self._table.setCellWidget(i_row, 1, device_id_cb)
            self._table.setCellWidget(i_row, 2, property_cb)
            self._table.setCellWidget(i_row, 3, resolution_le)

            self.onCorrelationParamChangeCb(i_row)
Beispiel #22
0
 def make_lines(self, source):
     """Create the input-parameter-form lines with default parameter values"""
     dvalidator = QDoubleValidator()  #prevent letters etc.
     dvalidator.setBottom(0)  #minimum allowed value
     qledit = QLineEdit()
     qledit.setValidator(dvalidator)
     qledit.setText('0.0')  #new lines contain zeros
     self.lines = []
     for i in range(self.NUMCAT_MAX):
         line = []
         for j in range(5):
             qledit = QLineEdit()
             qledit.setValidator(dvalidator)
             qledit.setText(source[i][j])
             line.append(qledit)
         self.lines.append(line)
Beispiel #23
0
    def __init__(self, parent, exp=None):
        super(EditOfficeExpDialog, self).__init__(parent)
        self.setupUi(self)

        double_val = QDoubleValidator(self)
        double_val.setBottom(0)
        double_val.setDecimals(2)
        self.moneyEdit.setValidator(double_val)

        if exp:
            self.setWindowTitle("修改记录信息")
            self.nameEdit.setText(exp.name)
            self.moneyEdit.setText("%.2f" % (float(exp.money) / 100))
            self.commentEdit.setText(exp.comment)
        else:
            self.setWindowTitle("添加记录")
Beispiel #24
0
    def __init__(self, name):
        super().__init__(name)

        self.loopPicker = QComboBox()
        self.loopPicker.addItem("Torque")
        self.loopPicker.addItem("Velocity")
        self.loopPicker.addItem("Position")

        amplitude_box = QHBoxLayout()
        amplitude_box.addWidget(QLabel('Amp.'))
        self.amplitude_field = QLineEdit('0.')
        v = QDoubleValidator()
        v.setBottom(0)
        self.amplitude_field.setValidator(v)
        amplitude_box.addWidget(self.amplitude_field)

        frequency_box = QHBoxLayout()
        frequency_box.addWidget(QLabel('Freq.'))
        self.frequency_field = QLineEdit('1')
        v = QDoubleValidator()
        v.setBottom(0)
        self.frequency_field.setValidator(v)
        frequency_box.addWidget(self.frequency_field)

        offset_box = QHBoxLayout()
        offset_box.addWidget(QLabel('Offset'))
        self.offset_field = QLineEdit('0')
        v = QDoubleValidator()
        self.offset_field.setValidator(v)
        offset_box.addWidget(self.offset_field)

        vbox = QVBoxLayout()
        vbox.addWidget(self.loopPicker)
        vbox.addLayout(amplitude_box)
        vbox.addLayout(frequency_box)
        vbox.addLayout(offset_box)
        self.checkbox = QCheckBox('Enabled')
        vbox.addWidget(self.checkbox)

        self.setLayout(vbox)

        self.loopPicker.currentIndexChanged.connect(self._type_changed)
        self.amplitude_field.returnPressed.connect(self._param_changed)
        self.frequency_field.returnPressed.connect(self._param_changed)
        self.offset_field.returnPressed.connect(self._param_changed)
        self.checkbox.stateChanged.connect(self._param_changed)
Beispiel #25
0
    def make_lines(self):
        """Create the input-parameter-form lines with default parameter values"""
        dvalidator = QDoubleValidator()  #prevent letters etc.
        dvalidator.setBottom(0)  #minimum allowed value
        self.lines = []
        for i, th in enumerate(self.opened_react_theories):
            line = []
            ndist = th.ndist
            ds = th.parent_dataset
            app = ds.parent_application
            manager = app.parent_manager

            #find application tab-name
            app_index = manager.ApplicationtabWidget.indexOf(app)
            app_tab_name = manager.ApplicationtabWidget.tabText(app_index)
            #find dataset tab-name
            ds_index = app.DataSettabWidget.indexOf(ds)
            ds_tab_name = app.DataSettabWidget.tabText(ds_index)
            #find theory tab-name
            th_index = ds.TheorytabWidget.indexOf(th)
            th_tab_name = ds.TheorytabWidget.tabText(th_index)

            label = QLabel('%s/%s/%s' % (app_tab_name, ds_tab_name,
                                         th_tab_name))
            label.setWordWrap(True)
            line.append(label)
            line.append(QLabel(
                '%.4g' % rch.react_dist[ndist].contents.npoly))  #no. generated
            line.append(
                QLabel('%.4g' %
                       rch.react_dist[ndist].contents.nsaved))  #no. saved
            checkbox = QCheckBox()
            try:
                checkbox.setChecked(bool(self.parent_theory.include[i]))
            except IndexError:
                checkbox.setChecked(True)
            line.append(checkbox)  #is included? - checked by default
            qledit = QLineEdit()
            qledit.setValidator(dvalidator)
            try:
                qledit.setText('%s' % self.parent_theory.ratios[i])
            except IndexError:
                qledit.setText('1')
            line.append(qledit)  #ratio
            line.append(QLabel('-'))  #weight
            self.lines.append(line)
Beispiel #26
0
    def __init__(self, parent, order):
        super(EditOrderDialog, self).__init__(parent)
        self.setupUi(self)

        double_val = QDoubleValidator(self)
        double_val.setBottom(0)
        double_val.setDecimals(2)
        self.totalMoneyEdit.setValidator(double_val)
        self.payMoneyEdit.setValidator(double_val)
        self.oweMoneyEdit.setValidator(double_val)

        self.setWindowTitle("修改订单信息")
        self.customNameLabel.setText(order.custom.name)
        self.totalMoneyEdit.setText("%.2f" % (float(order.need_pay) / 100))
        self.payMoneyEdit.setText("%.2f" % (float(order.now_pay) / 100))
        self.oweMoneyEdit.setText("%.2f" % (float(order.owe_money) / 100))

        self.totalMoneyEdit.textChanged.connect(self.edit_total_money)
        self.payMoneyEdit.textChanged.connect(self.edit_pay_money)
        self.oweMoneyEdit.textChanged.connect(self.edit_owe_money)
    def _connect_ui(self):
        double_valid = QDoubleValidator()
        for line_edit in self.findChildren(QLineEdit):
            line_name = line_edit.objectName()
            if line_name == "log_time_line":
                line_edit.setInputMask("99:99:99;_")
            elif line_name == "contr_freq_line":
                int_valid = QIntValidator()
                int_valid.setBottom(1)
                line_edit.setValidator(int_valid)
            elif line_name == "dt_line":
                valid = QDoubleValidator()
                valid.setBottom(0.)
                line_edit.setValidator(valid)
            else:
                line_edit.setValidator(double_valid)
            line_edit.textEdited.connect(self._change_settings)

        for check_box in self.findChildren(QCheckBox):
            check_box.stateChanged.connect(self._change_settings)
        return
 def _connect_line_edit(self):
     double_valid = QDoubleValidator()
     for line_edit in self.findChildren(QLineEdit):
         line_name = line_edit.objectName()
         if line_name == "mass_line" or \
                 line_name.startswith("drag_coef"):
             mass_valid = QDoubleValidator()
             mass_valid.setBottom(0.)
             line_edit.setValidator(mass_valid)
         else:
             line_edit.setValidator(double_valid)
         if line_name.startswith("in_moment"):
             i = int(line_name[-2])
             j = int(line_name[-1])
             if i == j:
                 in_moment_valid = QDoubleValidator()
                 in_moment_valid.setBottom(0.)
                 line_edit.setValidator(in_moment_valid)
             line_edit.textEdited.connect(self._change_in_moment)
         else:
             line_edit.textEdited.connect(self._change_copter)
     return
Beispiel #29
0
    def create_new_tab(self, pol_id, pol_type):
        """Return a new widget containing a form with all the parameters
        specific to the polymer type ``pol_type``
        """
        widget = QWidget(self)
        layout = QFormLayout()
        pol_dict = OrderedDict([
            ("type", pol_type),
        ])  # Arch. enum type number

        val_double = QDoubleValidator()
        val_double.setBottom(0)  #set smallest double allowed in the form

        e1 = QLineEdit()
        e1.setValidator(val_double)
        e1.setMaxLength(6)
        e1.setText(self.d.ratio.text())
        e1.setToolTip('Ratio weight fraction occupied by this polymer type')
        label = QLabel("Ratio")
        label.setToolTip('Ratio weight fraction occupied by this polymer type')
        layout.addRow(label, e1)
        pol_dict["Ratio"] = e1

        e2 = QLineEdit()
        e2.setValidator(val_double)
        e2.setText(self.d.number.text())
        e2.setToolTip('Number of polymers of this type')
        label2 = QLabel("Num. of polymers")
        label2.setToolTip('Number of polymers of this type')
        layout.addRow(label2, e2)
        pol_dict["Num. of polymers"] = e2
        success = self.set_extra_lines(pol_type, layout, pol_dict)

        self.dict_component[pol_id] = pol_dict
        widget.setLayout(layout)
        if success:
            return widget, True
        else:
            return widget, False
Beispiel #30
0
    def __init__(self, parent):
        super(SaleCargoDialog, self).__init__(parent)
        self.setupUi(self)

        double_val = QDoubleValidator(self)
        double_val.setBottom(0)
        double_val.setDecimals(2)
        self.needPayEdit.setValidator(double_val)
        self.payEdit.setValidator(double_val)

        self.oweEdit.setFocusPolicy(QtCore.Qt.NoFocus)
        self.saleListTable.setEditTriggers(QTableWidget.NoEditTriggers)

        self.dateEdit.setDate(datetime.date.today())

        self.needPayEdit.textChanged.connect(self.cal_owe)
        self.payEdit.textChanged.connect(self.cal_owe)
        self.chooseCustomBtn.clicked.connect(self.choose_custom_btn_on_click)
        self.addCargoBtn.clicked.connect(self.add_cargo_btn_on_click)

        self.custom = None
        self.sale_dict = {}
Beispiel #31
0
 def _connect_line_edit(self):
     double_valid = QDoubleValidator()
     double_valid.setBottom(0.)
     for line_edit in self.findChildren(QLineEdit):
         line_name = line_edit.objectName()
         if line_name == "max_pwm_lbl":
             int_valid = QIntValidator()
             int_valid.setBottom(1)
             line_edit.setValidator(int_valid)
         else:
             line_edit.setValidator(double_valid)
         if line_name.startswith("in_moment"):
             i = int(line_name[-2])
             j = int(line_name[-1])
             in_moment_valid = QDoubleValidator()
             if i == j:
                 in_moment_valid.setBottom(0.)
                 line_edit.setValidator(in_moment_valid)
             else:
                 line_edit.setValidator(in_moment_valid)
             line_edit.textEdited.connect(self._change_in_moment)
         else:
             line_edit.textEdited.connect(self._change_engine)
     return
Beispiel #32
0
 def __init__ (self, parent):
     super().__init__(parent)
     self.setEnabled(False)
     layout = QFormLayout(self)
     
     l_persistence = QLabel("&Persistence", self)
     persistence = QComboBox(self)
     persvals = ("", "Mark", "OnceEver", "OncePerConv")
     persistence.insertItems(len(persvals), persvals)
     persistence.currentTextChanged.connect(self.persistencechanged)
     l_persistence.setBuddy(persistence)
     self.persistence = persistence
     
     l_bankmode = QLabel("&Bank play mode", self)
     bankmode = QComboBox(self)
     bankmodes = ("First", "All", "Append")
     bankmode.insertItems(len(bankmodes), bankmodes)
     bankmode.currentTextChanged.connect(self.bankmodechanged)
     l_bankmode.setBuddy(bankmode)
     self.bankmode = bankmode
     
     l_questionhub = QLabel("&Question hub", self)
     questionhub = QComboBox(self)
     qhubtypes = ("", "ShowOnce", "ShowNever")
     questionhub.insertItems(len(qhubtypes), qhubtypes)
     questionhub.currentTextChanged.connect(self.questionhubchanged)
     l_questionhub.setBuddy(questionhub)
     self.questionhub = questionhub
     
     l_trigger = QLabel("&Trigger conversation", self)
     trigger = QComboBox(self)
     trigger.currentTextChanged.connect(self.triggerchanged)
     l_trigger.setBuddy(trigger)
     self.trigger = trigger
     
     l_randweight = QLabel("&Random weight", self)
     randweight = QLineEdit(self)
     rwvalidator = QDoubleValidator(self)
     rwvalidator.setBottom(0)
     rwvalidator.setDecimals(3)
     randweight.setValidator(rwvalidator)
     randweight.editingFinished.connect(self.randweightchanged)
     l_randweight.setBuddy(randweight)
     self.randweight = randweight
     
     l_comment = QLabel("&Comment", self)
     comment = ParagraphEdit(self)
     comment.textChanged.connect(self.commentchanged)
     self.comment = comment
     l_comment.setBuddy(comment)
     
     layout.addRow(l_persistence, persistence)
     layout.addRow(l_bankmode, bankmode)
     layout.addRow(l_questionhub, questionhub)
     layout.addRow(l_trigger, trigger)
     layout.addRow(l_randweight, randweight)
     layout.addRow(l_comment, comment)
     
     textdoc = QTextDocument(self)
     textdoc.setDocumentLayout(QPlainTextDocumentLayout(textdoc))
     self.blankdoc = textdoc