eric6/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py

changeset 8143
2c730d5fd177
parent 7960
e8fc383322f7
child 8218
7c09585bd960
--- a/eric6/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/Plugins/WizardPlugins/PyRegExpWizard/PyRegExpWizardDialog.py	Tue Mar 02 17:17:09 2021 +0100
@@ -73,37 +73,39 @@
         self.namedGroups = re.compile(r"""\(?P<([^>]+)>""").findall
         
         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"))
         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)
         
         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()
@@ -123,10 +125,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)
@@ -264,7 +266,7 @@
         """
         from .PyRegExpWizardRepeatDialog import PyRegExpWizardRepeatDialog
         dlg = PyRegExpWizardRepeatDialog(self)
-        if dlg.exec() == QDialog.Accepted:
+        if dlg.exec() == QDialog.DialogCode.Accepted:
             self.__insertString(dlg.getRepeat())
         
     @pyqtSlot()
@@ -276,7 +278,7 @@
             PyRegExpWizardCharactersDialog
         )
         dlg = PyRegExpWizardCharactersDialog(self)
-        if dlg.exec() == QDialog.Accepted:
+        if dlg.exec() == QDialog.DialogCode.Accepted:
             self.__insertString(dlg.getCharacters())
         
     @pyqtSlot()
@@ -387,9 +389,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):
@@ -536,7 +538,8 @@
                     # highlight the matched text
                     tc = self.textTextEdit.textCursor()
                     tc.setPosition(offset)
-                    tc.setPosition(self.lastMatchEnd, QTextCursor.KeepAnchor)
+                    tc.setPosition(self.lastMatchEnd,
+                                   QTextCursor.MoveMode.KeepAnchor)
                     self.textTextEdit.setTextCursor(tc)
                 else:
                     self.nextButton.setEnabled(False)

eric ide

mercurial