diff -r 27f636beebad -r 2c730d5fd177 eric6/Plugins/WizardPlugins/QRegularExpressionWizard/QRegularExpressionWizardDialog.py --- a/eric6/Plugins/WizardPlugins/QRegularExpressionWizard/QRegularExpressionWizardDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/Plugins/WizardPlugins/QRegularExpressionWizard/QRegularExpressionWizardDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -87,31 +87,32 @@ os.path.dirname(__file__), "QRegularExpressionWizardServer.py") ]) if self.__pyqt5Server.waitForStarted(5000): - self.__pyqt5Server.setReadChannel(QProcess.StandardOutput) + self.__pyqt5Server.setReadChannel( + QProcess.ProcessChannel.StandardOutput) if self.__sendCommand("available"): response = self.__receiveResponse() if response and response["available"]: self.__pyqt5Available = True self.saveButton = self.buttonBox.addButton( - self.tr("Save"), QDialogButtonBox.ActionRole) + self.tr("Save"), QDialogButtonBox.ButtonRole.ActionRole) self.saveButton.setToolTip( self.tr("Save the regular expression to a file")) self.loadButton = self.buttonBox.addButton( - self.tr("Load"), QDialogButtonBox.ActionRole) + self.tr("Load"), QDialogButtonBox.ButtonRole.ActionRole) self.loadButton.setToolTip( self.tr("Load a regular expression from a file")) if self.__pyqt5Available: self.validateButton = self.buttonBox.addButton( - self.tr("Validate"), QDialogButtonBox.ActionRole) + self.tr("Validate"), QDialogButtonBox.ButtonRole.ActionRole) self.validateButton.setToolTip( self.tr("Validate the regular expression")) self.executeButton = self.buttonBox.addButton( - self.tr("Execute"), QDialogButtonBox.ActionRole) + self.tr("Execute"), QDialogButtonBox.ButtonRole.ActionRole) self.executeButton.setToolTip( self.tr("Execute the regular expression")) self.nextButton = self.buttonBox.addButton( - self.tr("Next match"), QDialogButtonBox.ActionRole) + self.tr("Next match"), QDialogButtonBox.ButtonRole.ActionRole) self.nextButton.setToolTip( self.tr("Show the next match of the regular expression")) self.nextButton.setEnabled(False) @@ -122,14 +123,16 @@ if fromEric: self.buttonBox.setStandardButtons( - QDialogButtonBox.Cancel | QDialogButtonBox.Ok) + QDialogButtonBox.StandardButton.Cancel | + QDialogButtonBox.StandardButton.Ok) self.copyButton = None else: self.copyButton = self.buttonBox.addButton( - self.tr("Copy"), QDialogButtonBox.ActionRole) + self.tr("Copy"), QDialogButtonBox.ButtonRole.ActionRole) self.copyButton.setToolTip( self.tr("Copy the regular expression to the clipboard")) - self.buttonBox.setStandardButtons(QDialogButtonBox.Close) + self.buttonBox.setStandardButtons( + QDialogButtonBox.StandardButton.Close) self.variableLabel.hide() self.variableLineEdit.hide() self.variableLine.hide() @@ -196,10 +199,10 @@ tc = self.regexpTextEdit.textCursor() if steps != 0: if steps < 0: - act = QTextCursor.Left + act = QTextCursor.MoveOperation.Left steps = abs(steps) else: - act = QTextCursor.Right + act = QTextCursor.MoveOperation.Right for _ in range(steps): tc.movePosition(act) self.regexpTextEdit.setTextCursor(tc) @@ -220,7 +223,7 @@ QRegularExpressionWizardCharactersDialog ) dlg = QRegularExpressionWizardCharactersDialog(self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: self.__insertString(dlg.getCharacters()) @pyqtSlot() @@ -239,7 +242,7 @@ QRegularExpressionWizardRepeatDialog ) dlg = QRegularExpressionWizardRepeatDialog(self) - if dlg.exec() == QDialog.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: self.__insertString(dlg.getRepeat()) @pyqtSlot() @@ -469,9 +472,9 @@ if escaped: escaped = escaped.replace("\\", "\\\\") cb = QApplication.clipboard() - cb.setText(escaped, QClipboard.Clipboard) + cb.setText(escaped, QClipboard.Mode.Clipboard) if cb.supportsSelection(): - cb.setText(escaped, QClipboard.Selection) + cb.setText(escaped, QClipboard.Mode.Selection) @pyqtSlot() def on_validateButton_clicked(self): @@ -666,7 +669,8 @@ tc = self.textTextEdit.textCursor() tc.setPosition(offset) tc.setPosition( - self.lastMatchEnd, QTextCursor.KeepAnchor) + self.lastMatchEnd, + QTextCursor.MoveMode.KeepAnchor) self.textTextEdit.setTextCursor(tc) else: self.nextButton.setEnabled(False) @@ -747,19 +751,26 @@ options = [] if self.caseInsensitiveCheckBox.isChecked(): - options.append("QRegularExpression.CaseInsensitiveOption") + options.append( + "QRegularExpression.PatternOption.CaseInsensitiveOption") if self.multilineCheckBox.isChecked(): - options.append("QRegularExpression.MultilineOption") + options.append( + "QRegularExpression.PatternOption.MultilineOption") if self.dotallCheckBox.isChecked(): - options.append("QRegularExpression.DotMatchesEverythingOption") + options.append( + "QRegularExpression.PatternOption.DotMatchesEverythingOption") if self.extendedCheckBox.isChecked(): - options.append("QRegularExpression.ExtendedPatternSyntaxOption") + options.append( + "QRegularExpression.PatternOption.ExtendedPatternSyntaxOption") if self.greedinessCheckBox.isChecked(): - options.append("QRegularExpression.InvertedGreedinessOption") + options.append( + "QRegularExpression.PatternOption.InvertedGreedinessOption") if self.unicodeCheckBox.isChecked(): - options.append("QRegularExpression.UseUnicodePropertiesOption") + options.append( + "QRegularExpression.PatternOption.UseUnicodePropertiesOption") if self.captureCheckBox.isChecked(): - options.append("QRegularExpression.DontCaptureOption") + options.append( + "QRegularExpression.PatternOption.DontCaptureOption") options = " |{0}{1}".format(os.linesep, i1string).join(options) code = '{0} = QRegularExpression('.format(reVar)