eric6/ViewManager/ViewManager.py

changeset 7775
4a1db75550bd
parent 7762
e77f58e5f663
child 7785
9978016560ec
--- a/eric6/ViewManager/ViewManager.py	Sat Oct 10 16:03:53 2020 +0200
+++ b/eric6/ViewManager/ViewManager.py	Sun Oct 11 17:54:52 2020 +0200
@@ -4,15 +4,15 @@
 #
 
 """
-Module implementing the viewmanager base class.
+Module implementing the view manager base class.
 """
 
-
+import re
 import os
 
 from PyQt5.QtCore import (
-    pyqtSignal, pyqtSlot, QSignalMapper, QTimer, QFileInfo, QRegExp, Qt,
-    QCoreApplication, QPoint
+    pyqtSignal, pyqtSlot, Qt, QSignalMapper, QTimer, QFileInfo, QPoint,
+    QCoreApplication
 )
 from PyQt5.QtGui import QColor, QKeySequence, QPalette, QPixmap
 from PyQt5.QtWidgets import (
@@ -89,10 +89,10 @@
 
 class ViewManager(QWidget):
     """
-    Base class inherited by all specific viewmanager classes.
+    Base class inherited by all specific view manager classes.
     
     It defines the interface to be implemented by specific
-    viewmanager classes and all common methods.
+    view manager classes and all common methods.
     
     @signal changeCaption(str) emitted if a change of the caption is necessary
     @signal editorChanged(str) emitted when the current editor has changed
@@ -5925,12 +5925,14 @@
         line, index = aw.getCursorPosition()
         text = aw.text(line)
         
-        reg = QRegExp(r'[^\w_]')
-        end = reg.indexIn(text, index)
-        if end > index:
-            ext = text[index:end]
-            txt += ext
-            self.quickFindtextCombo.lineEdit().setText(txt)
+        rx = re.compile(r'[^\w_]')
+        match = rx.search(text, index)
+        if match:
+            end = match.start()
+            if end > index:
+                ext = text[index:end]
+                txt += ext
+                self.quickFindtextCombo.lineEdit().setText(txt)
         
     def showSearchWidget(self):
         """
@@ -7187,12 +7189,12 @@
             self.activeWindow().getFileName()
         ):
             ext = os.path.splitext(self.activeWindow().getFileName())[1]
-            rx = QRegExp(r".*\*\.{0}[ )].*".format(ext[1:]))
+            rx = re.compile(r".*\*\.{0}[ )].*".format(ext[1:]))
             import QScintilla.Lexers
             filters = QScintilla.Lexers.getOpenFileFiltersList()
             index = -1
             for i in range(len(filters)):
-                if rx.exactMatch(filters[i]):
+                if rx.fullmatch(filters[i]):
                     index = i
                     break
             if index == -1:

eric ide

mercurial