예제 #1
0
 def __init__(self):
     super().__init__()
     self.setAlignment(Qt.AlignCenter)
     self.setSizePolicy(QSizePolicy())
     v = QDoubleValidator(0,99,3,self)
     v.setNotation(QDoubleValidator.StandardNotation)
     self.setValidator(v)
     self.textChanged[str].connect(self.updateGeometry)
     self.setFrame(False)
     self.setAttribute(Qt.WA_MacShowFocusRect, 0);
     self.editingFinished.connect(self.clearFocus)
     self.setContextMenuPolicy(Qt.NoContextMenu)
     self.setReadOnly(True)
     self.setStyleSheet('''
         QLineEdit {
             border-width: 1px;
             border-style: solid;
             border-radius: 7px;
             border-color: gray;
             padding: 0px 1px 0px 1px;
             background: transparent;
         }
         QLineEdit::focus {
             background: gray;
         }
     ''')
예제 #2
0
 def addStatControl(self,i,label=None):
     statbox = QHBoxLayout()
     statbox.addSpacing(1)
     statbox.setSpacing(0)
     statbox.setAlignment(Qt.AlignCenter)
     statlabel = QLabel(self.stats[i] if label is None else label)
     statlabel.setContentsMargins(0,0,0,0)
     statlabel.setAlignment(Qt.AlignCenter)
     statlabel.setFixedWidth(20)
     statbox.addWidget(statlabel)
     statcontrol = QLineEdit()
     statcontrol.setAlignment(Qt.AlignCenter)
     statcontrol.setFixedWidth(40)
     statcontrol.setText(str(self.skill.multipliers[i]))
     v = QDoubleValidator(0,99,3,statcontrol)
     v.setNotation(QDoubleValidator.StandardNotation)
     #v.setRange(0,100,decimals=3)
     statcontrol.setValidator(v)
     #print(v.top())
     def statFuncMaker(j):
         def statFunc(newValue):
             self.skill.multipliers[j] = float(newValue)
             self.skillsChanged.emit()
         return statFunc
     statcontrol.textChanged[str].connect(statFuncMaker(i))
     statbox.addWidget(statcontrol)
     statbox.addSpacing(1)
     self.layout.addLayout(statbox)
예제 #3
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)
예제 #4
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)
예제 #5
0
    def style_widgets(self):

        self.qmax_label.setAlignment(Qt.AlignVCenter | Qt.AlignRight)
        self.qmax_input.setAlignment(Qt.AlignRight)
        self.qmax_input.setValidator(QDoubleValidator())
        self.qmax_input.setMaximumWidth(70)
        self.qmax_input.setEnabled(False)
        self.qmax_check.setChecked(False)
        self.qmax_label.setEnabled(False)

        self.qmin_label.setAlignment(Qt.AlignVCenter | Qt.AlignRight)
        self.qmin_input.setAlignment(Qt.AlignRight)
        self.qmin_input.setValidator(QDoubleValidator())
        self.qmin_input.setMaximumWidth(70)
        self.qmin_input.setEnabled(False)
        self.qmin_check.setChecked(False)
        self.qmin_label.setEnabled(False)

        self.smooth_label.setAlignment(Qt.AlignVCenter | Qt.AlignRight)
        self.smooth_data_check.setChecked(False)

        self.window_start_input.setValidator(QDoubleValidator())
        self.window_start_input.setEnabled(False)
        self.fz_btn.setChecked(True)
예제 #6
0
    def __init__(self, parent=None):
        """
        Инициализация диалогового окна добавления крана к списку 
        """
        super(addCraneDialog, self).__init__(parent)
        self.parent = parent
        self.ui = uic.loadUi("./ui/HeightPlan-Add_crane.ui", self)

        self.ui.CraneNumber.setText("")
        self.ui.LiftingCapacity.setText("")

        liftingCapasityValidator = QDoubleValidator(0.00, 1000.00, 2, self)
        self.ui.LiftingCapacity.setValidator(liftingCapasityValidator)

        self.updatePlanePointsOptions()
예제 #7
0
 def __init__(self, parent=None, tz=None):
     """
     Constructor
     
     @param parent reference to the parent widget
     @type QWidget
     """
     super(FrmTime, self).__init__(parent)
     if tz is None:
         tz = True
     self.setupUi(self)
     self.editHH.setValidator(QDoubleValidator())
     self.editHH.validator().setRange(0, 23, decimals=0)
     self.editMM.setValidator(QDoubleValidator())
     self.editMM.validator().setRange(0, 59, decimals=0)
     self.editSS.setValidator(QDoubleValidator())
     self.editHH.validator().setRange(0, 59, decimals=9)
     # set timezone fields
     if tz == True:
         self.editTZ.setVisible(True)
         self.lblTZ.setVisible(True)
     else:
         self.editTZ.setVisible(False)
         self.lblTZ.setVisible(False)
예제 #8
0
    def createDensitySeries(self, datumNames):
        self.ds = QGroupBox('Data')
        lt = QHBoxLayout()

        self.dsb = QComboBox()
        layout = QFormLayout()
        self.dsb.addItems(datumNames)
        self.dsb.setCurrentIndex(0)
        self.dsb.setLayout(layout)

        self.ds_chirecalc = QGroupBox("Recalculate chi")
        layout = QFormLayout()
        self.chileftmin = QLineEdit()
        self.chileftmin.setValidator(QDoubleValidator())
        self.chileftmin.setText('{0:f}'.format(self.lx[0] * 0.15))
        layout.addRow(QLabel('xmin for left sample:'), self.chileftmin)
        self.chileftmax = QLineEdit()
        self.chileftmax.setValidator(QDoubleValidator())
        self.chileftmax.setText('{0:f}'.format(self.lx[0] * 0.35))
        layout.addRow(QLabel('xmax for left sample:'), self.chileftmax)
        self.chirightmin = QLineEdit()
        self.chirightmin.setValidator(QDoubleValidator())
        self.chirightmin.setText('{0:f}'.format(self.lx[0] * 0.65))
        layout.addRow(QLabel('xmin for right sample:'), self.chirightmin)
        self.chirightmax = QLineEdit()
        self.chirightmax.setValidator(QDoubleValidator())
        self.chirightmax.setText('{0:f}'.format(self.lx[0] * 0.85))
        layout.addRow(QLabel('xmax for right sample:'), self.chirightmax)
        self.ds_chirecalc.setLayout(layout)
        self.chirecalc = QPushButton('recalculate', self)
        self.chireset = QPushButton('reset', self)
        layout.addRow(self.chirecalc, self.chireset)

        lt.addWidget(self.dsb)
        lt.addWidget(self.ds_chirecalc)
        self.ds.setLayout(lt)
예제 #9
0
    def addInputField(self, _type):
        if self._inputField is None:
            self._inputFieldType = _type
            self._inputField = QLineEdit()
            if _type is float:
                self._inputField.setValidator(QDoubleValidator())
            elif _type is int:
                self._inputField.setValidator(QIntValidator())

            self._layout.addWidget(self._inputField)
            self._inputField.returnPressed.connect(
                self.onInputFieldReturnPressed)
        elif self._inputFieldType is not _type:
            raise ImproperlyConfigured("Input field for attribute '%s' configured twice with different types %s != %s"\
                    % (self._attribute, self._inputFieldType, _type))
예제 #10
0
파일: pyepics_Qt.py 프로젝트: Tiamisu/XAnoS
 def setPV(self, pvname, type=float, prec=5):
     if self.pv is not None and self.cb_index is not None:
         self.pv.remove_callback(self.cb_index)
         self.pvChanged.disconnect(self.updatePV)
     self.prec = prec
     self.type = type
     self.pv = epics.PV(BYTES2STR(pvname))
     self.cb_index = self.pv.add_callback(self.onPVChange)
     self.pvChanged.connect(self.updatePV)
     if self.type == float:
         self.validator = QDoubleValidator()
         self.setValidator(self.validator)
     elif self.type == int:
         self.validator = QIntValidator()
         self.setValidator(self.validator)
예제 #11
0
    def initSetting(
        self
    ):  # setting 창 설정 함수(1) : lineEdit에서 type에 맞는 글자만 들어갈수 있도록 만든다.그리고 startButton click event을 해준다.
        self.onlyInt = QIntValidator()
        self.onlyDouble = QDoubleValidator()

        #restrict user input in QLineEdit
        self.z_min_lineEdit.setValidator(self.onlyInt)
        self.z_max_lineEdit.setValidator(self.onlyInt)
        self.interval_lineEdit.setValidator(self.onlyInt)
        self.sample_rate_lineEdit.setValidator(self.onlyDouble)
        self.p_value_lineEdit.setValidator(self.onlyDouble)

        # add button click event
        self.start_pushButton.clicked.connect(self.startGrah)
예제 #12
0
    def style_widgets(self):

        self.disp_label.setAlignment(Qt.AlignVCenter | Qt.AlignLeft)
        self.disp_label.setToolTip('Print basin-hopping status messages?')

        self.niter_basin_label.setAlignment(Qt.AlignVCenter | Qt.AlignLeft)
        self.niter_basin_input.setAlignment(Qt.AlignRight)
        self.niter_basin_input.setValidator(QIntValidator())
        self.niter_basin_input.setMaximumWidth(70)

        self.temp_basin_label.setAlignment(Qt.AlignVCenter | Qt.AlignLeft)
        self.temp_basin_input.setAlignment(Qt.AlignRight)
        self.temp_basin_input.setValidator(QDoubleValidator())
        self.temp_basin_input.setMaximumWidth(70)

        self.stepsize_basin_label.setAlignment(Qt.AlignVCenter | Qt.AlignLeft)
        self.stepsize_basin_input.setAlignment(Qt.AlignRight)
        self.stepsize_basin_input.setValidator(QDoubleValidator())
        self.stepsize_basin_input.setMaximumWidth(70)

        self.interval_basin_label.setAlignment(Qt.AlignVCenter | Qt.AlignLeft)
        self.interval_basin_input.setAlignment(Qt.AlignRight)
        self.interval_basin_input.setValidator(QIntValidator())
        self.interval_basin_input.setMaximumWidth(70)
예제 #13
0
    def _set_validators(self):
        # Set up the validators (could be in separate function or module)
        reg_ex = QRegExp(r"[A-Za-z0-9]{1,10}")  # <1>
        val_alphanum = QRegExpValidator(reg_ex, self.ui.le_alphanum)  # <2>
        self.ui.le_alphanum.setValidator(val_alphanum)  # <3>

        reg_ex = QRegExp(r"[a-z ]{0,30}")  # <1>
        val_lcspace = QRegExpValidator(reg_ex, self.ui.le_lcspace)  # <2>
        self.ui.le_lcspace.setValidator(val_lcspace)  # <3>

        val_nums_1_100 = QIntValidator(1, 100, self.ui.le_nums_1_100)  # <4>
        self.ui.le_nums_1_100.setValidator(val_nums_1_100)  # <5>

        val_float = QDoubleValidator(0.0, 20.0, 2, self.ui.le_float)  # <6>
        self.ui.le_float.setValidator(val_float)  # <7>
예제 #14
0
    def set_goal(self):
        self.goalform = QWidget()
        goal_dist = QLabel("Kilometrimäärä")
        goal_date = QLabel("Tavoitepäivämäärä")

        self.dist_edit = QLineEdit()
        self.dist_edit.setValidator(QDoubleValidator())
        self.dist_edit.setMaxLength(5)
        self.date_edit = QLineEdit()
        self.date_edit.setDisabled(True)
        open_calendar = QPushButton("")
        open_calendar.setIcon(QIcon(f"{mainpath}calendar.png"))
        open_calendar.clicked.connect(self.open_calendar)

        ok_btn = QPushButton("Ok")
        ok_btn.clicked.connect(self.confirm)
        cancel_btn = QPushButton("Peruuta")
        cancel_btn.clicked.connect(self.goalform.close)

        info_lbl = QLabel(
            "Voit antaa sekä matkan että päivämäärän tai jättää kumman tahansa tyhjäksi."
        )

        grid = QGridLayout()
        grid.setSpacing(10)

        grid.addWidget(goal_dist, 1, 0)
        grid.addWidget(self.dist_edit, 1, 1)
        grid.addWidget(goal_date, 2, 0)
        grid.addWidget(self.date_edit, 2, 1)
        grid.addWidget(open_calendar, 2, 2)

        hbox = QHBoxLayout()
        hbox.addStretch()
        hbox.addWidget(ok_btn)
        hbox.addWidget(cancel_btn)

        vbox = QVBoxLayout()
        vbox.addWidget(info_lbl)
        vbox.addLayout(grid)
        vbox.addStretch()
        vbox.addLayout(hbox)

        self.goalform.setLayout(vbox)
        self.goalform.setWindowIcon(QIcon(f"{mainpath}icon.ico"))
        self.goalform.setWindowTitle("Aseta tavoite")
        self.goalform.setGeometry(600, 300, 100, 100)
        self.goalform.show()
예제 #15
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)
예제 #16
0
    def __init__(self):
        super().__init__(show_automatic_box=True)

        main_box = gui.widgetBox(self.controlArea,
                                 "Fit Initialization",
                                 orientation="vertical",
                                 width=self.CONTROL_AREA_WIDTH - 10,
                                 height=250)

        button_box = gui.widgetBox(main_box,
                                   "",
                                   orientation="horizontal",
                                   width=self.CONTROL_AREA_WIDTH - 25)

        gui.button(button_box,
                   self,
                   "Send Fit Initialization",
                   height=50,
                   callback=self.send_fit_initialization)

        fft_box = gui.widgetBox(main_box,
                                "FFT",
                                orientation="vertical",
                                width=self.CONTROL_AREA_WIDTH - 30)

        gui.lineEdit(fft_box,
                     self,
                     "s_max",
                     "S_max [nm-1]",
                     labelWidth=250,
                     valueType=float,
                     validator=QDoubleValidator())

        self.cb_n_step = orangegui.comboBox(
            fft_box,
            self,
            "n_step",
            label="FFT Steps",
            labelWidth=350,
            items=["1024", "2048", "4096", "8192", "16384", "32768", "65536"],
            sendSelectedValue=True,
            orientation="horizontal")
        orangegui.comboBox(fft_box,
                           self,
                           "fft_type",
                           label="FFT Type",
                           items=FFTTypes.tuple(),
                           orientation="horizontal")
예제 #17
0
    def __init__(self, section, name, default, query, comment):
        self.name = name.upper()
        self.section = section
        self.query = query
        self.comment = comment.strip('\'').strip()
        self.gui_element = None
        if type(default) == type:
            self.type = default
            self.default = default()
        else:
            self.default = default
            if query is not None and ' in ' in query:
                self.type = list
                self.items = eval(query.split(" in ")[1].strip())
            else:
                self.type = type(default)
        globals()[self.name] = self.default

        # Create GUI Element
        self.gui_label = QLabel(self.name)
        if self.type == bool:
            gui_element = QCheckBox()
            gui_element.setChecked(self.default)
            # noinspection PyUnresolvedReferences
            gui_element.stateChanged.connect(lambda: self.isValid())
        elif self.type == float:
            gui_element = QLineEdit(str(self.default))
            gui_element.setValidator(QDoubleValidator())
            # noinspection PyUnresolvedReferences
            gui_element.textChanged.connect(lambda: self.isValid())
        elif self.type == str:
            gui_element = QLineEdit(str(self.default))
            # noinspection PyUnresolvedReferences
            gui_element.textChanged.connect(lambda: self.isValid())
        elif self.type == list:
            gui_element = QComboBox()
            gui_element.addItems(self.items)
            # noinspection PyUnresolvedReferences
            gui_element.currentIndexChanged.connect(lambda: self.isValid())
        else:
            gui_element = None
            print("UNKNOWN PARAMETER TYPE!!!")

        if self.comment is not None:
            gui_element.setToolTip(self.comment)
        gui_element.setMinimumWidth(100)
        self.gui_element = gui_element
        self.isValid()
예제 #18
0
    def __init__(self, value=0, parent=None):
        verification(value, (float, int), errmsg=u'value')

        super(GChNumEdit, self).__init__(str(value), parent=parent)

        self.setAlignment(QtCore.Qt.AlignRight)

        # Коректує ввід лише чисельних символів.
        self.setValidator(
            QDoubleValidator(-sys.float_info.max, sys.float_info.max,
                             sys.float_info.dig, self))
        # Ініціалізація палітри за промовчанням.
        self.__appearance = self.palette()

        # Обробник події зміни тексту.
        self.textChanged[str].connect(self.__corect_value)
예제 #19
0
 def __init__(self):
     super().__init__()
     self._logger = logging.getLogger('Editor Patapon file')
     self.setupUi(self)  # Это нужно для инициализации нашего дизайна
     self.openFileButton.clicked.connect(self.open_file)
     self.exitButton.clicked.connect(self.exit_app)
     self.saveFileButton_2.clicked.connect(self.save_file)
     self.comboBox.currentTextChanged.connect(self.process_item)
     self._file_content = None
     self._all_items = []
     self._file_name = None
     self.item_model = QStandardItemModel(self.comboBox)
     self._only_int = QIntValidator()
     self._only_float = QDoubleValidator()
     self.set_validators()
     self.set_processor()
예제 #20
0
파일: QlinEdit.py 프로젝트: Altercg/Pyqt5
    def initUI(self):
        formLayout = QFormLayout()

        normalEdit = QLineEdit()
        noEchoEdit = QLineEdit()
        passwordEdit = QLineEdit()
        passwordEchoOnEdit = QLineEdit()

        # 表单布局
        formLayout.addRow("Normal", normalEdit)  # 整型
        formLayout.addRow("NoEcho", noEchoEdit)
        formLayout.addRow("password", passwordEdit)  # 浮点型
        formLayout.addRow("passwordEchoOnEdit", passwordEchoOnEdit)

        # setPlaceholderText()   输入提示

        # 整数
        intValidator = QIntValidator(self)
        intValidator.setRange(1, 99)
        # 浮点数,小数点2位
        doubleValidator = QDoubleValidator(self)
        doubleValidator.setRange(-360, 360)
        doubleValidator.setNotation(QDoubleValidator.StandardNotation)  # 标准表示法
        doubleValidator.setDecimals(2)
        # 字符和数字
        reg = QRegExp('[a-zA-Z0-9]+$')
        validator = QRegExpValidator(self)
        validator.setRegExp(reg)
        # 校验器
        normalEdit.setValidator(intValidator)
        passwordEdit.setValidator(doubleValidator)
        passwordEchoOnEdit.setValidator(validator)

        # setEchoMode() 设置模式
        normalEdit.setEchoMode(QLineEdit.Normal)
        noEchoEdit.setEchoMode(QLineEdit.NoEcho)
        passwordEdit.setEchoMode(QLineEdit.Password)
        passwordEchoOnEdit.setEchoMode(QLineEdit.PasswordEchoOnEdit)

        # 使用掩码
        # normalEdit.setInputMask('000.000.000.000;_') 以这个形式输入,;表示没有就是下划线
        # normalEdit.setInputMask('>AAAAA-AAAAA-AAAAA;#')

        self.setLayout(formLayout)
        self.setWindowTitle('QLineEdit')
예제 #21
0
    def creatUI(self):
        self.setWindowTitle("综合示例")
        # 初始化
        el = QLineEdit()
        # 设置验证器
        el.setValidator(QIntValidator())
        # 设置允许输入最大长度
        el.setMaxLength(4)
        #  设置文本对齐类型
        el.setAlignment(Qt.AlignCenter)
        # 设置字体
        el.setFont(QFont("Arial", 20))

        e2 = QLineEdit()
        # 设置验证器
        e2.setValidator(QDoubleValidator(0.99, 99.99, 2))
        flo = QFormLayout()
        flo.addRow("integer validator", el)
        flo.addRow("double validator", e2)

        e3 = QLineEdit()
        # 设置掩码
        e3.setInputMask("+99_9999_99999")
        flo.addRow("input mask", e3)

        e4 = QLineEdit()
        # 设置浮悬显示内容
        e4.setPlaceholderText("浮悬")
        # 内容改变时,发送信号
        e4.textChanged.connect(self.textChanged)

        e5 = QLineEdit()
        # 设置EchoMode显示
        e5.setEchoMode(QLineEdit.PasswordEchoOnEdit)
        flo.addRow("password", e5)

        e6 = QLineEdit("hello world")
        # 设置只读
        e6.setReadOnly(True)
        flo.addRow("只读", e6)

        e7 = QLineEdit()
        # 完成编辑时的信号
        e7.editingFinished.connect(self.editingFinished)
        flo.addRow("编辑完成", e7)

        self.setLayout(flo)
예제 #22
0
    def __init__(self):
        super().__init__()
        self.setupUi(self)

        self.request_manager = None
        self.n = 0
        self.p_cur = 2
        self.p_prev = 0

        self.double_validator = QDoubleValidator(bottom=0)
        self.int_validator = QIntValidator(bottom=0)

        self.producer_count_edit.setValidator(self.int_validator)
        self.producer_count_edit.textChanged.connect(
            self.__check_configuration_params_button)

        self.alpha_edit.setValidator(self.double_validator)
        self.alpha_edit.textChanged.connect(
            self.__check_configuration_params_button)

        self.beta_edit.setValidator(self.double_validator)
        self.beta_edit.textChanged.connect(
            self.__check_configuration_params_button)

        self.device_count_edit.setValidator(self.int_validator)
        self.device_count_edit.textChanged.connect(
            self.__check_configuration_params_button)

        self.lambda_edit.setValidator(self.double_validator)
        self.lambda_edit.textChanged.connect(
            self.__check_configuration_params_button)

        self.buffer_size_edit.setValidator(self.int_validator)
        self.buffer_size_edit.textChanged.connect(
            self.__check_configuration_params_button)

        self.n_edit.setValidator(self.int_validator)
        self.n_edit.textChanged.connect(
            self.__check_configuration_params_button)

        self.configure_button.clicked.connect(self.__configure)
        self.step_button.clicked.connect(self.__step)
        self.finish_button.clicked.connect(self.__finish)
        self.refresh_button.clicked.connect(self.__refresh)

        self.__diagram = Diagram(0, 0, 0, [], [], [], [])
        self.diagram_scroll_area.setWidget(self.__diagram)
예제 #23
0
    def FormVendas(self):
        self.DesativaBotaoVendas()
        self.LimpaFrame(self.ct_containerVendas)
        super(MainVendas, self).setFormVendas(self.ct_containerVendas)
        self.fr_FormVendas.show()

        # Checando se existe ID válido
        self.IdCheckVenda()
        # Icone Botoes
        self.IconeBotaoMenu(self.bt_BuscaVendas,
                            self.resourcepath('Images/iconSearch.png'))

        # Validar campos int
        validarInt = QIntValidator(0, 999, self)
        # Validar campos float
        validarValorFloat = QDoubleValidator(0.50, 999.99, 2, self)
        validarValorFloat.setNotation(QDoubleValidator.StandardNotation)
        validarValorFloat.setDecimals(2)

        self.tx_QtdItem.setValidator(validarInt)
        self.tx_ValorUnitarioItem.setValidator(validarValorFloat)
        self.tx_ValorTotalItem.setValidator(validarValorFloat)
        self.tx_SubTotal.setValidator(validarValorFloat)
        self.tx_Desconto.setValidator(validarValorFloat)
        self.tx_TotalFinal.setValidator(validarValorFloat)

        # Botao Add Categoria e populando combobox e check
        self.ListaTipoPagamento()
        # busca cliente e produto
        self.tx_IdCliente.returnPressed.connect(self.BuscaClienteId)
        self.tx_IdCliente.textEdited.connect(self.BuscaClienteId)
        self.tx_IdBuscaItem.returnPressed.connect(self.BuscaProdutoId)
        self.tx_IdBuscaItem.textEdited.connect(self.BuscaProdutoId)
        # calculo total item
        self.tx_QtdItem.returnPressed.connect(self.TotalItem)
        self.tx_QtdItem.textEdited.connect(self.TotalItem)
        # Calculo valor final da venda
        self.tx_Desconto.returnPressed.connect(self.TotalFinal)
        self.tx_Desconto.textEdited.connect(self.TotalFinal)
        # Add item no carrinho de compra
        self.bt_IncluirItem.clicked.connect(self.ValidaDadosAddItem)
        # acoes
        self.bt_Voltar.clicked.connect(self.janelaVendas)
        self.bt_Salvar.clicked.connect(self.ValidarDadosVenda)

        self.tb_Itens.blockSignals(True)
        self.tb_Itens.setColumnHidden(0, True)
        self.tb_Itens.resizeRowsToContents()
        self.tb_Itens.setColumnWidth(1, 100)
        self.tb_Itens.setColumnWidth(2, 100)
        self.tb_Itens.setColumnWidth(3, 100)
        self.tb_Itens.setColumnWidth(4, 100)
        self.tb_Itens.setColumnWidth(5, 100)
        self.tb_Itens.setColumnWidth(6, 100)
예제 #24
0
    def initUI(self):
        self.setWindowTitle('校验器')

        #创建表单布局
        formLayout = QFormLayout()

        #创建控件
        intLineEdit = QLineEdit()
        doubleLineEdit = QLineEdit()
        validatorLineEdit = QLineEdit()

        #将控件加入表单中
        formLayout.addRow('整数类型', intLineEdit)
        formLayout.addRow('浮点数类型', doubleLineEdit)
        formLayout.addRow('数字和字母', validatorLineEdit)

        #设置placeholdertext
        intLineEdit.setPlaceholderText('整型')
        doubleLineEdit.setPlaceholderText('浮点数')
        validatorLineEdit.setPlaceholderText('数字和字母')

        #整数校验器
        intValidator = QIntValidator(self)
        intValidator.setRange(1, 99)  #设置整数校验器的整数范围为1-99

        #浮点校验器
        doubleValidator = QDoubleValidator(self)
        doubleValidator.setRange(-360, 360)  #设置浮点数校验器的整数范围为-360-+360
        doubleValidator.setNotation(
            QDoubleValidator.StandardNotation)  #正常表示浮点数
        #设置浮点数的精度,小数点后2位
        doubleValidator.setDecimals(2)

        #字符和数字校验器
        reg = QRegExp('[a-zA-Z0-9]+$')
        validator = QRegExpValidator(self)
        validator.setRegExp(reg)

        #设置校验器
        intLineEdit.setValidator(intValidator)
        doubleLineEdit.setValidator(doubleValidator)
        validatorLineEdit.setValidator(validator)

        self.setLayout(formLayout)
예제 #25
0
    def validateVoltages(self):
        maxV = 100
        minV = -100
        try:
            validateStartVoltage = QDoubleValidator(
                float(self.minVText.text()), float(self.maxVText.text()), 6,
                self.startVText)
            validateMaxVoltage = QDoubleValidator(float(self.minVText.text()),
                                                  maxV, 6, self.maxVText)
            validateMinVoltage = QDoubleValidator(minV,
                                                  float(self.maxVText.text()),
                                                  6, self.minVText)
        except:
            pass

        if validateStartVoltage.validate(self.startVText.text(),1)[0] != 2 or \
            validateMaxVoltage.validate(self.maxVText.text(),1)[0] != 2 or \
            validateMinVoltage.validate(self.minVText.text(),1)[0] != 2:
            msg = "Sweep voltages (including Start) need to be \n between Vmin and Vmax"+\
                "\n\nPlease change Voltages in the Acquisition panel"
            reply = QMessageBox.question(self, 'Critical', msg, QMessageBox.Ok)
            self.show()
예제 #26
0
    def initUI(self):
        self.setWindowTitle('校验器')

        # 创建表单布局
        formLayout = QFormLayout()

        # 创建文本输入框
        intLineEdit = QLineEdit()
        doubleLineEdit = QLineEdit()
        validatorLineEdit = QLineEdit()

        # 放入表单布局
        formLayout.addRow('整数类型', intLineEdit)
        formLayout.addRow('浮点类型', doubleLineEdit)
        formLayout.addRow('数字和字母', validatorLineEdit)

        #设置显示文本输入框提示
        intLineEdit.setPlaceholderText('整型')
        doubleLineEdit.setPlaceholderText('浮点型')
        validatorLineEdit.setPlaceholderText('数字和字母型')

        # 整数校验器
        intValidator = QIntValidator(self)
        intValidator.setRange(1, 99)

        # 浮点校验器   精度:小数点后2位
        doubleValidator = QDoubleValidator(self)
        doubleValidator.setRange(-360, 360)
        doubleValidator.setNotation(
            QDoubleValidator.StandardNotation)  # 表示法正常显示浮点数
        # 设置精度  小数点后两位
        doubleValidator.setDecimals(2)

        # 字符和数字校验器
        reg = QRegExp('[a-zA-Z0-9]+$')
        validator = QRegExpValidator(self)
        validator.setRegExp(reg)

        # 设置校验器
        intLineEdit.setValidator(intValidator)
        doubleLineEdit.setValidator(doubleValidator)
        validatorLineEdit.setValidator(validator)

        self.setLayout(formLayout)
예제 #27
0
    def InitUi(self):
        self.setWindowTitle('验证器')

        # 表单布局
        formLayout = QFormLayout()

        intLineEdit = QLineEdit()
        DoubleLineEdit = QLineEdit()
        RegExpLineEdit1 = QLineEdit()
        RegExpLineEdit2 = QLineEdit()

        formLayout.addRow('&IntLineEdit', intLineEdit)
        formLayout.addRow('&DoubleLineEdit', DoubleLineEdit)
        formLayout.addRow('&RegExpLineEdit', RegExpLineEdit1)
        formLayout.addRow('&RegExpLineEdit', RegExpLineEdit2)

        # 提示文本
        intLineEdit.setPlaceholderText('请输入数字')
        DoubleLineEdit.setPlaceholderText('请输入数字')
        RegExpLineEdit1.setPlaceholderText('请输入数字')
        RegExpLineEdit2.setPlaceholderText('请输入数字')

        # 创建验证器对象
        intValidator = QIntValidator()
        intValidator.setRange(1, 999)
        # 创建浮点验证器
        doubleValidator = QDoubleValidator()
        doubleValidator.setRange(1, 999)
        # 标准符号
        doubleValidator.setNotation(QDoubleValidator.StandardNotation)
        # 保留两位小数
        doubleValidator.setDecimals(2)
        # 创建表达式验证器
        regExp = QRegExpValidator()
        regExp.setRegExp(QRegExp('^[a-zA-Z]*[0-9]{2}'))

        # 设置验证器
        intLineEdit.setValidator(intValidator)
        DoubleLineEdit.setValidator(doubleValidator)
        RegExpLineEdit1.setValidator(regExp)
        RegExpLineEdit2.setValidator(regExp)

        # 布局放入窗口
        self.setLayout(formLayout)
 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
예제 #29
0
    def create_top_order_form(self):
        """
        Create the QFormLayout object containing the static form entries at the top
        Entries: Date, postcode, order amount, ebay amount, paypal amount and the postage and packing amount
        
        Called in self.__init__() above
        
        Returns:
            QFormLayout object
        """
        form = widgets.QFormLayout()

        #date input
        yesterday = dt.date.today() - dt.timedelta(days=1)
        self.dateEdit = widgets.QLineEdit("{:%d/%m/%Y}".format(yesterday))
        form.addRow(widgets.QLabel("Date"), self.dateEdit)

        #postcode input
        self.postcodeEdit = widgets.QLineEdit()
        self.postcodeEdit.editingFinished.connect(self.check_postcode)
        form.addRow(widgets.QLabel("Postcode"), self.postcodeEdit)

        #order amount input
        cost_val = QDoubleValidator(0, 999999, 2)
        self.orderAmountEdit = widgets.QLineEdit()
        self.orderAmountEdit.setValidator(cost_val)
        self.orderAmountEdit.editingFinished.connect(self.set_outlays)
        form.addRow(widgets.QLabel("Total amount, £"), self.orderAmountEdit)

        #ebay cut
        self.ebayCutEdit = widgets.QLineEdit()
        self.ebayCutEdit.setValidator(cost_val)
        form.addRow(widgets.QLabel("Ebay cut, £"), self.ebayCutEdit)

        #paypal cut
        self.paypalCutEdit = widgets.QLineEdit()
        self.paypalCutEdit.setValidator(cost_val)
        form.addRow(widgets.QLabel("Paypal cut, £"), self.paypalCutEdit)

        # #Postage and packing
        # post_and_pack_cost_default = self.POSTAGE_COST + self.PACKING_COST
        # self.ppEdit = widgets.QLineEdit("{:.2f}".format(post_and_pack_cost_default))
        # self.ppEdit.setValidator(cost_val)
        # form.addRow(widgets.QLabel("P&P cost, £"), self.ppEdit)

        return form
예제 #30
0
    def add_decimal_input(self, text, attribute, min_val, max_val):
        line_edit = QLineEdit(self)
        layout = self.create_labeled_widget(self, text, line_edit)

        line_edit.setValidator(QDoubleValidator(min_val, max_val, 6, self))

        def input_edited():
            text = line_edit.text()
            print("input:", text)
            self.catch_text_update()
            setattr(self.bound_to, attribute, float(text))

        line_edit.editingFinished.connect(input_edited)

        self.vbox.addLayout(layout)

        return line_edit
예제 #31
0
 def __init__(self,
              decimals=2,
              is_required=True,
              column_name=None,
              parent=None,
              *args,
              **kwargs):
     QLineEdit.__init__(self, parent=parent)
     BaseEdit.__init__(self,
                       is_required=is_required,
                       field_type=BaseEdit.DECIMAL,
                       *args,
                       **kwargs)
     self.column_name = column_name
     self.decimals = decimals
     self.setText('0.00')
     self.setValidator(QDoubleValidator())
예제 #32
0
    def createEditor(self, parent, option, index):
        # create the appropriate widget based on the datatype
        dataType = index.data(Qt.UserRole + 1)
        self.hintSize = QSize(option.rect.width(), option.rect.height())
        if dataType == DataType.INT.value:
            self.editor = QLineEdit(parent)
            self.editor.setValidator(QIntValidator())
        elif dataType == DataType.FLOAT.value:
            self.editor = QLineEdit(parent)
            self.editor.setValidator(QDoubleValidator())
        elif dataType == DataType.STRING.value:
            self.editor = QLineEdit(parent)
        elif dataType == DataType.BOOLEAN.value:
            self.editor = QComboBox(parent)
            self.editor.addItems(self.booleanItems)
        elif dataType == DataType.POINTWGS84.value:
            self.editor = FrmGPoint(parent)
            self.editor.setAutoFillBackground(True)
            self.hintSize = QSize(300, 40)
        elif dataType == DataType.POINTCARTESIAN.value:
            self.editor = FrmPoint(parent)
            self.editor.setAutoFillBackground(True)
            self.hintSize = QSize(300, 40)
        elif dataType == DataType.TIME.value:
            #            self.editor = FrmTime(parent=parent, tz=True)
            self.editor = QLineEdit(parent)
        elif dataType == DataType.LOCALTIME.value:
            #            self.editor = FrmTime(parent=parent, tz=False)
            self.editor = QLineEdit(parent)
        elif dataType == DataType.DATE.value:
            self.editor = QDateTimeEdit(parent)
            self.editor.setCalendarPopup(True)
            self.editor.setDisplayFormat("yyyy/MM/dd")
        elif dataType == DataType.DATETIME.value:
            #            self.editor = QDateTimeEdit(parent)
            #            self.editor.setCalendarPopup(False)
            #            self.editor.setDisplayFormat("yyyy-MM-dd hh:mm:ss:zzz")
            self.editor = QLineEdit(parent)
        elif dataType == DataType.LOCALDATETIME.value:
            self.editor = QLineEdit(parent)
        elif dataType == DataType.DURATION.value:
            self.editor = QLineEdit(parent)
        else:
            self.editor = QLineEdit(parent)

        return self.editor
예제 #33
0
    def setup_ui(self):
        self.setWindowTitle(f"Remove Outliers")
        self.setMinimumWidth(500)
        self.setModal(True)

        layout = QFormLayout(self)

        # Skip/Only
        self.skiponly_label = QLabel(self)
        self.skiponly_label.setText(
            f"Using all {len(list(self.dataset.df)):,} variables")
        self.btn_skiponly = QPushButton("Edit", parent=self)
        self.btn_skiponly.clicked.connect(self.launch_skiponly)
        layout.addRow(self.skiponly_label, self.btn_skiponly)

        # Data Name
        self.le_data_name = QLineEdit(self.data_name)
        self.le_data_name.setPlaceholderText(
            self.appctx.datasets[self.appctx.current_dataset_idx].name)
        self.le_data_name.textChanged.connect(self.update_data_name)
        layout.addRow("Save Dataset Name: ", self.le_data_name)

        # Method used to remove outliers
        self.method_cb = QComboBox(parent=self)
        for method in self.method_options_display:
            self.method_cb.addItem(method)
        self.method_cb.currentIndexChanged.connect(self.update_method)
        layout.addRow("Outlier Method: ", self.method_cb)

        # Cutoff
        self.cutoff_input = QLineEdit(parent=self)
        self.cutoff_input.setText(f"{self.cutoff}")
        self.cutoff_input.setValidator(QDoubleValidator(bottom=0))
        self.cutoff_input.textChanged.connect(self.update_cutoff)
        layout.addRow("Cutoff Value: ", self.cutoff_input)

        # Ok/Cancel
        QBtn = QDialogButtonBox.Ok | QDialogButtonBox.Cancel

        self.buttonBox = QDialogButtonBox(QBtn)
        layout.addRow(self.buttonBox)
        self.buttonBox.accepted.connect(self.submit)
        self.buttonBox.rejected.connect(self.reject)

        # Set Layout
        self.setLayout(layout)
    def createList(self):
        self.lineEdit_list = []
        self.lineEdit_list.append(self.ui.lineEdit_0)
        self.lineEdit_list.append(self.ui.lineEdit_1)
        self.lineEdit_list.append(self.ui.lineEdit_2)
        self.lineEdit_list.append(self.ui.lineEdit_3)
        self.lineEdit_list.append(self.ui.lineEdit_4)
        self.lineEdit_list.append(self.ui.lineEdit_5)
        self.lineEdit_list.append(self.ui.lineEdit_6)
        self.lineEdit_list.append(self.ui.lineEdit_7)
        self.lineEdit_list.append(self.ui.lineEdit_8)
        self.lineEdit_list.append(self.ui.lineEdit_9)
        self.lineEdit_list.append(self.ui.lineEdit_10)
        self.lineEdit_list.append(self.ui.lineEdit_11)
        self.lineEdit_list.append(self.ui.lineEdit_12)
        self.lineEdit_list.append(self.ui.lineEdit_13)
        self.lineEdit_list.append(self.ui.lineEdit_14)
        self.lineEdit_list.append(self.ui.lineEdit_15)
        self.lineEdit_list.append(self.ui.lineEdit_16)
        self.lineEdit_list.append(self.ui.lineEdit_17)
        self.lineEdit_list.append(self.ui.lineEdit_18)
        self.lineEdit_list.append(self.ui.lineEdit_19)
        self.lineEdit_list.append(self.ui.lineEdit_20)
        self.lineEdit_list.append(self.ui.lineEdit_21)
        self.lineEdit_list.append(self.ui.lineEdit_22)
        self.lineEdit_list.append(self.ui.lineEdit_23)
        # 将lineEdit限制为仅接受浮点数输入
        for i in range(0,24):
            self.lineEdit_list[i].setValidator(QDoubleValidator())
        self.ui.lineEdit_2.setValidator(QIntValidator())
        self.button_list = []
        self.button_list.append(self.ui.open_Button)
        self.button_list.append(self.ui.close_Button)
        self.button_list.append(self.ui.modeOnl_radioButton)
        self.button_list.append(self.ui.modeOpen_radioButton)
        self.button_list.append(self.ui.modeShor_radioButton)
        self.button_list.append(self.ui.fixed_radioButton)
        self.button_list.append(self.ui.linear_radioButton)
        self.button_list.append(self.ui.nonlinear_radioButton)
        self.button_list.append(self.ui.ohm_checkBox)
#        self.button_list.append(self.ui.read_Button)
        self.button_list.append(self.ui.write_Button)
        self.button_list.append(self.ui.create_Button)
        self.button_list.append(self.ui.port_Box)
        self.button_list.append(self.ui.baudRate_Box)
        self.button_list.append(self.ui.file_Box)
예제 #35
0
	def __init__(self, parent=None):
		super(lineEditDemo, self).__init__(parent)
		self.setWindowTitle("QLineEdit例子")

		flo = QFormLayout()
		pIntLineEdit  = QLineEdit( )
		pDoubleLineEdit  = QLineEdit()
		pValidatorLineEdit  = QLineEdit( )

		flo.addRow("整形", pIntLineEdit)
		flo.addRow("浮点型", pDoubleLineEdit)
		flo.addRow("字母和数字", pValidatorLineEdit)
        
		pIntLineEdit.setPlaceholderText("整形");
		pDoubleLineEdit.setPlaceholderText("浮点型");
		pValidatorLineEdit.setPlaceholderText("字母和数字");

		# 整形 范围:[1, 99]
		pIntValidator = QIntValidator(self)
		pIntValidator.setRange(1, 99)

		# 浮点型 范围:[-360, 360] 精度:小数点后2位
		pDoubleValidator = QDoubleValidator(self)
		pDoubleValidator.setRange(-360, 360)
		pDoubleValidator.setNotation(QDoubleValidator.StandardNotation)
		pDoubleValidator.setDecimals(2)
		
		# 字符和数字
		reg = QRegExp("[a-zA-Z0-9]+$")
		pValidator = QRegExpValidator(self)
		pValidator.setRegExp(reg)	

        # 设置验证器
		pIntLineEdit.setValidator(pIntValidator)
		pDoubleLineEdit.setValidator(pDoubleValidator)
		pValidatorLineEdit.setValidator(pValidator)
		                    
		self.setLayout(flo)                        
예제 #36
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