71 self.redoButton.setIcon(UI.PixmapCache.getIcon("editRedo")) |
71 self.redoButton.setIcon(UI.PixmapCache.getIcon("editRedo")) |
72 |
72 |
73 self.namedGroups = re.compile(r"""\(?P<([^>]+)>""").findall |
73 self.namedGroups = re.compile(r"""\(?P<([^>]+)>""").findall |
74 |
74 |
75 self.saveButton = self.buttonBox.addButton( |
75 self.saveButton = self.buttonBox.addButton( |
76 self.tr("Save"), QDialogButtonBox.ActionRole) |
76 self.tr("Save"), QDialogButtonBox.ButtonRole.ActionRole) |
77 self.saveButton.setToolTip( |
77 self.saveButton.setToolTip( |
78 self.tr("Save the regular expression to a file")) |
78 self.tr("Save the regular expression to a file")) |
79 self.loadButton = self.buttonBox.addButton( |
79 self.loadButton = self.buttonBox.addButton( |
80 self.tr("Load"), QDialogButtonBox.ActionRole) |
80 self.tr("Load"), QDialogButtonBox.ButtonRole.ActionRole) |
81 self.loadButton.setToolTip( |
81 self.loadButton.setToolTip( |
82 self.tr("Load a regular expression from a file")) |
82 self.tr("Load a regular expression from a file")) |
83 self.validateButton = self.buttonBox.addButton( |
83 self.validateButton = self.buttonBox.addButton( |
84 self.tr("Validate"), QDialogButtonBox.ActionRole) |
84 self.tr("Validate"), QDialogButtonBox.ButtonRole.ActionRole) |
85 self.validateButton.setToolTip( |
85 self.validateButton.setToolTip( |
86 self.tr("Validate the regular expression")) |
86 self.tr("Validate the regular expression")) |
87 self.executeButton = self.buttonBox.addButton( |
87 self.executeButton = self.buttonBox.addButton( |
88 self.tr("Execute"), QDialogButtonBox.ActionRole) |
88 self.tr("Execute"), QDialogButtonBox.ButtonRole.ActionRole) |
89 self.executeButton.setToolTip( |
89 self.executeButton.setToolTip( |
90 self.tr("Execute the regular expression")) |
90 self.tr("Execute the regular expression")) |
91 self.nextButton = self.buttonBox.addButton( |
91 self.nextButton = self.buttonBox.addButton( |
92 self.tr("Next match"), QDialogButtonBox.ActionRole) |
92 self.tr("Next match"), QDialogButtonBox.ButtonRole.ActionRole) |
93 self.nextButton.setToolTip( |
93 self.nextButton.setToolTip( |
94 self.tr("Show the next match of the regular expression")) |
94 self.tr("Show the next match of the regular expression")) |
95 self.nextButton.setEnabled(False) |
95 self.nextButton.setEnabled(False) |
96 |
96 |
97 if fromEric: |
97 if fromEric: |
98 self.buttonBox.setStandardButtons( |
98 self.buttonBox.setStandardButtons( |
99 QDialogButtonBox.Cancel | QDialogButtonBox.Ok) |
99 QDialogButtonBox.StandardButton.Cancel | |
|
100 QDialogButtonBox.StandardButton.Ok) |
100 self.copyButton = None |
101 self.copyButton = None |
101 else: |
102 else: |
102 self.copyButton = self.buttonBox.addButton( |
103 self.copyButton = self.buttonBox.addButton( |
103 self.tr("Copy"), QDialogButtonBox.ActionRole) |
104 self.tr("Copy"), QDialogButtonBox.ButtonRole.ActionRole) |
104 self.copyButton.setToolTip( |
105 self.copyButton.setToolTip( |
105 self.tr("Copy the regular expression to the clipboard")) |
106 self.tr("Copy the regular expression to the clipboard")) |
106 self.buttonBox.setStandardButtons(QDialogButtonBox.Close) |
107 self.buttonBox.setStandardButtons( |
|
108 QDialogButtonBox.StandardButton.Close) |
107 self.variableLabel.hide() |
109 self.variableLabel.hide() |
108 self.variableLineEdit.hide() |
110 self.variableLineEdit.hide() |
109 self.variableLine.hide() |
111 self.variableLine.hide() |
110 self.importCheckBox.hide() |
112 self.importCheckBox.hide() |
111 self.regexpTextEdit.setFocus() |
113 self.regexpTextEdit.setFocus() |
385 """ |
387 """ |
386 escaped = self.regexpTextEdit.toPlainText() |
388 escaped = self.regexpTextEdit.toPlainText() |
387 if escaped: |
389 if escaped: |
388 escaped = escaped.replace("\\", "\\\\") |
390 escaped = escaped.replace("\\", "\\\\") |
389 cb = QApplication.clipboard() |
391 cb = QApplication.clipboard() |
390 cb.setText(escaped, QClipboard.Clipboard) |
392 cb.setText(escaped, QClipboard.Mode.Clipboard) |
391 if cb.supportsSelection(): |
393 if cb.supportsSelection(): |
392 cb.setText(escaped, QClipboard.Selection) |
394 cb.setText(escaped, QClipboard.Mode.Selection) |
393 |
395 |
394 @pyqtSlot() |
396 @pyqtSlot() |
395 def on_validateButton_clicked(self): |
397 def on_validateButton_clicked(self): |
396 """ |
398 """ |
397 Private slot to validate the entered regexp. |
399 Private slot to validate the entered regexp. |
534 "{0:d}".format(len(matchobj.group(i))))) |
536 "{0:d}".format(len(matchobj.group(i))))) |
535 |
537 |
536 # highlight the matched text |
538 # highlight the matched text |
537 tc = self.textTextEdit.textCursor() |
539 tc = self.textTextEdit.textCursor() |
538 tc.setPosition(offset) |
540 tc.setPosition(offset) |
539 tc.setPosition(self.lastMatchEnd, QTextCursor.KeepAnchor) |
541 tc.setPosition(self.lastMatchEnd, |
|
542 QTextCursor.MoveMode.KeepAnchor) |
540 self.textTextEdit.setTextCursor(tc) |
543 self.textTextEdit.setTextCursor(tc) |
541 else: |
544 else: |
542 self.nextButton.setEnabled(False) |
545 self.nextButton.setEnabled(False) |
543 self.resultTable.setRowCount(2) |
546 self.resultTable.setRowCount(2) |
544 row += 1 |
547 row += 1 |