Esempio n. 1
0
 def _createNumberOfPixelsToAverage(self, layout, row, silent=False):
     logger.debug(METHOD_ENTER_STR)
     label = qtWidgets.QLabel("Number of Pixels To Average:")
     self.pixAvgTxt = qtWidgets.QLineEdit("1,1")
     rxAvg = qtCore.QRegExp(self.PIX_AVG_REGEXP_1)
     self.pixAvgTxt.setValidator(
         qtGui.QRegExpValidator(rxAvg, self.pixAvgTxt))
     if (silent == False):
         layout.addWidget(label, row, 0)
         layout.addWidget(self.pixAvgTxt, row, 1)
     logger.debug(METHOD_EXIT_STR)
Esempio n. 2
0
 def toggle_filter(self, column, text):
     """ Toggle filtering """
     self.filter_model.modelAboutToBeReset.emit()
     model = self.model()
     text = qtcore.QRegExp('^' + text + '$')
     if model.filterRegExp() == text and model.filterKeyColumn() == column:
         self.remove_filter()
     else:
         model.setFilterKeyColumn(column)
         model.setFilterRegExp(text)
     self.filter_model.modelReset.emit()
Esempio n. 3
0
 def get_filter_proxy_model(self, chosen_filter):
     filter_proxy_model = QtCore.QSortFilterProxyModel()
     if chosen_filter in ("Movimiento", "Destino", "Usuario"):
         filter_and_column = {"Movimiento": 2, "Destino": 5, "Usuario": 6}
         filter_proxy_model.setFilterKeyColumn(
             filter_and_column[chosen_filter])
     elif chosen_filter == "Componente":
         filter_proxy_model.setFilterRegExp(
             QtCore.QRegExp(self.comp_field.text()))
         filter_proxy_model.setFilterKeyColumn(3)
     return filter_proxy_model
Esempio n. 4
0
    def input_train_params(self, use_random_data=True):
        self.input_params = QtWidgets.QDialog(self)
        self.input_params.setWindowTitle("Set training parameters...")
        self.input_params.setFixedSize(450, 200)

        explanation_text = QtWidgets.QLabel(
            "Please enter model parameters below.\
                                            Choose a name to save the model as (max 255 chars, alphanumeric only)\
                                            and the number of epochs to train the model for (int only)."
        )
        explanation_text.setWordWrap(True)

        name_label = QtWidgets.QLabel("Model name")
        name_input = QtWidgets.QLineEdit()
        name_input.setValidator(
            QtGui.QRegExpValidator(QtCore.QRegExp(
                "[A-Za-z0-9_]{0,255}")))  # only up to 255 alphanumeric chars
        name_group = QtWidgets.QHBoxLayout()
        name_group.addWidget(name_label)
        name_group.addWidget(name_input)

        epoch_label = QtWidgets.QLabel("# training epochs")
        epoch_input = QtWidgets.QLineEdit()
        epoch_input.setValidator(QtGui.QIntValidator())  # int only
        epoch_group = QtWidgets.QHBoxLayout()
        epoch_group.addWidget(epoch_label)
        epoch_group.addWidget(epoch_input)

        # buttons
        cancel_btn = QtWidgets.QPushButton("Cancel")
        cancel_btn.clicked.connect(self.input_params.close)

        ok_btn = QtWidgets.QPushButton("OK")

        button_layout = QtWidgets.QHBoxLayout()
        button_layout.addWidget(cancel_btn)
        button_layout.addWidget(ok_btn)

        layout = QtWidgets.QVBoxLayout()
        layout.addWidget(explanation_text)
        layout.addLayout(name_group)
        layout.addLayout(epoch_group)
        layout.addLayout((button_layout))

        self.input_params.setLayout(layout)

        if not use_random_data:
            ok_btn.clicked.connect(lambda: self.check_nonempty_inputs(
                [name_input.text(), epoch_input.text()], False))
        else:
            ok_btn.clicked.connect(lambda: self.check_nonempty_inputs(
                [name_input.text(), epoch_input.text()]))

        self.input_params.exec_()
Esempio n. 5
0
    def __init__(self):
        super(Window, self).__init__()
        self.setGeometry(100, 100, 800, 600)
        self.setWindowTitle("Qregexp test")
        # self.show()

        path = "/home/mate/develop/odaide/ODA-IDE2/editor.cpp"
        file = open()

        rex = ""
        regexp = QtCore.QRegExp()
Esempio n. 6
0
 def initUI_1(self):
     self.main_win.resize(824, 534)
     #self.stack = QtWidgets.QStackedLayout(self)
     self.label1 = QtWidgets.QLabel("Login", self.main_win)
     self.login = QtWidgets.QLineEdit(self.main_win)
     self.login.setGeometry(QtCore.QRect(300, 140, 331, 71))
     self.login.setValidator(
         QtGui.QRegExpValidator(
             QtCore.QRegExp("([A-Za-z0-9]+)@([A-Za-z]+).([A-Za-z]{2})")))
     self.label1.setGeometry(QtCore.QRect(250, 145, 60, 20))
     self.label2 = QtWidgets.QLabel("Password", self.main_win)
     self.label2.setGeometry(QtCore.QRect(230, 245, 60, 20))
     self.password = QtWidgets.QLineEdit(self.main_win)
     self.password.setGeometry(QtCore.QRect(300, 240, 331, 71))
     self.password.setEchoMode(QtWidgets.QLineEdit.Password)
     self.password.setValidator(
         QtGui.QRegExpValidator(QtCore.QRegExp("[A-Za-z0-9]+")))
     self.button = QtWidgets.QPushButton(self.main_win)
     self.button.setGeometry((QtCore.QRect(300, 340, 331, 71)))
     self.button.setText("OK")
Esempio n. 7
0
 def on_signalMapper_mapped(self, i):
     # stringAction = self.signalMapper.mapping(i).text()
     stringActions = '|'.join([x.text() for x in getattr(self, '_' + str(self.logicalIndex) + 'Menu').actions() if x.isChecked()])
     filterColumn = self.logicalIndex
     print(stringActions)
     filterString = QtCore.QRegExp(  stringActions,
                                     QtCore.Qt.CaseSensitive,
                                     # QtCore.QRegExp.FixedString
                                     )
     self.proxy.setFilterRegExp(filterString)
     self.proxy.setFilterKeyColumn(filterColumn)
Esempio n. 8
0
File: ifl.py Progetto: Zhxhh/ida_ifl
    def filterByColumn(self, col_num, str) -> None:
        """Applies a filter defined by the string on data model.
        """

        filter_type = QtCore.QRegExp.FixedString
        sensitivity = QtCore.Qt.CaseInsensitive
        if self.criterium_id != 0:
            filter_type = QtCore.QRegExp.RegExp
        self.addr_sorted_model.setFilterRegExp(
            QtCore.QRegExp(str, sensitivity, filter_type))
        self.addr_sorted_model.setFilterKeyColumn(col_num)
Esempio n. 9
0
    def generateLabels(self, layout):
        self.dic = {}
        checkedNodes = self.home.modifyNodes  # (pydot,name,child)
        for node in checkedNodes:
            nodeName = node.name
            ph = QtWidgets.QLineEdit()
            date = QtWidgets.QLineEdit()
            notes = QtWidgets.QPlainTextEdit()
            self.dic[nodeName] = [ph, date, notes]
        for node in checkedNodes:
            nodeName = node.name
            ph, date, notes = self.dic[nodeName]
            mediaLayout = QVBoxLayout()
            label = QLabel(
                "<html><head/><body><p align=\"center\"><span style=\" font-size:14pt; color:#ff55ff;\">{}</span></p><p align=\"center\"><br/></p></body></html>"
                .format(nodeName))
            label.setTextFormat(QtCore.Qt.RichText)
            mediaLayout.addWidget(label)
            smallLayout = QVBoxLayout()

            # ph
            phLayout = QHBoxLayout()
            phLayout.addWidget(QLabel("pH:   "))
            ph.validator = Validator(ph)
            ph.setText("")
            ph.textChanged.connect(partial(self.checkState, ph))
            ph.textChanged.emit(ph.text())
            phLayout.addWidget(ph)
            smallLayout.addLayout(phLayout)

            # date
            dateLayout = QHBoxLayout()
            dateLayout.addWidget(QLabel("Date: "))
            regex = QtCore.QRegExp(
                "^\d{4}[\-\/\s]?((((0[13578])|(1[02]))[\-\/\s]?(([0-2][0-9])|(3[01])))|(((0[469])|(11))[\-\/\s]?(([0-2][0-9])|(30)))|(02[\-\/\s]?[0-2][0-9]))$"
            )
            date.validator = QtGui.QRegExpValidator(regex)
            date.setText("")
            date.textChanged.connect(partial(self.checkState, date))
            date.textChanged.emit(date.text())
            dateLayout.addWidget(date)
            smallLayout.addLayout(dateLayout)

            # notes
            notesLayout = QHBoxLayout()
            notesLayout.addWidget(QLabel("Notes: "))
            notesLayout.addWidget(notes)
            smallLayout.addLayout(notesLayout)

            mediaLayout.addLayout(smallLayout)
            mediaLayout.addSpacing(20)
            layout.addLayout(mediaLayout)
            layout.addSpacing(40)
        return
Esempio n. 10
0
 def On_PortNumber_EditingFinished(self):
     regEx = QtCore.QRegExp("\\d*")
     arg1 = self.portNumber.text()
     if regEx.exactMatch(arg1) and int(arg1) <= 5050 and int(arg1) >= 5000:
         self.m_sPortNumber = arg1
     else:
         self.portNumber.setText(self.m_sPortNumber)
         self.logger.warn(
             arg1 +
             ": Invalid Port Number Value, must be a number between 5000 and 5050"
         )
     self.logger.debug("PortNumber has been changed")
Esempio n. 11
0
    def textFilterChanged(self):
        if self.filterSyntaxCheckBox.isChecked():
            syntax = QtCore.QRegExp.PatternSyntax(QtCore.QRegExp.RegExp)
        else:
            syntax = QtCore.QRegExp.PatternSyntax(QtCore.QRegExp.FixedString)

        caseSensitivity = (self.filterCaseSensitivityCheckBox.isChecked()
                           and QtCore.Qt.CaseSensitive
                           or QtCore.Qt.CaseInsensitive)
        regExp = QtCore.QRegExp(self.filterPatternLineEdit.text(),
                                caseSensitivity, syntax)
        self.qMainTreev.proxyModel.setFilterRegExp(regExp)
Esempio n. 12
0
    def init_ui(self):
        self.midTitle = QtWidgets.QLabel('Add A Basic Item:')

        self.itemNameLab = QtWidgets.QLabel('Item Name:')
        self.itemNameLe = QtWidgets.QLineEdit(self)
        regexp = QtCore.QRegExp('[a-z_]{1,20}')
        validator = QtGui.QRegExpValidator(regexp)
        self.itemNameLe.setValidator(validator)

        self.itemInvTabLab = QtWidgets.QLabel('Inventory Tab:')
        self.itemInvTabPicker = self.loadInvTabPicker()

        self.itemInGameNameLab = QtWidgets.QLabel('Item In Game Name:')
        self.itemInGameNameLe = QtWidgets.QLineEdit(self)

        self.toggleTextureTypeLab = QtWidgets.QLabel('Texture Type:')
        self.toggleTextureTypeBtn = QtWidgets.QPushButton("Saved Texture")
        self.toggleTextureTypeBtn.setCheckable(True)
        self.toggleTextureTypeBtn.setToolTip(
            "Press to use pre-existing texture.")

        self.itemTypeTab = QtWidgets.QWidget()
        self.itemSpecificTextureTab = QtWidgets.QWidget()
        self.textureTabs = QtWidgets.QTabWidget()
        self.textureTabs.addTab(self.itemTypeTab, "Auto-Generated Texture")
        self.textureTabs.addTab(self.itemSpecificTextureTab, "Saved Texture")

        self.itemTypeLab = QtWidgets.QLabel('Select Item Type:')
        self.itemTypePicker = self.loadTypePicker()

        self.itemColorLab = QtWidgets.QLabel('Select Item Color:')
        self.itemColorPicker = self.loadColorPicker()
        self.itemColor = QtGui.QColor(0, 0, 0)

        self.itemTextureLab = QtWidgets.QLabel('Select Texture:')
        self.itemTextureDirPicker = QtWidgets.QComboBox(self)
        self.itemTextureDirPicker.addItem("Select Directory")
        self.itemTextureDir = ""

        self.itemSubmitButton = QtWidgets.QPushButton("Add Item")
        self.itemCloseButton = QtWidgets.QPushButton("Close Item Adder")

        self.main_v_box = self.addBasicItemLayout()
        self.setLayout(self.main_v_box)

        self.toggleTextureTypeBtn.clicked[bool].connect(self.toggleTextureType)
        self.itemTextureDirPicker.activated[str].connect(self.pickTexture)
        self.itemTypePicker.activated[str].connect(self.pickType)
        self.itemColorPicker.activated[str].connect(self.pickColor)
        self.itemSubmitButton.clicked.connect(self.runAddItem)
        self.itemCloseButton.clicked.connect(self.runClose)

        self.setWindowTitle('MC Mod Maker')
Esempio n. 13
0
    def __init__(self, *args, obj=None, **kwargs):
        super(MainWindow, self).__init__(*args, **kwargs)
        self._controller = Controller()
        self.setupUi(self)

        self.load_state()
        filetag_validator = QRegExpValidator(QtCore.QRegExp(r'^[\w\-. ]+$'))
        self.lineEdit_Frequency.setValidator(QDoubleValidator(100, 1E6, 1))
        self.lineEdit_FileTag.setValidator(filetag_validator)
        self.actionTest.triggered.connect(self.open_test_dialog)
        self.pushButton_ChangeDir.clicked.connect(self.folder_dialog)
        self.pushButton_Power.clicked.connect(self.connect_devices)
        self.pushButton_StartMeasurement.clicked.connect(
            self.start_measurement)
        self.pushButton_AbortMeasurement.clicked.connect(self.stop_measurement)
        # Disable acquisition buttons until the devices are connected and the params are validated
        self.pushButton_AbortMeasurement.setEnabled(False)
        self.pushButton_StartMeasurement.setEnabled(False)
        self.doubleSpinBox_OscLevelStart.valueChanged.connect(
            self.validate_fields)
        self.doubleSpinBox_OscLevelStep.valueChanged.connect(
            self.validate_fields)
        self.doubleSpinBox_OscLevelStop.valueChanged.connect(
            self.validate_fields)
        self.doubleSpinBox_NominalBiasStart.valueChanged.connect(
            self.validate_fields)
        self.doubleSpinBox_NominalBiasStep.valueChanged.connect(
            self.validate_fields)
        self.doubleSpinBox_NominalBiasStop.valueChanged.connect(
            self.validate_fields)

        self.action_Connect_Devices.triggered.connect(self.connect_devices)
        self.action_Disconnect_Devices.triggered.connect(
            self.disconnect_devices)
        self.action_Load_Acquisition_Settings.triggered.connect(
            self.load_acquisition_parameters)
        self.actionS_ave_Acquisition_Settings.triggered.connect(
            self.save_acquisition_parameters)
        self.actionSelect_Save_F_older.triggered.connect(self.folder_dialog)
        self.actionStart.setEnabled(False)
        self.actionSto_p.setEnabled(False)

        self.sc = DynamicMplCanvas(parent=self.widgetCVPlot,
                                   width=5.27,
                                   height=3.25,
                                   dpi=100)
        # Create toolbar, passing canvas as first parament, parent (self, the MainWindow) as second.
        self.addToolBar(NavigationToolbar(self.sc, self.widgetCVPlot))
        self.sc.axes.set_xlabel('Oscillator Level (mV p-p)')
        self.sc.axes.set_ylabel('Capacitance (F)')
        self.statusBar().showMessage('Disconnected')
        self.plainTextEdit_SaveFolder.setPlainText(self._folder)
        self.setFixedSize(self.size())
Esempio n. 14
0
    def on_text_changed(self):
        filter = self.filter.text()
        self.regex = re.compile("(%s)" % (re.escape(filter)),
                                flags=re.IGNORECASE)
        self.regex_pattern = filter
        self.proxyModel.setFilterRegExp(
            QtCore.QRegExp(filter, QtCore.Qt.CaseInsensitive,
                           QtCore.QRegExp.FixedString))

        #self.lst.currentIndex()
        self.select(0)
        self.lst.viewport().update()
Esempio n. 15
0
    def __init__(self, parent=None):
        QtWidgets.QDialog.__init__(self, parent)
        self.ui = Ui_Form()
        self.ui.setupUi(self)

        self.validatorMess = QtGui.QRegExpValidator(
            QtCore.QRegExp("[а-я,А-Я,\s]+"), self)
        self.ui.lineEditMess.setValidator(self.validatorMess)

        self.ui.btnCrypt.clicked.connect(self.on_clicked_btnCrypt)
        self.ui.btnKeyGen.clicked.connect(self.on_clicked_btnKeyGen)
        self.ui.btnCrypt.blockSignals(True)
Esempio n. 16
0
 def line_search_textChanged(self, text):
     # если combo_db пуст, то не добавлена база или нет таблиц в базе т.е. фильтр - ошибка
     if self.combo_dbase.currentIndex() < 0:
         self.line_search.setText('')
         self.statusBar().showMessage(
             'Не выбрана база данных или отсутсвуют таблицы!')
     else:
         self.model.select()
         search = QtCore.QRegExp(text, QtCore.Qt.CaseInsensitive,
                                 QtCore.QRegExp.RegExp)
         self.proxy.setFilterRegExp(search)
         self.rowCount_in_statusBar()
Esempio n. 17
0
    def initUI(self):
        super().initUI()

        self.definition.insertPlainText(playfair_txt)
        self.cb_method.addItem("Encrypt")
        self.cb_method.addItem("Decrypt")
        self.cb_method.currentIndexChanged.connect(self.selectionChange)
        self.btn_encrypt.clicked.connect(self.encrypt)

        regex = QtCore.QRegExp("^[a-zA-Z]+$")
        validator = QtGui.QRegExpValidator(regex, self.plaintext)
        self.plaintext.setValidator(validator)
Esempio n. 18
0
    def __init__(self, parent=None, guiWindow=None):
        super(PredictionToolManager, self).__init__(parent)
        self.setupUi(self)
        self.guiWindow = guiWindow

        self.a4Validator = QtGui.QRegExpValidator()

        regExp = QtCore.QRegExp(
            r'(-?[0-9]*\.[0-9]+|-?[0-9]+)(,(-?[0-9]*\.[0-9]+|-?[0-9]+))*')
        self.a4Validator.setRegExp(regExp)

        self.initPredictionToolManager()
Esempio n. 19
0
 def __init__(self):
     super(XrecogCaptureWindow, self).__init__()
     uic.loadUi(translatePath("capture.ui"), self)
     self.images = []
     self.imageSlots = []
     self.selected_camera = None
     self.camera = None
     self.capture = None
     self.hasInit = False
     slots = [
         self.imageGrid.findChildren(
             QtWidgets.QWidget, QtCore.QRegExp("imageSlot%02d" % index))[0]
         for index in range(1, 13)
     ]
     for slot in slots:
         newSizePolicy = slot.sizePolicy()
         newSizePolicy.setRetainSizeWhenHidden(True)
         slot.setSizePolicy(newSizePolicy)
         slot.setAttribute(QtCore.Qt.WA_Hover)
         slot.installEventFilter(self)
         slot.hide()
         imageSlot = slot.findChild(QtWidgets.QLabel)
         imageToolbar = slot.findChildren(
             QtWidgets.QHBoxLayout,
             QtCore.QRegExp("imageSlotToolBar\d{2}"))[0]
         previewButton = slot.findChildren(
             QtWidgets.QToolButton,
             QtCore.QRegExp("viewImageButton\d{2}"))[0]
         deleteButton = slot.findChildren(
             QtWidgets.QToolButton, QtCore.QRegExp("deleteButton\d{2}"))[0]
         previewButton.hide()
         deleteButton.hide()
         slotObject = {"object": slot, "item": None}
         previewButton.clicked.connect(self.newPreviewHandler(slotObject))
         deleteButton.clicked.connect(self.newDeleteHandler(slotObject))
         self.imageSlots.append(slotObject)
     self.imagepreviewer = XrecogImagePreviewDialog(self)
     self.viewfinder = QtMultimediaWidgets.QCameraViewfinder()
     self.viewFinderFrame.layout().addWidget(self.viewfinder)
     self.installEventFilter(self)
Esempio n. 20
0
    def _setupTextInputRestrict(cls):
        if cls.__inputValidatorSetted:  # 已经设置过了
            return
        cls.__inputValidatorSetted = True

        ncRegx = QtCore.QRegExp(r"[a-zA-Z\d]+")  # 匹配数字和字母的组合
        cls.ncRegxValidator = QtGui.QRegExpValidator(ncRegx)

        intRegx = QtCore.QRegExp(r"(^(?!0)\-?\d+)|0")  # 不以0开头除非是0,包含负数
        cls.intRegxValidator = QtGui.QRegExpValidator(intRegx)

        npRegx = QtCore.QRegExp(r"(^(?!0)\d+)|0")  # 不以0开头除非是0,不包含负数
        cls.npRegxValidator = QtGui.QRegExpValidator(npRegx)

        # .123或123.或123.123或0.123或0,其实0可以不单独写出来,但如果要在别的地方用还是要的
        # 有一种特殊情况要排除,就是只有一个'.',这样是不能转换为浮点数的,要么默认这个为0,要么为非法输入
        # 单个'.'就认为是0了
        floatRegx = QtCore.QRegExp(r"(^(?!0)\-?\d*\.?\d*)|(^\-?(0\.)\d*)|0")
        cls.floatRegxValidator = QtGui.QRegExpValidator(floatRegx)
        # float;float;...
        # 是基于floatRegx改过来的,也有单个'.'的情况
        floatListRegx = QtCore.QRegExp(
            r"^(?!;)((((?!0)\-?\d*\.?\d*)|(\-?(0\.)\d*)|0);(?!;))*(((?!0)\-?\d*\.?\d*)|(\-?(0\.)\d*)|0)")
        cls.floatListRegxValidator = QtGui.QRegExpValidator(floatListRegx)

        # 两个浮点数,float-float
        twoFloatRegx = QtCore.QRegExp(
            r"^(?!;)((((?!0)\-?\d*\.?\d*)|(\-?(0\.)\d*)|0);(?!;))?(((?!0)\-?\d*\.?\d*)|(\-?(0\.)\d*)|0)")
        cls.twoFloatRegxValidator = QtGui.QRegExpValidator(twoFloatRegx)
Esempio n. 21
0
 def __init__(self, document):
     super().__init__(document)
     self.func_re = QtCore.QRegExp(r"\$(?!noop)[a-zA-Z][_a-zA-Z0-9]*\(")
     self.func_fmt = QtGui.QTextCharFormat()
     self.func_fmt.setFontWeight(QtGui.QFont.Bold)
     self.func_fmt.setForeground(Qt.blue)
     self.var_re = QtCore.QRegExp(r"%[_a-zA-Z0-9:]*%")
     self.var_fmt = QtGui.QTextCharFormat()
     self.var_fmt.setForeground(Qt.darkCyan)
     self.escape_re = QtCore.QRegExp(r"\\.")
     self.escape_fmt = QtGui.QTextCharFormat()
     self.escape_fmt.setForeground(Qt.darkRed)
     self.special_re = QtCore.QRegExp(r"[^\\][(),]")
     self.special_fmt = QtGui.QTextCharFormat()
     self.special_fmt.setForeground(Qt.blue)
     self.bracket_re = QtCore.QRegExp(r"[()]")
     self.noop_re = QtCore.QRegExp(r"\$noop\(")
     self.noop_fmt = QtGui.QTextCharFormat()
     self.noop_fmt.setFontWeight(QtGui.QFont.Bold)
     self.noop_fmt.setFontItalic(True)
     self.noop_fmt.setForeground(Qt.darkGray)
     self.rules = [
         (self.func_re, self.func_fmt, 0, -1),
         (self.var_re, self.var_fmt, 0, 0),
         (self.escape_re, self.escape_fmt, 0, 0),
         (self.special_re, self.special_fmt, 1, -1),
     ]
Esempio n. 22
0
    def initWindow(self):
        detecMode = int(self.conf.ConfigSectionMap('App')['detectionmode'])
        if detecMode == 2:  #加载检测结果模式
            self.displayDetectResultUI()
        else:
            self.displayDetectUI()

        # 检测参数文本框
        reg_ex = QtCore.QRegExp("[0-9]{1,4}")
        input_validator = QRegExpValidator(reg_ex,
                                           self.ui.lineEditDetectWindowSize)
        self.ui.lineEditDetectWindowSize.setValidator(input_validator)
        reg_ex = QtCore.QRegExp("[0][.][3-5]")
        input_validator = QRegExpValidator(reg_ex, self.ui.lineEditNMS)
        self.ui.lineEditNMS.setValidator(input_validator)

        # 路径选择文本框
        self.ui.lineEditInputPath.setReadOnly(True)
        self.ui.lineEditOutPutPath.setReadOnly(True)
        # 检测结果路径选择文本框
        self.ui.lineEditDetectResult.setReadOnly(True)
        # 模态窗口
        self.setWindowModality(QtCore.Qt.ApplicationModal)

        # 按钮事件
        self.ui.radioButtonSingleDetectMode.clicked.connect(
            self.radioButtonModeSelect)
        self.ui.radioButtonBatchDetectMode.clicked.connect(
            self.radioButtonModeSelect)
        self.ui.radioButtonLoadDetectResult.clicked.connect(
            self.radioButtonModeSelect)

        self.ui.pushButtonOk.clicked.connect(self.clickOK)
        self.ui.pushButtonCancel.clicked.connect(self.clickCancel)

        self.ui.pushButtonPathSelect4Input.clicked.connect(self.selInputPath)
        self.ui.pushButtonPathSelect4Output.clicked.connect(self.selOutputPath)

        self.ui.pushButtonPathSelect4DetectResult.clicked.connect(
            self.selResultPath)
Esempio n. 23
0
    def __init__(self, parent=None):
        super(PythonHighlighter, self).__init__(parent)

        keywordFormat = QtGui.QTextCharFormat()
        keywordFormat.setForeground(QtCore.Qt.darkBlue)
        keywordFormat.setFontWeight(QtGui.QFont.Bold)
        for pattern in ((r"\band\b", r"\bas\b", r"\bassert\b", r"\bbreak\b",
                         r"\bclass\b", r"\bcontinue\b", r"\bdef\b", r"\bdel\b",
                         r"\belif\b", r"\belse\b", r"\bexcept\b", r"\bexec\b",
                         r"\bfinally\b", r"\bfor\b", r"\bfrom\b",
                         r"\bglobal\b", r"\bif\b", r"\bimport\b", r"\bin\b",
                         r"\bis\b", r"\blambda\b", r"\bnot\b", r"\bor\b",
                         r"\bpass\b", r"\bprint\b", r"\braise\b",
                         r"\breturn\b", r"\btry\b", r"\bwhile\b", r"\bwith\b",
                         r"\byield\b")):
            PythonHighlighter.Rules.append(
                (QtCore.QRegExp(pattern), keywordFormat))
        commentFormat = QtGui.QTextCharFormat()
        commentFormat.setForeground(QtGui.QColor(0, 127, 0))
        commentFormat.setFontItalic(True)
        PythonHighlighter.Rules.append((QtCore.QRegExp(r"#.*"), commentFormat))
        self.stringFormat = QtGui.QTextCharFormat()
        self.stringFormat.setForeground(QtCore.Qt.darkYellow)
        stringRe = QtCore.QRegExp(r"""(?:'[^']*'|"[^"]*")""")
        stringRe.setMinimal(True)
        PythonHighlighter.Rules.append((stringRe, self.stringFormat))
        self.stringRe = QtCore.QRegExp(r"""(:?"["]".*"["]"|'''.*''')""")
        self.stringRe.setMinimal(True)
        PythonHighlighter.Rules.append((self.stringRe, self.stringFormat))
        self.tripleSingleRe = QtCore.QRegExp(r"""'''(?!")""")
        self.tripleDoubleRe = QtCore.QRegExp(r'''"""(?!')''')
Esempio n. 24
0
    def cb_new_parameter_info(self, dparameter_object):
        if isinstance(dparameter_object, DParameter):
            value = dparameter_object.value

            regex = dparameter_object.regex
            if regex is not None:
                rx = QtCore.QRegExp(regex)
                validator = QRegExpValidator(rx, self.lineedit)
                self.lineedit.setValidator(validator)

            self.lineedit.returnPressed.disconnect()
            self.lineedit.setText(str(value))
            self.lineedit.returnPressed.connect(self.value_changed)
Esempio n. 25
0
 def init_qm_list():
     """
     Initialise the list of available translations
     """
     LanguageManager.__qm_list__ = {}
     qm_files = LanguageManager.find_qm_files()
     for counter, qmf in enumerate(qm_files):
         reg_ex = QtCore.QRegExp("^.*i18n/(.*).qm")
         if reg_ex.exactMatch(qmf):
             name = '{regex}'.format(regex=reg_ex.cap(1))
             LanguageManager.__qm_list__['{count:>2d} {name}'.format(
                 count=counter + 1,
                 name=LanguageManager.language_name(qmf))] = name
Esempio n. 26
0
    def __init__(self):
        super(PicoRenderLength, self).__init__()
        self.setContentsMargins(0, 0, 0, 0)
        self.setSpacing(4)
        self.setAlignment(qc.Qt.AlignVCenter)

        # -- Attributes -- #
        self.length = 'Full'  # Default behaviour
        self.tc_reg_ex = qc.QRegExp(
            '^(?:(?:[0-1][0-9]|[0-2][0-3]):)(?:[0-5][0-9]:){2}(?:[0-2][0-9])$')

        # -- Draw -- #
        self._home()
Esempio n. 27
0
    def __init__(self, *args, obj=None, **kwargs):
        super(CourseRosterDialog, self).__init__(*args, **kwargs)
        self.setupUi(self)

        rx = QtCore.QRegExp("[^`~!#$%\^&*()+={}\[\]:;\"'<>?/,|\\\\]{,30}")
        validator = QtGui.QRegExpValidator(rx)
        self.searchbar.setValidator(validator)

        self.subject = ""
        self.catalog = ""
        self.section = ""

        self.init_ui()
Esempio n. 28
0
    def __init__(self, tray):
        super().__init__()
        self._tray = tray
        self.setWindowTitle("Preferences")
        validator=QtCore.QRegExp("[A-Za-z0-9- _]+")
        self._nameValidator = QtGui.QRegExpValidator(validator)

        self._windowLayout = self._createLayout()
        self._windowLayout.setSizeConstraint(QLayout.SetFixedSize)
        self.setLayout(self._windowLayout)

        self.exec_()
        self.activateWindow()
Esempio n. 29
0
    def __init__(self, *args, obj=None, **kwargs):
        super(ProfessorsPage, self).__init__(*args, **kwargs)
        self.setupUi(self)

        rx = QtCore.QRegExp("[^`~!#$%\^&*()+={}\[\]:;\"'<>?/,|\\\\]{,30}")
        validator = QtGui.QRegExpValidator(rx)
        self.searchbar.setValidator(validator)

        self.edit_dialog = None
        self.add_dialog = None
        self.delete_dialog = None

        self.init_ui()
Esempio n. 30
0
    def __init__(self, *args, obj=None, **kwargs):
        super(EditCourseDialog, self).__init__(*args, **kwargs)
        self.setupUi(self)

        rx = QtCore.QRegExp("[a-zA-Z ]{,30}")
        validator = QtGui.QRegExpValidator(rx)
        self.newSubjectInput.setValidator(validator)

        rx = QtCore.QRegExp("[a-zA-Z0-9]{,7}")
        validator = QtGui.QRegExpValidator(rx)
        self.newCatalogInput.setValidator(validator)
        self.newSectionInput.setValidator(validator)

        rx = QtCore.QRegExp("[a-zA-Z0-9+_.-@]{,30}")
        validator = QtGui.QRegExpValidator(rx)
        self.newProfessorDropDown.setValidator(validator)

        self.prof_last = ""
        self.prof_first = ""
        self.prof_email = ""

        self.init_ui()