Some corrections to the debugger (frontend and backend). eric7

Tue, 11 Oct 2022 13:01:02 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 11 Oct 2022 13:01:02 +0200
branch
eric7
changeset 9397
a415cb83dafb
parent 9396
06699e5600a3
child 9398
b5426d4f2187

Some corrections to the debugger (frontend and backend).

src/eric7/APIs/Python3/eric7.api file | annotate | diff | comparison | revisions
src/eric7/DebugClients/Python/DebugClientBase.py file | annotate | diff | comparison | revisions
src/eric7/Debugger/DebugViewer.py file | annotate | diff | comparison | revisions
src/eric7/Debugger/VariablesViewer.py file | annotate | diff | comparison | revisions
src/eric7/Documentation/Help/source.qch file | annotate | diff | comparison | revisions
src/eric7/Documentation/Help/source.qhp file | annotate | diff | comparison | revisions
src/eric7/Documentation/Source/eric7.DebugClients.Python.DebugClientBase.html file | annotate | diff | comparison | revisions
src/eric7/Documentation/Source/eric7.Debugger.VariablesViewer.html file | annotate | diff | comparison | revisions
--- a/src/eric7/APIs/Python3/eric7.api	Mon Oct 10 09:25:29 2022 +0200
+++ b/src/eric7/APIs/Python3/eric7.api	Tue Oct 11 13:01:02 2022 +0200
@@ -906,6 +906,7 @@
 eric7.Debugger.VariablesViewer.VariablesProxyModel.hasChildren?4(parent)
 eric7.Debugger.VariablesViewer.VariablesProxyModel.setExpanded?4(index, state)
 eric7.Debugger.VariablesViewer.VariablesProxyModel?1(parent=None)
+eric7.Debugger.VariablesViewer.VariablesViewer.clear?4()
 eric7.Debugger.VariablesViewer.VariablesViewer.handleResetUI?4()
 eric7.Debugger.VariablesViewer.VariablesViewer.preferencesChanged?7
 eric7.Debugger.VariablesViewer.VariablesViewer.resizeEvent?4(event)
--- a/src/eric7/DebugClients/Python/DebugClientBase.py	Mon Oct 10 09:25:29 2022 +0200
+++ b/src/eric7/DebugClients/Python/DebugClientBase.py	Tue Oct 11 13:01:02 2022 +0200
@@ -1377,11 +1377,11 @@
             frmnr -= 1
 
         if f is None:
-            if scope:
+            if scope == 1:
                 varDict = self.debugMod.__dict__
             else:
                 scope = -2
-        elif scope:
+        elif scope == 1:
             varDict = f.f_globals
         elif f.f_globals is f.f_locals:
             scope = -1
@@ -1429,11 +1429,11 @@
             frmnr -= 1
 
         if f is None:
-            if scope:
+            if scope == 1:
                 varDict = self.debugMod.__dict__
             else:
                 scope = -1
-        elif scope:
+        elif scope == 1:
             varDict = f.f_globals
         elif f.f_globals is f.f_locals:
             scope = -1
@@ -1448,7 +1448,7 @@
             idx, varDict = next(varGen)
             if idx != -2:  # more elements available
                 var.insert(0, idx)
-                varlist = self.__formatVariablesList(varDict, scope, filterList, var)
+                varlist = self.__formatVariablesList(varDict, scope, filterList, var[1:])
         elif scope != -1:
             variable = varDict
             # Lookup the wanted attribute
@@ -1502,14 +1502,15 @@
         @type list of tuple of (str, Any) or (str, str, Any)
         @param scope 1 to filter using the globals filter, 0 using the locals
             filter.
-            Variables are only added to the list, if their name do not match
-            any of the filter expressions.
+            Variables are only added to the list, if their access path does not match
+            any of the filter expressions and the 'show/no show' indication.
         @type int
         @param filterList list of variable types to be filtered.
             Variables are only added to the list, if their type is not
             contained in the filter list. (defaults to None)
         @type list of str (optional)
-        @param var list encoded name of the requested variable (defaults to None)
+        @param var list encoded name of the requested variable (access path) (defaults
+            to None)
         @type list of str and int (optional)
         @return A tuple consisting of a list of formatted variables. Each
             variable entry is a tuple of three elements, the variable name,
@@ -1668,7 +1669,8 @@
             else:
                 showFlag = True
             if filterString:
-                pattern = filterString.replace(";", "|")
+                filterList = filterString.split(";")
+                pattern="|".join(f.strip() for f in filterList)
                 with contextlib.suppress(re.error):
                     patternFilterObjects = re.compile(pattern)
         else:
--- a/src/eric7/Debugger/DebugViewer.py	Mon Oct 10 09:25:29 2022 +0200
+++ b/src/eric7/Debugger/DebugViewer.py	Tue Oct 11 13:01:02 2022 +0200
@@ -637,11 +637,12 @@
             filterStr = self.globalsFilterEdit.text()
             if self.globalsFilterTypeCombo.currentIndex() == 0:
                 filterStr = "~ {0}".format(filterStr)
+            self.globalsViewer.clear()
             self.debugServer.remoteClientSetFilter(
                 self.getSelectedDebuggerId(), 1, filterStr
             )
             self.debugServer.remoteClientVariables(
-                self.getSelectedDebuggerId(), 2, self.__globalsFilter
+                self.getSelectedDebuggerId(), 1, self.__globalsFilter
             )
 
     def setLocalsFilter(self):
@@ -652,6 +653,7 @@
             filterStr = self.localsFilterEdit.text()
             if self.localsFilterTypeCombo.currentIndex() == 0:
                 filterStr = "~ {0}".format(filterStr)
+            self.localsViewer.clear()
             self.debugServer.remoteClientSetFilter(
                 self.getSelectedDebuggerId(), 0, filterStr
             )
@@ -666,7 +668,7 @@
         """
         if self.debugServer.isDebugging():
             self.debugServer.remoteClientVariables(
-                self.getSelectedDebuggerId(), 2, self.__globalsFilter
+                self.getSelectedDebuggerId(), 1, self.__globalsFilter
             )
             if self.currentStack:
                 self.debugServer.remoteClientVariables(
--- a/src/eric7/Debugger/VariablesViewer.py	Mon Oct 10 09:25:29 2022 +0200
+++ b/src/eric7/Debugger/VariablesViewer.py	Tue Oct 11 13:01:02 2022 +0200
@@ -275,11 +275,14 @@
         Public method to update the data model of variable in pathlist.
 
         @param vlist the list of variables to be displayed. Each
-                list entry is a tuple of three values.
+                list entry is a tuple of six values.
                 <ul>
-                <li>the variable name (string)</li>
-                <li>the variables type (string)</li>
-                <li>the variables value (string)</li>
+                <li>the variable name (str)</li>
+                <li>list, tuple, dict or set indicator (str)</li>
+                <li>the variables type (str)</li>
+                <li>a flag indicating the presence of children (bool)</li>
+                <li>the length of the array or string (int)</li>
+                <li>the variables value (str)</li>
                 </ul>
         @type list of str
         @param frmnr frame number (0 is the current frame)
@@ -732,7 +735,7 @@
         )
         ericApp().getObject("DebugServer").remoteClientVariable(
             ericApp().getObject("DebugUI").getSelectedDebuggerId(),
-            self.__globalScope,
+            1 if self.__globalScope else 0,
             variablesFilter,
             pathlist,
             self.framenr,
@@ -942,11 +945,14 @@
         Public method to show variables in a list.
 
         @param vlist the list of variables to be displayed. Each
-                list entry is a tuple of three values.
+                list entry is a tuple of six values.
                 <ul>
-                <li>the variable name (string)</li>
-                <li>the variables type (string)</li>
-                <li>the variables value (string)</li>
+                <li>the variable name (str)</li>
+                <li>list, tuple, dict or set indicator (str)</li>
+                <li>the variables type (str)</li>
+                <li>a flag indicating the presence of children (bool)</li>
+                <li>the length of the array or string (int)</li>
+                <li>the variables value (str)</li>
                 </ul>
         @type list
         @param frmnr frame number (0 is the current frame)
@@ -962,11 +968,14 @@
         @param vlist the list of subitems to be displayed.
                 The first element gives the path of the
                 parent variable. Each other list entry is
-                a tuple of three values.
+                a tuple of six values.
                 <ul>
-                <li>the variable name (string)</li>
-                <li>the variables type (string)</li>
-                <li>the variables value (string)</li>
+                <li>the variable name (str)</li>
+                <li>list, tuple, dict or set indicator (str)</li>
+                <li>the variables type (str)</li>
+                <li>a flag indicating the presence of children (bool)</li>
+                <li>the length of the array or string (int)</li>
+                <li>the variables value (str)</li>
                 </ul>
         @type list
         """
@@ -1159,6 +1168,12 @@
         """
         ericApp().getObject("DebugUI").dbgFilterAct.triggered.emit()
 
+    def clear(self):
+        """
+        Public method to clear the viewer.
+        """
+        self.varModel.clear()
+
 
 #
 # eflag: noqa = M822
Binary file src/eric7/Documentation/Help/source.qch has changed
--- a/src/eric7/Documentation/Help/source.qhp	Mon Oct 10 09:25:29 2022 +0200
+++ b/src/eric7/Documentation/Help/source.qhp	Tue Oct 11 13:01:02 2022 +0200
@@ -16898,6 +16898,7 @@
       <keyword name="VariablesViewer.__showContextMenu" id="VariablesViewer.__showContextMenu" ref="eric7.Debugger.VariablesViewer.html#VariablesViewer.__showContextMenu" />
       <keyword name="VariablesViewer.__showDetails" id="VariablesViewer.__showDetails" ref="eric7.Debugger.VariablesViewer.html#VariablesViewer.__showDetails" />
       <keyword name="VariablesViewer.__showVariableDetails" id="VariablesViewer.__showVariableDetails" ref="eric7.Debugger.VariablesViewer.html#VariablesViewer.__showVariableDetails" />
+      <keyword name="VariablesViewer.clear" id="VariablesViewer.clear" ref="eric7.Debugger.VariablesViewer.html#VariablesViewer.clear" />
       <keyword name="VariablesViewer.handleResetUI" id="VariablesViewer.handleResetUI" ref="eric7.Debugger.VariablesViewer.html#VariablesViewer.handleResetUI" />
       <keyword name="VariablesViewer.resizeEvent" id="VariablesViewer.resizeEvent" ref="eric7.Debugger.VariablesViewer.html#VariablesViewer.resizeEvent" />
       <keyword name="VariablesViewer.showVariable" id="VariablesViewer.showVariable" ref="eric7.Debugger.VariablesViewer.html#VariablesViewer.showVariable" />
--- a/src/eric7/Documentation/Source/eric7.DebugClients.Python.DebugClientBase.html	Mon Oct 10 09:25:29 2022 +0200
+++ b/src/eric7/Documentation/Source/eric7.DebugClients.Python.DebugClientBase.html	Tue Oct 11 13:01:02 2022 +0200
@@ -429,8 +429,8 @@
 <dd>
 1 to filter using the globals filter, 0 using the locals
             filter.
-            Variables are only added to the list, if their name do not match
-            any of the filter expressions.
+            Variables are only added to the list, if their access path does not match
+            any of the filter expressions and the 'show/no show' indication.
 </dd>
 <dt><i>filterList</i> (list of str (optional))</dt>
 <dd>
@@ -440,7 +440,8 @@
 </dd>
 <dt><i>var</i> (list of str and int (optional))</dt>
 <dd>
-list encoded name of the requested variable (defaults to None)
+list encoded name of the requested variable (access path) (defaults
+            to None)
 </dd>
 </dl>
 <dl>
--- a/src/eric7/Documentation/Source/eric7.Debugger.VariablesViewer.html	Mon Oct 10 09:25:29 2022 +0200
+++ b/src/eric7/Documentation/Source/eric7.Debugger.VariablesViewer.html	Tue Oct 11 13:01:02 2022 +0200
@@ -732,11 +732,14 @@
 <dt><i>vlist</i> (list of str)</dt>
 <dd>
 the list of variables to be displayed. Each
-                list entry is a tuple of three values.
+                list entry is a tuple of six values.
                 <ul>
-                <li>the variable name (string)</li>
-                <li>the variables type (string)</li>
-                <li>the variables value (string)</li>
+                <li>the variable name (str)</li>
+                <li>list, tuple, dict or set indicator (str)</li>
+                <li>the variables type (str)</li>
+                <li>a flag indicating the presence of children (bool)</li>
+                <li>the length of the array or string (int)</li>
+                <li>the variables value (str)</li>
                 </ul>
 </dd>
 <dt><i>frmnr</i> (int)</dt>
@@ -954,6 +957,10 @@
 <td>Private method to show details about a variable.</td>
 </tr>
 <tr>
+<td><a href="#VariablesViewer.clear">clear</a></td>
+<td>Public method to clear the viewer.</td>
+</tr>
+<tr>
 <td><a href="#VariablesViewer.handleResetUI">handleResetUI</a></td>
 <td>Public method to reset the VariablesViewer.</td>
 </tr>
@@ -1108,6 +1115,13 @@
 reference to the variable item
 </dd>
 </dl>
+<a NAME="VariablesViewer.clear" ID="VariablesViewer.clear"></a>
+<h4>VariablesViewer.clear</h4>
+<b>clear</b>(<i></i>)
+
+<p>
+        Public method to clear the viewer.
+</p>
 <a NAME="VariablesViewer.handleResetUI" ID="VariablesViewer.handleResetUI"></a>
 <h4>VariablesViewer.handleResetUI</h4>
 <b>handleResetUI</b>(<i></i>)
@@ -1143,11 +1157,14 @@
 the list of subitems to be displayed.
                 The first element gives the path of the
                 parent variable. Each other list entry is
-                a tuple of three values.
+                a tuple of six values.
                 <ul>
-                <li>the variable name (string)</li>
-                <li>the variables type (string)</li>
-                <li>the variables value (string)</li>
+                <li>the variable name (str)</li>
+                <li>list, tuple, dict or set indicator (str)</li>
+                <li>the variables type (str)</li>
+                <li>a flag indicating the presence of children (bool)</li>
+                <li>the length of the array or string (int)</li>
+                <li>the variables value (str)</li>
                 </ul>
 </dd>
 </dl>
@@ -1163,11 +1180,14 @@
 <dt><i>vlist</i> (list)</dt>
 <dd>
 the list of variables to be displayed. Each
-                list entry is a tuple of three values.
+                list entry is a tuple of six values.
                 <ul>
-                <li>the variable name (string)</li>
-                <li>the variables type (string)</li>
-                <li>the variables value (string)</li>
+                <li>the variable name (str)</li>
+                <li>list, tuple, dict or set indicator (str)</li>
+                <li>the variables type (str)</li>
+                <li>a flag indicating the presence of children (bool)</li>
+                <li>the length of the array or string (int)</li>
+                <li>the variables value (str)</li>
                 </ul>
 </dd>
 <dt><i>frmnr</i> (int)</dt>

eric ide

mercurial