Corrected a Qt 6.2 incompatibility by replacing 'hasCaptured()' with 'captured()'. The former is only available in Qt 6.3 and newer. eric7

Wed, 25 Jan 2023 13:43:10 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 25 Jan 2023 13:43:10 +0100
branch
eric7
changeset 9733
c5c2a74e9382
parent 9732
3985549d7d36
child 9734
74f7c9f5d094

Corrected a Qt 6.2 incompatibility by replacing 'hasCaptured()' with 'captured()'. The former is only available in Qt 6.3 and newer.

src/eric7/Utilities/ClassBrowsers/pyclbr.py file | annotate | diff | comparison | revisions
src/eric7/Utilities/ClassBrowsers/rbclbr.py file | annotate | diff | comparison | revisions
src/eric7/Utilities/ModuleParser.py file | annotate | diff | comparison | revisions
--- a/src/eric7/Utilities/ClassBrowsers/pyclbr.py	Wed Jan 25 10:08:19 2023 +0100
+++ b/src/eric7/Utilities/ClassBrowsers/pyclbr.py	Wed Jan 25 13:43:10 2023 +0100
@@ -454,11 +454,11 @@
             break
         start, i = m.capturedStart(), m.capturedEnd()
 
-        if m.hasCaptured("MethodModifier"):
+        if m.captured("MethodModifier"):
             modifierIndent = _indent(m.captured("MethodModifierIndent"))
             modifierType = m.captured("MethodModifierType")
 
-        elif m.hasCaptured("Method"):
+        elif m.captured("Method"):
             # found a method definition or function
             thisindent = _indent(m.captured("MethodIndent"))
             meth_name = m.captured("MethodName")
@@ -539,10 +539,10 @@
             modifierType = ClbrBaseClasses.Function.General
             modifierIndent = -1
 
-        elif m.hasCaptured("String"):
+        elif m.captured("String"):
             pass
 
-        elif m.hasCaptured("Class"):
+        elif m.captured("Class"):
             # we found a class definition
             thisindent = _indent(m.captured("ClassIndent"))
             # close all classes indented at least as much
@@ -606,7 +606,7 @@
                 classstack[-1][0]._addclass(class_name, cur_class)
             classstack.append((cur_class, thisindent))
 
-        elif m.hasCaptured("Attribute"):
+        elif m.captured("Attribute"):
             lineno += src.count("\n", last_lineno_pos, start)
             last_lineno_pos = start
             index = -1
@@ -620,13 +620,13 @@
                 else:
                     index -= 1
 
-        elif m.hasCaptured("Main"):
+        elif m.captured("Main"):
             # 'main' part of the script, reset class stack
             lineno += src.count("\n", last_lineno_pos, start)
             last_lineno_pos = start
             classstack = []
 
-        elif m.hasCaptured("Variable"):
+        elif m.captured("Variable"):
             thisindent = _indent(m.captured("VariableIndent"))
             variable_name = m.captured("VariableName")
             lineno += src.count("\n", last_lineno_pos, start)
@@ -654,7 +654,7 @@
                             )
                         break
 
-        elif m.hasCaptured("Publics"):
+        elif m.captured("Publics"):
             idents = m.captured("Identifiers")
             lineno += src.count("\n", last_lineno_pos, start)
             last_lineno_pos = start
@@ -669,7 +669,7 @@
             )
             dictionary["__all__"] = pubs
 
-        elif m.hasCaptured("Import"):
+        elif m.captured("Import"):
             # - import module
             names = [
                 n.strip()
@@ -684,7 +684,7 @@
             for name in names:
                 dictionary["@@Import@@"].addImport(name, [], lineno)
 
-        elif m.hasCaptured("ImportFrom"):
+        elif m.captured("ImportFrom"):
             # - from module import stuff
             mod = m.captured("ImportFromPath")
             namesLines = (
@@ -703,7 +703,7 @@
                 dictionary["@@Import@@"] = Imports(module, file)
             dictionary["@@Import@@"].addImport(mod, names, lineno)
 
-        elif m.hasCaptured("ConditionalDefine"):
+        elif m.captured("ConditionalDefine"):
             # a conditional function/method definition
             thisindent = _indent(m.captured("ConditionalDefineIndent"))
             while conditionalsstack and conditionalsstack[-1] >= thisindent:
@@ -713,7 +713,7 @@
             conditionalsstack.append(thisindent)
             deltaindentcalculated = False
 
-        elif m.hasCaptured("CodingLine"):
+        elif m.captured("CodingLine"):
             # a coding statement
             coding = m.captured("Coding")
             lineno += src.count("\n", last_lineno_pos, start)
--- a/src/eric7/Utilities/ClassBrowsers/rbclbr.py	Wed Jan 25 10:08:19 2023 +0100
+++ b/src/eric7/Utilities/ClassBrowsers/rbclbr.py	Wed Jan 25 13:43:10 2023 +0100
@@ -323,7 +323,7 @@
             break
         start, i = m.capturedStart(), m.capturedEnd()
 
-        if m.hasCaptured("Method"):
+        if m.captured("Method"):
             # found a method definition or function
             thisindent = indent
             indent += 1
@@ -387,14 +387,14 @@
             classstack.append((f, thisindent))  # Marker for nested fns
 
         elif (
-            m.hasCaptured("String")
-            or m.hasCaptured("Comment")
-            or m.hasCaptured("ClassIgnored")
-            or m.hasCaptured("BeginEnd")
+            m.captured("String")
+            or m.captured("Comment")
+            or m.captured("ClassIgnored")
+            or m.captured("BeginEnd")
         ):
             pass
 
-        elif m.hasCaptured("Class"):
+        elif m.captured("Class"):
             # we found a class definition
             thisindent = indent
             indent += 1
@@ -438,7 +438,7 @@
             acstack.append(["public", thisindent])
             # default access control is 'public'
 
-        elif m.hasCaptured("Module"):
+        elif m.captured("Module"):
             # we found a module definition
             thisindent = indent
             indent += 1
@@ -477,7 +477,7 @@
             acstack.append(["public", thisindent])
             # default access control is 'public'
 
-        elif m.hasCaptured("AccessControl"):
+        elif m.captured("AccessControl"):
             aclist = m.captured("AccessControlList")
             if not aclist:
                 index = -1
@@ -520,7 +520,7 @@
                     else:
                         index -= 1
 
-        elif m.hasCaptured("Attribute"):
+        elif m.captured("Attribute"):
             lineno += src.count("\n", last_lineno_pos, start)
             last_lineno_pos = start
             index = -1
@@ -539,7 +539,7 @@
                         lastGlobalEntry.setEndLine(lineno - 1)
                     lastGlobalEntry = None
 
-        elif m.hasCaptured("Attr"):
+        elif m.captured("Attr"):
             lineno += src.count("\n", last_lineno_pos, start)
             last_lineno_pos = start
             index = -1
@@ -586,11 +586,11 @@
                 else:
                     index -= 1
 
-        elif m.hasCaptured("Begin"):
+        elif m.captured("Begin"):
             # a begin of a block we are not interested in
             indent += 1
 
-        elif m.hasCaptured("End"):
+        elif m.captured("End"):
             # an end of a block
             indent -= 1
             if indent < 0:
@@ -601,7 +601,7 @@
                 else:
                     indent = 0
 
-        elif m.hasCaptured("CodingLine"):
+        elif m.captured("CodingLine"):
             # a coding statement
             coding = m.captured("Coding")
             lineno += src.count("\n", last_lineno_pos, start)
--- a/src/eric7/Utilities/ModuleParser.py	Wed Jan 25 10:08:19 2023 +0100
+++ b/src/eric7/Utilities/ModuleParser.py	Wed Jan 25 13:43:10 2023 +0100
@@ -593,11 +593,11 @@
                 break
             start, i = m.capturedStart(), m.capturedEnd()
 
-            if m.hasCaptured("MethodModifier"):
+            if m.captured("MethodModifier"):
                 modifierIndent = _indent(m.captured("MethodModifierIndent"))
                 modifierType = m.captured("MethodModifierType")
 
-            elif m.hasCaptured("Method"):
+            elif m.captured("Method"):
                 # found a method definition or function
                 thisindent = _indent(m.captured("MethodIndent"))
                 meth_name = m.captured("MethodName")
@@ -704,7 +704,7 @@
                 modifierType = Function.General
                 modifierIndent = -1
 
-            elif m.hasCaptured("Docstring"):
+            elif m.captured("Docstring"):
                 contents = m.captured("DocstringContents3")
                 if contents:
                     contents = _hashsub(r"\1", contents)
@@ -718,7 +718,7 @@
                 if cur_obj:
                     cur_obj.addDescription(contents)
 
-            elif m.hasCaptured("String"):
+            elif m.captured("String"):
                 if modulelevel and (
                     src[start - len("\r\n") : start] == "\r\n"
                     or src[start - len("\n") : start] == "\n"
@@ -737,7 +737,7 @@
                     if cur_obj:
                         cur_obj.addDescription(contents)
 
-            elif m.hasCaptured("Class"):
+            elif m.captured("Class"):
                 # we found a class definition
                 thisindent = _indent(m.captured("ClassIndent"))
                 lineno += src.count("\n", last_lineno_pos, start)
@@ -795,7 +795,7 @@
                 # add nested classes to the module
                 classstack.append((cur_class, thisindent))
 
-            elif m.hasCaptured("Attribute"):
+            elif m.captured("Attribute"):
                 lineno += src.count("\n", last_lineno_pos, start)
                 last_lineno_pos = start
                 index = -1
@@ -809,13 +809,13 @@
                     else:
                         index -= 1
 
-            elif m.hasCaptured("Main"):
+            elif m.captured("Main"):
                 # 'main' part of the script, reset class stack
                 lineno += src.count("\n", last_lineno_pos, start)
                 last_lineno_pos = start
                 classstack = []
 
-            elif m.hasCaptured("Variable"):
+            elif m.captured("Variable"):
                 thisindent = _indent(m.captured("VariableIndent"))
                 variable_name = m.captured("VariableName")
                 isSignal = m.captured("VariableSignal") != ""
@@ -848,7 +848,7 @@
                                 classstack[index][0].addGlobal(variable_name, attr)
                             break
 
-            elif m.hasCaptured("Import"):
+            elif m.captured("Import"):
                 # - import module
                 names = [
                     n.strip()
@@ -860,7 +860,7 @@
                     [name for name in names if name not in self.imports]
                 )
 
-            elif m.hasCaptured("ImportFrom"):
+            elif m.captured("ImportFrom"):
                 # - from module import stuff
                 mod = m.captured("ImportFromPath")
                 namesLines = (
@@ -879,7 +879,7 @@
                     [name for name in names if name not in self.from_imports[mod]]
                 )
 
-            elif m.hasCaptured("ConditionalDefine"):
+            elif m.captured("ConditionalDefine"):
                 # a conditional function/method definition
                 thisindent = _indent(m.captured("ConditionalDefineIndent"))
                 while conditionalsstack and conditionalsstack[-1] >= thisindent:
@@ -889,7 +889,7 @@
                 conditionalsstack.append(thisindent)
                 deltaindentcalculated = 0
 
-            elif m.hasCaptured("Comment") and modulelevel:
+            elif m.captured("Comment") and modulelevel:
                 continue
 
             modulelevel = False
@@ -915,7 +915,7 @@
                 break
             start, i = m.capturedStart(), m.capturedEnd()
 
-            if m.hasCaptured("Method"):
+            if m.captured("Method"):
                 # found a method definition or function
                 thisindent = indent
                 indent += 1
@@ -982,14 +982,14 @@
                 cur_obj = f
                 classstack.append((None, thisindent))  # Marker for nested fns
 
-            elif m.hasCaptured("Docstring"):
+            elif m.captured("Docstring"):
                 contents = m.captured("DocstringContents")
                 if contents:
                     contents = _hashsub(r"\1", contents)
                 if cur_obj:
                     cur_obj.addDescription(contents)
 
-            elif m.hasCaptured("Class"):
+            elif m.captured("Class"):
                 # we found a class definition
                 thisindent = indent
                 indent += 1
@@ -1037,7 +1037,7 @@
                 acstack.append(["public", thisindent])
                 # default access control is 'public'
 
-            elif m.hasCaptured("Module"):
+            elif m.captured("Module"):
                 # we found a module definition
                 thisindent = indent
                 indent += 1
@@ -1070,7 +1070,7 @@
                 acstack.append(["public", thisindent])
                 # default access control is 'public'
 
-            elif m.hasCaptured("AccessControl"):
+            elif m.captured("AccessControl"):
                 aclist = m.captured("AccessControlList")
                 if not aclist:
                     index = -1
@@ -1114,7 +1114,7 @@
                         else:
                             index -= 1
 
-            elif m.hasCaptured("Attribute"):
+            elif m.captured("Attribute"):
                 lineno += src.count("\n", last_lineno_pos, start)
                 last_lineno_pos = start
                 index = -1
@@ -1142,7 +1142,7 @@
                         lastGlobalEntry.setEndLine(lineno - 1)
                     lastGlobalEntry = None
 
-            elif m.hasCaptured("Attr"):
+            elif m.captured("Attr"):
                 lineno += src.count("\n", last_lineno_pos, start)
                 last_lineno_pos = start
                 index = -1
@@ -1193,11 +1193,11 @@
                     else:
                         index -= 1
 
-            elif m.hasCaptured("Begin"):
+            elif m.captured("Begin"):
                 # a begin of a block we are not interested in
                 indent += 1
 
-            elif m.hasCaptured("End"):
+            elif m.captured("End"):
                 # an end of a block
                 indent -= 1
                 if indent < 0:
@@ -1209,10 +1209,10 @@
                         indent = 0
 
             elif (
-                m.hasCaptured("String")
-                or m.hasCaptured("Comment")
-                or m.hasCaptured("ClassIgnored")
-                or m.hasCaptured("BeginEnd")
+                m.captured("String")
+                or m.captured("Comment")
+                or m.captured("ClassIgnored")
+                or m.captured("BeginEnd")
             ):
                 pass
 

eric ide

mercurial