Skip to content

Commit

Permalink
Use QRegularExpression only if PYQT_VERSION >= 5.5 (see isuue #3989)
Browse files Browse the repository at this point in the history
  • Loading branch information
rlaverde committed Jan 18, 2017
1 parent b027e4b commit a1efb7a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions spyder/widgets/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
from qtpy.QtCore import QPoint, Qt
from qtpy.QtGui import QCursor, QTextCursor, QTextDocument
from qtpy.QtWidgets import QApplication, QToolTip
from qtpy import PYQT5
from qtpy import PYQT_VERSION

if PYQT5:
PYQT_VERSION = float(PYQT_VERSION)

if PYQT_VERSION >= 5.5:
from qtpy.QtCore import QRegularExpression
else:
from qtpy.QtCore import QRegExp
Expand Down Expand Up @@ -490,7 +492,7 @@ def find_text(self, text, changed=True, forward=True, case=False,
moves += [QTextCursor.End]
if not regexp:
text = re.escape(to_text_string(text))
if PYQT5:
if PYQT_VERSION >= 5.5:
pattern = QRegularExpression(r"\b{}\b".format(text) if words else
text)
if case:
Expand Down

0 comments on commit a1efb7a

Please sign in to comment.