Python PyQt4.QtCore 模块,QRegExp() 实例源码

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

项目:rexploit    作者:DaniLabs    | 项目源码 | 文件源码
def startUi(self):
        """This function checks if ui file exists and then show the view"""
        try:
            self.load("settings")

            regex = QRegExp("\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}")
            self.__validator = QRegExpValidator(regex, self.lineEditIP)
            self.lineEditIP.setValidator(self.__validator)

            # Connect things
            self.buttonBox.rejected.connect(self.buttonBoxRejected)
            self.buttonBox.accepted.connect(self.buttonBoxAccepted)
            self.toolButton.clicked.connect(self.toolButtonClicked)
            self.pushButtonPing.clicked.connect(self.pushButtonPingClicked)
            return True
        except Exception as e:
            MessageBox.critical("Error", str(e))
            return False
项目:rexploit    作者:DaniLabs    | 项目源码 | 文件源码
def startUi(self):
        """This function checks if ui file exists and then show the view"""
        try:
            self.load("project")

            self.lineEditLocation.setText(expanduser("~"))
            regex = QRegExp("\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}")
            self.__validator = QRegExpValidator(regex, self.lineEditIP)
            self.lineEditIP.setValidator(self.__validator)

            # Connect things
            self.buttonBox.rejected.connect(self.buttonBoxRejected)
            self.buttonBox.accepted.connect(self.buttonBoxAccepted)
            self.toolButton.clicked.connect(self.toolButtonClicked)
            return True
        except Exception as e:
            MessageBox.critical("Error", str(e))
            return False
项目:linkchecker-gui    作者:linkcheck    | 项目源码 | 文件源码
def addRule (self, pattern, style):
        """Add a rule pattern with given style."""
        self.rules.append((QtCore.QRegExp(pattern), self.styles[style]))
项目:siren    作者:ozsolarwind    | 项目源码 | 文件源码
def __init__(self, document):
        QSyntaxHighlighter.__init__(self, document)
        rules = []
        rules += [(r'%s' % c, 0, STYLES['comment'])
            for c in self.comment]
        rules += [(r'%s' % g, 0, STYLES['group'])
            for g in self.group]
        rules += [(r'%s' % o, 0, STYLES['operator'])
           for o in self.operators]
         # Build a QRegExp for each pattern
        self.rules = [(QRegExp(pat), index, fmt)
            for (pat, index, fmt) in rules]
项目:PyFRAP    作者:alexblaessle    | 项目源码 | 文件源码
def highlightBlock( self, text ):
        for rule in self.highlightingRules:
            expression = QtCore.QRegExp( rule.pattern )
            index = expression.indexIn( text )
            while index >= 0:
                length = expression.matchedLength()
                self.setFormat( index, length, rule.format )
                index = text.indexOf( expression, index + length )
        self.setCurrentBlockState( 0 )
项目:dxf2gcode    作者:cnc-club    | 项目源码 | 文件源码
def __init__(self, parent = None):
        QDoubleSpinBox.__init__(self, parent)
        self.saved_suffix = ''
        #Let's use the locale decimal separator if it is different from the dot ('.')
        local_decimal_separator = QLocale().decimalPoint()
        if local_decimal_separator == '.':
            local_decimal_separator = ''
        self.lineEdit().setValidator(QRegExpValidator(QRegExp("-?[0-9]*[.{0}]?[0-9]*.*".format(local_decimal_separator)), self))
项目:Pyncil    作者:zcking    | 项目源码 | 文件源码
def highlightBlock(self, text):
        for pattern, format in self.highlightingRules:
            expression = QtCore.QRegExp(pattern)
            index = expression.indexIn(text)
            while index >= 0:
                length = expression.matchedLength()
                self.setFormat(index, length, format)
                index = expression.indexIn(text, index + length)

        self.setCurrentBlockState(0)

        startIndex = 0
        if self.previousBlockState() != 1:
            startIndex = self.commentStartExpression.indexIn(text)

        while startIndex >= 0:
            endIndex = self.commentEndExpression.indexIn(text, startIndex)

            if endIndex == -1:
                self.setCurrentBlockState(1)
                commentLength = len(text) - startIndex
            else:
                commentLength = endIndex - startIndex + self.commentEndExpression.matchedLength()

            self.setFormat(startIndex, commentLength, self.multiLineCommentFormat)
            startIndex = self.commentStartExpression.indexIn(text, startIndex + commentLength)
项目:Pyncil    作者:zcking    | 项目源码 | 文件源码
def highlightBlock(self, text):
        for pattern, format in self.highlightingRules:
            expression = QtCore.QRegExp(pattern)
            index = expression.indexIn(text)
            while index >= 0:
                length = expression.matchedLength()
                self.setFormat(index, length, format)
                index = expression.indexIn(text, index + length)

        self.setCurrentBlockState(0)

        startIndex = 0
        if self.previousBlockState() != 1:
            startIndex = self.commentStartExpression.indexIn(text)

        while startIndex >= 0:
            endIndex = self.commentEndExpression.indexIn(text, startIndex)

            if endIndex == -1:
                self.setCurrentBlockState(1)
                commentLength = len(text) - startIndex
            else:
                commentLength = endIndex - startIndex + self.commentEndExpression.matchedLength()

            self.setFormat(startIndex, commentLength, self.multiLineCommentFormat)
            startIndex = self.commentStartExpression.indexIn(text, startIndex + commentLength)
项目:rexploit    作者:DaniLabs    | 项目源码 | 文件源码
def __init__(self, parent):
        super(BruteForceView, self).__init__("bruteforce", parent)
        self.category = "bf"

        regex = QRegExp("\d{1,6}")
        self.__validator = QRegExpValidator(regex, self.lineEditPort)
        self.lineEditPort.setValidator(self.__validator)

        regex = QRegExp("\d{1,5}")

        self.__validator = QRegExpValidator(regex, self.lineEditPort)
        self.lineEditMaximum.setValidator(self.__validator)

        # Connect buttons
        self.pushButtonCancel.clicked.connect(self.pushButtonCancelClicked)
        self.pushButtonExploit.clicked.connect(self.pushButtonExploitClicked)
        self.toolButtonUsers.clicked.connect(self.toolButtonUsersClicked)
        self.toolButtonPasswords.clicked.connect(self.toolButtonPasswordsClicked)

        # Connect signal and thread
        self.__communicate = Communicate()
        self.__exploitThread = ExploitThread(self.__communicate)
        self.__communicate.finishExploit.connect(self.setResultExploit)

        # Button and progressbar
        self.setProgressBarState(0)
        self.pushButtonCancel.setEnabled(False)

        # Generator
        self.__generatorUsers = Generator()
        self.__generatorPasswords = Generator()
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def createEditor(self, parent, option, index):
        self.proxy = index.model()
        self.index = self.proxy.mapToSource(index)
        edit = QtGui.QLineEdit(parent)
        edit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp('[\x20-\x7f°]*')))
        edit.setMaxLength(16)
        return edit
项目:MidiMemo    作者:MaurizioB    | 项目源码 | 文件源码
def client_id_dialog(cls, main):
        def get_id(event):
            item = self.model.item(self.listview.indexAt(event.pos()).row())
            sel_id = item.data(IdRole).toString()
            if self.setter_edit.text() == sel_id:
                self.accept()
            self.setter_edit.setText(sel_id)
        def highlight(text):
            for item in [self.model.item(row) for row in range(self.model.rowCount())]:
                setItalic(item, True if item.data(IdRole).toString()==text else False)
        self = cls(main)
        self.description_lbl.setText(
                                     'Insert a client ID or select it from the list of the existing clients.\n\n'+
                                     'Remember, Client IDs can change during runtime. If you use ALSA, you '+
                                     'should use this only for system clients (highlighted in the list).\n'+
                                     'Using this filter for JACK is useless, use name filtering instead.'
                                     )
        self.setter_lbl.setText('Client ID:')
        self.setter_edit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp('[0-9]{1,12}')))
        self.listview.mouseDoubleClickEvent = get_id
        graph = main.main.graph
        for client_id in sorted(graph.client_id_dict.keys()):
            if not self.client_has_outputs(graph, client_id): continue
            client = graph.client_id_dict[client_id]
            item = QtGui.QStandardItem('{} ({})'.format(client.name, client.id))
            if client.type == alsaseq.SEQ_KERNEL_CLIENT:
                setBold(item)
            item.setData(client.id, IdRole)
            self.model.appendRow(item)
        self.setter_edit.textChanged.connect(highlight)
        if self.exec_() and self.setter_edit.text():
            return self.setter_edit.text()
        else:
            return None
项目:MidiMemo    作者:MaurizioB    | 项目源码 | 文件源码
def port_id_dialog(cls, main):
        def get_id(event):
            item = self.model.item(self.listview.indexAt(event.pos()).row())
            if not item.isEnabled(): return
            sel_id = item.data(IdRole).toString()
            if self.setter_edit.text() == sel_id:
                self.accept()
            self.setter_edit.setText(sel_id)
        def highlight(text):
            for item in [self.model.item(row) for row in range(self.model.rowCount())]:
                setItalic(item, True if item.data(IdRole).toString()==text else False)
        self = cls(main)
        self.description_lbl.setText(
                                     'Insert a port ID (in "client:port" format) or select it from the list of the existing ports.\n\n'+
                                     'Remember, port IDs can change during runtime. If you use ALSA, you '+
                                     'should use this only for system ports (highlighted in the list).\n'+
                                     'Using this filter for JACK is useless, use name filtering instead.'
                                     )
        self.setter_lbl.setText('Port ID:')
        self.setter_edit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp('[0-9]{1,12}:[0-9]{1,12}')))
        self.listview.mouseDoubleClickEvent = get_id
        graph = main.main.graph
        for client_id in sorted(graph.client_id_dict.keys()):
            if not self.client_has_outputs(graph, client_id): continue
            client = graph.client_id_dict[client_id]
            item = QtGui.QStandardItem('{} ({})'.format(client.name, client.id))
            item.setEnabled(False)
            self.model.appendRow(item)
            for port_id in sorted(graph.port_id_dict[client_id].keys()):
                port = graph.port_id_dict[client_id][port_id]
                if not port.is_output: continue
                item = QtGui.QStandardItem(' {} ({})'.format(port.name, port.id))
                if client.type == alsaseq.SEQ_KERNEL_CLIENT:
                    setBold(item)
                item.setData('{}:{}'.format(client.id, port.id), IdRole)
                self.model.appendRow(item)
        self.setter_edit.textChanged.connect(highlight)
        if self.exec_() and self.setter_edit.text():
            return self.setter_edit.text()
        else:
            return None
项目:MidiMemo    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self, parent=None, format=None):
            QtGui.QStyledItemDelegate.__init__(self, parent)
            if format:
                format = QtCore.QRegExp(format)
                self.validator = QtGui.QRegExpValidator(format, self)
            else:
                self.validator = None
项目:MidiMemo    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self, parent=None):
            QtGui.QStyledItemDelegate.__init__(self, parent)
            self.allowed_chars = QtCore.QRegExp('[ -~]*')
            self.validator = QtGui.QRegExpValidator(self.allowed_chars, self)
项目:Pyncil    作者:zcking    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(PythonHighlighter, self).__init__(parent)

        self.parent = parent
        self.loadConfig()

        self.classRegex = QtCore.QRegExp("\\bQ[A-Za-z]+\\b")
        self.singleLineCommentRegex = QtCore.QRegExp("#[^\n]*")
        self.multiLineCommentRegex = None
        self.singleQuoteRegex = QtCore.QRegExp("'.*'")
        self.doubleQuoteRegex = QtCore.QRegExp("\".*\"")
        self.functionRegex = QtCore.QRegExp("\\b[A-Za-z0-9_]+(?=\\()")
        self.commentStartRegex = QtCore.QRegExp('/"""')
        self.commentEndRegex = QtCore.QRegExp('"""/')

        self.commentChar = '#'

        keywordFormat = QtGui.QTextCharFormat()
        keywordFormat.setFontWeight(QtGui.QFont.Bold)
        self.keywordPatterns = self.getPatterns('ext/python_keywords.txt')
        self.highlightingRules =[(QtCore.QRegExp(pattern), keywordFormat)
                for pattern in self.keywordPatterns]

        classFormat = QtGui.QTextCharFormat()
        classFormat.setFontWeight(QtGui.QFont.Bold)
        self.highlightingRules.append((self.classRegex, 
            classFormat))

        singleLineCommentFormat = QtGui.QTextCharFormat()
        self.highlightingRules.append((self.singleLineCommentRegex, singleLineCommentFormat))

        self.multiLineCommentFormat = QtGui.QTextCharFormat()

        quotationFormat = QtGui.QTextCharFormat()
        self.highlightingRules.append((self.doubleQuoteRegex,
            quotationFormat))
        self.highlightingRules.append((self.singleQuoteRegex,
            quotationFormat))

        functionFormat = QtGui.QTextCharFormat()
        functionFormat.setFontItalic(True)
        functionFormat.setForeground(QtCore.Qt.blue)
        self.highlightingRules.append((self.functionRegex,
            functionFormat))

        self.commentStartExpression = self.commentStartRegex
        self.commentEndExpression = self.commentEndRegex

        # For use by the main editor
        self.indenters = ['def', 'for', 'while', 'do', 'class', 'if', 'else', 'elif', 'switch', 'case', 'try', 'except', 'finally']
        self.dedenters = ['break', 'continue', 'return']
项目:Pyncil    作者:zcking    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(CPPHighlighter, self).__init__(parent)

        self.parent = parent
        self.loadConfig()

        self.classRegex = QtCore.QRegExp("\\bQ[A-Za-z]+\\b")
        self.singleLineCommentRegex = QtCore.QRegExp("//[^\n]*")
        self.multiLineCommentRegex = None
        self.singleQuoteRegex = QtCore.QRegExp("'.*'")
        self.doubleQuoteRegex = QtCore.QRegExp("\".*\"")
        self.functionRegex = QtCore.QRegExp("\\b[A-Za-z0-9_]+(?=\\()")
        self.commentStartRegex = QtCore.QRegExp('/\\*')
        self.commentEndRegex = QtCore.QRegExp('\\*/')

        self.commentChar = '//'

        keywordFormat = QtGui.QTextCharFormat()
        keywordFormat.setFontWeight(QtGui.QFont.Bold)
        self.keywordPatterns = self.getPatterns('ext/cpp_keywords.txt')
        self.highlightingRules =[(QtCore.QRegExp(pattern), keywordFormat)
                for pattern in self.keywordPatterns]

        classFormat = QtGui.QTextCharFormat()
        classFormat.setFontWeight(QtGui.QFont.Bold)
        self.highlightingRules.append((self.classRegex, 
            classFormat))

        singleLineCommentFormat = QtGui.QTextCharFormat()
        self.highlightingRules.append((self.singleLineCommentRegex, singleLineCommentFormat))

        self.multiLineCommentFormat = QtGui.QTextCharFormat()

        quotationFormat = QtGui.QTextCharFormat()
        self.highlightingRules.append((self.doubleQuoteRegex,
            quotationFormat))
        self.highlightingRules.append((self.singleQuoteRegex,
            quotationFormat))

        functionFormat = QtGui.QTextCharFormat()
        functionFormat.setFontItalic(True)
        functionFormat.setForeground(QtCore.Qt.blue)
        self.highlightingRules.append((self.functionRegex,
            functionFormat))

        self.commentStartExpression = self.commentStartRegex
        self.commentEndExpression = self.commentEndRegex

        # For use by the main editor
        self.indenters = ['{', 'if', 'else', 'class', 'for', 'while', 'do', 'switch', 'case', 'try', 'catch', 'default']
        self.dedenters = ['break', 'continue', 'return']
项目:Bigglesworth    作者:MaurizioB    | 项目源码 | 文件源码
def __init__(self, main, parent):
        QtGui.QDialog.__init__(self, parent)
        load_ui(self, 'dialogs/midi_import.ui')
        self.main = main

        self.import_btn = QtGui.QPushButton('Import to library')
        self.import_btn.setIcon(self.style().standardIcon(QtGui.QStyle.SP_DialogSaveButton))
        self.buttonBox.addButton(self.import_btn, QtGui.QDialogButtonBox.ActionRole)
        self.import_btn.clicked.connect(self.import_sounds)

        self.export_state = False
        self.midi_state = False

        self.dump_btn = QtGui.QPushButton('Dump all')
        self.dump_btn.setEnabled(False)
        self.dump_btn.setIcon(self.style().standardIcon(QtGui.QStyle.SP_ArrowRight))
        self.buttonBox.addButton(self.dump_btn, QtGui.QDialogButtonBox.ActionRole)
        self.dump_btn.clicked.connect(self.dump_sounds)

        self.splitter.setCollapsible(1, True)

        self.sound_list = []
        self.export_list = []

        self.model = self.sounds_table.model()
        self.sounds_table.setColumnCount(len(self.sound_headers))
        self.sounds_table.setHorizontalHeaderLabels(self.sound_headers)
        self.sounds_table.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
        self.sounds_table.horizontalHeader().setResizeMode(3, QtGui.QHeaderView.Stretch)
        self.sounds_table.verticalHeader().setVisible(False)
        self.sounds_table.horizontalHeader().setVisible(True)
        self.sounds_table.verticalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
        self.bankmap_combo.addItems([uppercase[b] for b in range(8)])
        self.bankmap_btn.setIcon(self.style().standardIcon(QtGui.QStyle.SP_DialogApplyButton))

        self.destination_group.setId(self.sound_buffer_radio, 0)
        self.destination_group.setId(self.multi_buffer_radio, 1)
        self.destination_group.setId(self.library_radio, 2)

        self.name_edit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp('[\x20-\x7f°]*')))
        self.cat_combo.addItems(categories)
        self.bank_combo.addItems([uppercase[b] for b in range(8)])
        self.single_dump_btn.setIcon(self.style().standardIcon(QtGui.QStyle.SP_ArrowRight))
        self.apply_btn.setIcon(self.style().standardIcon(QtGui.QStyle.SP_DialogApplyButton))

        self.file_open_btn.clicked.connect(self.file_open)
        self.sounds_table.currentChanged = self.currentChanged
        self.sounds_table.selectionChanged = self.selectionChanged
        self.sounds_table.customContextMenuRequested.connect(self.sound_menu)
        self.sounds_table.cellDoubleClicked.connect(self.dump_temp)
        self.check_btn.clicked.connect(lambda: self.check_selection(True))
        self.uncheck_btn.clicked.connect(lambda: self.check_selection(False))
        self.single_dump_btn.clicked.connect(self.dump_single)
        self.bankmap_btn.clicked.connect(self.bankmap_update)

        self.name_edit.textChanged.connect(lambda t: self.apply_btn.setEnabled(True))
        self.cat_combo.currentIndexChanged.connect(lambda i: self.apply_btn.setEnabled(True))
        self.apply_btn.clicked.connect(self.sound_update)
项目:ddt4all    作者:cedricp    | 项目源码 | 文件源码
def hexeditor(self):
        self.dialogbox = gui.QWidget()
        wlayout = gui.QVBoxLayout()
        diaglabel = gui.QLabel(_("Diagnotic session"))
        inputlabel = gui.QLabel(_("Input"))
        outputlabel = gui.QLabel(_("Output"))

        diaglabel.setAlignment(core.Qt.AlignCenter)
        inputlabel.setAlignment(core.Qt.AlignCenter)
        outputlabel.setAlignment(core.Qt.AlignCenter)

        self.diagsession = gui.QComboBox()
        rqsts = self.ecurequestsparser.requests.keys()
        self.request_editor_sds = {}

        self.diagsession.addItem(u"None")
        self.request_editor_sds[u'None'] = ""


        for diag in rqsts:
            if "start" in diag.lower() and "session" in diag.lower() and 'diag' in diag.lower():

                sds = self.ecurequestsparser.requests[diag]

                if u'Session Name' in sds.sendbyte_dataitems:
                    session_names = self.ecurequestsparser.data[u'Session Name']
                    for name in session_names.items.keys():
                        sds_stream = " ".join(sds.build_data_stream({u'Session Name': name}))
                        name = name + "[" + sds_stream + "]"
                        self.request_editor_sds[name] = sds_stream
                        self.diagsession.addItem(name)
                    print sds.sendbyte_dataitems[u'Session Name']

        if len(self.request_editor_sds) == 1:
            self.diagsession.addItem(u"Default [10 81]")
            self.diagsession.addItem(u"After Sales [10 C0]")
            self.request_editor_sds[u"Default [10 81]"] = "10 81"
            self.request_editor_sds[u"After Sales [10 C0]"] = "10 C0"

        self.input = gui.QLineEdit()
        self.input.returnPressed.connect(self.send_manual_cmd)
        self.output = gui.QLineEdit()
        self.output.setReadOnly(True)
        hexvalidaor = core.QRegExp(("^[\s0-9a-fA-F]+"))
        rev = gui.QRegExpValidator(hexvalidaor, self)
        self.input.setValidator(rev)
        wlayout.addWidget(diaglabel)
        wlayout.addWidget(self.diagsession)
        wlayout.addWidget(inputlabel)
        wlayout.addWidget(self.input)
        wlayout.addWidget(outputlabel)
        wlayout.addWidget(self.output)
        self.dialogbox.setLayout(wlayout)
        self.dialogbox.show()
项目:sardana    作者:sardana-org    | 项目源码 | 文件源码
def __init__(self, parent=None):
        wiz.SardanaBasePage.__init__(self, parent)

        self.setSubTitle('Please select the Tango Host')
        self._valid = False

        self._regExp0 = QtCore.QRegExp("^[0-9a-zA-Z]{,50}")
        self._regValid0 = QtGui.QRegExpValidator(self._regExp0, self)

        self._regExp1 = QtCore.QRegExp("^[0-9]{,50}")
        self._regValid1 = QtGui.QRegExpValidator(self._regExp1, self)

        self._panel = self.getPanelWidget()

        layout = QtGui.QFormLayout()
        self.hostEdit = QtGui.QLineEdit()
        self.hostEdit.setValidator(self._regValid0)

        self.portEdit = QtGui.QLineEdit()
        self.portEdit.setValidator(self._regValid1)
        self.checkButton = QtGui.QPushButton("Check")

        layout.addRow("&Host", self.hostEdit)
        layout.addRow("&Port", self.portEdit)
        layout.addRow("", self.checkButton)
        self.checkButton.hide()
        host, port = self.get_default_tango_host()

        self.hostEdit.setText(host)
        self.portEdit.setText(port)

        self._panel.setLayout(layout)

        self['db'] = self._getDatabase
        self['port'] = self._getPort
        self['host'] = self._getHost

        self.connect(self.hostEdit, QtCore.SIGNAL(
            'textEdited(const QString &)'), self._letterChanged)
        self.connect(self.portEdit, QtCore.SIGNAL(
            'textEdited(const QString &)'), self._letterChanged)
        self.connect(self.checkButton, QtCore.SIGNAL(
            'clicked()'), self.checkData)

        self.checkData()
项目:sardana    作者:sardana-org    | 项目源码 | 文件源码
def __init__(self, parent=None):
        wiz.SardanaBasePage.__init__(self, parent)
        self.setSubTitle('Please type the name for the new Sardana instance')
        self._valid = False

        panel = self.getPanelWidget()

        layout = QtGui.QFormLayout()

        self.nameEdit = QtGui.QLineEdit()
        self.nameEdit.setText("MySardana")

        self._regExp = QtCore.QRegExp("^[0-9a-zA-Z]{,50}")
        self._regValid = QtGui.QRegExpValidator(self._regExp, self)

        self.nameEdit.setValidator(self._regValid)

        self.checkButton = QtGui.QPushButton("Check")
        self.checkButton.hide()

        layout.addRow("&Name", self.nameEdit)
        layout.addRow("", self.checkButton)

        panel.setLayout(layout)

        self.connect(self.nameEdit, QtCore.SIGNAL(
            'textEdited(const QString &)'), self._letterChanged)
        self.connect(self.checkButton, QtCore.SIGNAL(
            'clicked()'), self.checkData)
项目:sardana    作者:sardana-org    | 项目源码 | 文件源码
def __init__(self, parent=None):

        self._parent = parent
        self._isEditorOpened = False
        self._pool = Pool()
        self.poolEditor = QtGui.QDialog()
        self.ui = pool_editor_UI.Ui_PoolEditor()
        self.poolEditor.setModal(True)
        self.ui.setupUi(self.poolEditor)
        self._regExp = QtCore.QRegExp("^[0-9a-zA-Z_/]{,50}")
        self._regValid = QtGui.QRegExpValidator(self._regExp, self.poolEditor)
        self._regExp2 = QtCore.QRegExp("^[0-9.]{,50}")
        self._versionValid = QtGui.QRegExpValidator(
            self._regExp2, self.poolEditor)
        self._regExp3 = QtCore.QRegExp("^[0-9a-zA-Z_/]{,100}")
        self._deviceNameValid = QtGui.QRegExpValidator(
            self._regExp3, self.poolEditor)
        self.ui.instanceNameLineEdit.setValidator(self._regValid)
        self.ui.poolDeviceNameLineEdit.setValidator(self._deviceNameValid)
        self.ui.aliasLineEdit.setValidator(self._regValid)
        self.ui.poolVersionLineEdit.setValidator(self._versionValid)
        self._item_id = None
        self._path_id = None
        self.ui.addButton.setIcon(
            taurus.qt.qtgui.resource.getThemeIcon("list-add"))
        self.ui.removeButton.setIcon(
            taurus.qt.qtgui.resource.getThemeIcon("list-remove"))
        self.ui.upButton.setIcon(
            taurus.qt.qtgui.resource.getThemeIcon("go-up"))
        self.ui.downButton.setIcon(
            taurus.qt.qtgui.resource.getThemeIcon("go-down"))
        # connections
        QtCore.QObject.connect(self.ui.createButton,
                               QtCore.SIGNAL("clicked()"), self._createPool)
        QtCore.QObject.connect(
            self.ui.addButton, QtCore.SIGNAL("clicked()"), self._addPath)
        QtCore.QObject.connect(self.ui.removeButton,
                               QtCore.SIGNAL("clicked()"), self._removePath)
        QtCore.QObject.connect(
            self.ui.upButton, QtCore.SIGNAL("clicked()"), self._moveUp)
        QtCore.QObject.connect(
            self.ui.downButton, QtCore.SIGNAL("clicked()"), self._moveDown)
        QtCore.QObject.connect(self.ui.instanceNameLineEdit, QtCore.SIGNAL(
            'textEdited(const QString &)'), self._letterChanged)
        QtCore.QObject.connect(self.ui.poolDeviceNameCheckBox, QtCore.SIGNAL(
            "toggled(bool)"), self._letterChanged)
        QtCore.QObject.connect(self.ui.aliasCheckBox, QtCore.SIGNAL(
            "toggled(bool)"), self._letterChanged)
        QtCore.QObject.connect(self.ui.poolVersionCheckBox, QtCore.SIGNAL(
            "toggled(bool)"), self._letterChanged)
        QtCore.QObject.connect(self.ui.poolPathList, QtCore.SIGNAL(
            "itemDoubleClicked(QListWidgetItem*)"), self._editPath)
项目:sardana    作者:sardana-org    | 项目源码 | 文件源码
def __init__(self, parent=None):
        self._parent = parent
        #self._parent = weakref.ref(parent)
        self._isEditorOpened = False
        self._ms = MS()
        self.msEditor = QtGui.QDialog()
        self.ui = ms_editor_UI.Ui_MSEditor()
        self.msEditor.setModal(True)
        self.ui.setupUi(self.msEditor)
        self._regExp = QtCore.QRegExp("^[0-9a-zA-Z]{,50}")
        self._regValid = QtGui.QRegExpValidator(self._regExp, self.msEditor)
        self._regExp2 = QtCore.QRegExp("^[0-9.]{,50}")
        self._versionValid = QtGui.QRegExpValidator(
            self._regExp2, self.msEditor)
        self._regExp3 = QtCore.QRegExp("^[0-9a-zA-Z_/]{,100}")
        self._deviceNameValid = QtGui.QRegExpValidator(
            self._regExp3, self.msEditor)
        self.ui.instanceNameLineEdit.setValidator(self._regValid)
        self.ui.msDeviceNameLineEdit.setValidator(self._deviceNameValid)
        self.ui.msAliasLineEdit.setValidator(self._regValid)
        self.ui.msVersionLineEdit.setValidator(self._versionValid)
        self.ui.doorNameLineEdit.setValidator(self._regValid)
        self.ui.doorAliasLineEdit.setValidator(self._regValid)
        self._item_id = None
        self._path_id = None
        self.ui.addButton.setIcon(
            taurus.qt.qtgui.resource.getThemeIcon("list-add"))
        self.ui.removeButton.setIcon(
            taurus.qt.qtgui.resource.getThemeIcon("list-remove"))
        self.ui.upButton.setIcon(
            taurus.qt.qtgui.resource.getThemeIcon("go-up"))
        self.ui.downButton.setIcon(
            taurus.qt.qtgui.resource.getThemeIcon("go-down"))
        # connections
        QtCore.QObject.connect(self.ui.createButton,
                               QtCore.SIGNAL("clicked()"), self._createMS)
        QtCore.QObject.connect(
            self.ui.addButton, QtCore.SIGNAL("clicked()"), self._addPath)
        QtCore.QObject.connect(self.ui.removeButton,
                               QtCore.SIGNAL("clicked()"), self._removePath)
        QtCore.QObject.connect(
            self.ui.upButton, QtCore.SIGNAL("clicked()"), self._moveUp)
        QtCore.QObject.connect(
            self.ui.downButton, QtCore.SIGNAL("clicked()"), self._moveDown)
        QtCore.QObject.connect(self.ui.instanceNameLineEdit, QtCore.SIGNAL(
            'textEdited(const QString &)'), self._letterChanged)
        QtCore.QObject.connect(self.ui.msDeviceNameCheckBox, QtCore.SIGNAL(
            "toggled(bool)"), self._letterChanged)
        QtCore.QObject.connect(self.ui.msAliasCheckBox, QtCore.SIGNAL(
            "toggled(bool)"), self._letterChanged)
        QtCore.QObject.connect(self.ui.msVersionCheckBox, QtCore.SIGNAL(
            "toggled(bool)"), self._letterChanged)
        QtCore.QObject.connect(self.ui.doorNameCheckBox, QtCore.SIGNAL(
            "toggled(bool)"), self._letterChanged)
        QtCore.QObject.connect(self.ui.doorAliasCheckBox, QtCore.SIGNAL(
            "toggled(bool)"), self._letterChanged)
        QtCore.QObject.connect(self.ui.msPathList, QtCore.SIGNAL(
            "itemDoubleClicked(QListWidgetItem*)"), self._editPath)