Changed the Python debugger backends to evaluate statements entered into the shell in the frame selected in the local variables viewer.

Sat, 04 Jul 2015 17:31:46 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 04 Jul 2015 17:31:46 +0200
changeset 4309
cc9c62f55413
parent 4307
6a8ec996a49c
child 4313
4dc78bc82783

Changed the Python debugger backends to evaluate statements entered into the shell in the frame selected in the local variables viewer.

APIs/Python3/eric6.api file | annotate | diff | comparison | revisions
DebugClients/Python/DebugBase.py file | annotate | diff | comparison | revisions
DebugClients/Python/DebugClientBase.py file | annotate | diff | comparison | revisions
DebugClients/Python3/DebugBase.py file | annotate | diff | comparison | revisions
DebugClients/Python3/DebugClientBase.py file | annotate | diff | comparison | revisions
Debugger/DebugViewer.py file | annotate | diff | comparison | revisions
Documentation/Help/source.qch file | annotate | diff | comparison | revisions
Documentation/Help/source.qhp file | annotate | diff | comparison | revisions
Documentation/Source/eric6.DebugClients.Python.DebugBase.html file | annotate | diff | comparison | revisions
Documentation/Source/eric6.DebugClients.Python3.DebugBase.html file | annotate | diff | comparison | revisions
Documentation/Source/eric6.Debugger.DebugViewer.html file | annotate | diff | comparison | revisions
Documentation/Source/eric6.Helpviewer.GreaseMonkey.GreaseMonkeyConfiguration.GreaseMonkeyConfigurationDialog.html file | annotate | diff | comparison | revisions
--- a/APIs/Python3/eric6.api	Sat Jul 04 14:46:40 2015 +0200
+++ b/APIs/Python3/eric6.api	Sat Jul 04 17:31:46 2015 +0200
@@ -161,8 +161,8 @@
 eric6.DebugClients.Python.DebugBase.DebugBase.dispatch_return?4(frame, arg)
 eric6.DebugClients.Python.DebugBase.DebugBase.fix_frame_filename?4(frame)
 eric6.DebugClients.Python.DebugBase.DebugBase.getCurrentFrame?4()
-eric6.DebugClients.Python.DebugBase.DebugBase.getCurrentFrameLocals?4()
 eric6.DebugClients.Python.DebugBase.DebugBase.getEvent?4()
+eric6.DebugClients.Python.DebugBase.DebugBase.getFrameLocals?4(frmnr=0)
 eric6.DebugClients.Python.DebugBase.DebugBase.getStack?4()
 eric6.DebugClients.Python.DebugBase.DebugBase.get_break?4(filename, lineno)
 eric6.DebugClients.Python.DebugBase.DebugBase.get_watch?4(cond)
@@ -377,8 +377,8 @@
 eric6.DebugClients.Python3.DebugBase.DebugBase.dispatch_return?4(frame, arg)
 eric6.DebugClients.Python3.DebugBase.DebugBase.fix_frame_filename?4(frame)
 eric6.DebugClients.Python3.DebugBase.DebugBase.getCurrentFrame?4()
-eric6.DebugClients.Python3.DebugBase.DebugBase.getCurrentFrameLocals?4()
 eric6.DebugClients.Python3.DebugBase.DebugBase.getEvent?4()
+eric6.DebugClients.Python3.DebugBase.DebugBase.getFrameLocals?4(frmnr=0)
 eric6.DebugClients.Python3.DebugBase.DebugBase.getStack?4()
 eric6.DebugClients.Python3.DebugBase.DebugBase.get_break?4(filename, lineno)
 eric6.DebugClients.Python3.DebugBase.DebugBase.get_watch?4(cond)
--- a/DebugClients/Python/DebugBase.py	Sat Jul 04 14:46:40 2015 +0200
+++ b/DebugClients/Python/DebugBase.py	Sat Jul 04 17:31:46 2015 +0200
@@ -90,13 +90,23 @@
         """
         return self.currentFrame
     
-    def getCurrentFrameLocals(self):
+    def getFrameLocals(self, frmnr=0):
         """
-        Public method to return the locals dictionary of the current frame.
+        Public method to return the locals dictionary of the current frame
+        or a frame below.
         
-        @return locals dictionary of the current frame
+        @keyparam frmnr distance of frame to get locals dictionary of. 0 is
+            the current frame (int)
+        @return locals dictionary of the frame
         """
-        return self.currentFrameLocals
+        if frmnr:
+            f = self.currentFrame
+            while f is not None and frmnr > 0:
+                f = f.f_back
+                frmnr -= 1
+            return f.f_locals
+        else:
+            return self.currentFrameLocals
     
     def step(self, traceMode):
         """
@@ -797,7 +807,7 @@
         if fn[0] == '<':
             return 1
 
-        #XXX - think of a better way to do this.  It's only a convience for
+        #XXX - think of a better way to do this.  It's only a convenience for
         #debugging the debugger - when the debugger code is in the current
         #directory.
         if os.path.basename(fn) in [
--- a/DebugClients/Python/DebugClientBase.py	Sat Jul 04 14:46:40 2015 +0200
+++ b/DebugClients/Python/DebugClientBase.py	Sat Jul 04 17:31:46 2015 +0200
@@ -759,7 +759,7 @@
                 try:
                     value = eval(
                         arg, self.currentThread.getCurrentFrame().f_globals,
-                        self.currentThread.getCurrentFrameLocals())
+                        self.currentThread.getFrameLocals(0))
                 except:
                     # Report the exception and the traceback
                     try:
@@ -789,7 +789,7 @@
             
             if cmd == DebugProtocol.RequestExec:
                 _globals = self.currentThread.getCurrentFrame().f_globals
-                _locals = self.currentThread.getCurrentFrameLocals()
+                _locals = self.currentThread.getFrameLocals(0)
                 try:
                     code = compile(arg + '\n', '<stdin>', 'single')
                     exec code in _globals, _locals
@@ -966,7 +966,8 @@
                                     frmnr -= 1
                                 _globals = cf.f_globals
                                 _locals = \
-                                    self.currentThread.getCurrentFrameLocals()
+                                    self.currentThread.getFrameLocals(
+                                        self.framenr)
                         # reset sys.stdout to our redirector (unconditionally)
                         if "sys" in _globals:
                             __stdout = _globals["sys"].stdout
--- a/DebugClients/Python3/DebugBase.py	Sat Jul 04 14:46:40 2015 +0200
+++ b/DebugClients/Python3/DebugBase.py	Sat Jul 04 17:31:46 2015 +0200
@@ -89,13 +89,23 @@
         """
         return self.currentFrame
     
-    def getCurrentFrameLocals(self):
+    def getFrameLocals(self, frmnr=0):
         """
-        Public method to return the locals dictionary of the current frame.
+        Public method to return the locals dictionary of the current frame
+        or a frame below.
         
-        @return locals dictionary of the current frame
+        @keyparam frmnr distance of frame to get locals dictionary of. 0 is
+            the current frame (int)
+        @return locals dictionary of the frame
         """
-        return self.currentFrameLocals
+        if frmnr:
+            f = self.currentFrame
+            while f is not None and frmnr > 0:
+                f = f.f_back
+                frmnr -= 1
+            return f.f_locals
+        else:
+            return self.currentFrameLocals
     
     def step(self, traceMode):
         """
@@ -824,7 +834,7 @@
         if fn[0] == '<':
             return True
 
-        #XXX - think of a better way to do this.  It's only a convience for
+        #XXX - think of a better way to do this.  It's only a convenience for
         #debugging the debugger - when the debugger code is in the current
         #directory.
         if os.path.basename(fn) in [
--- a/DebugClients/Python3/DebugClientBase.py	Sat Jul 04 14:46:40 2015 +0200
+++ b/DebugClients/Python3/DebugClientBase.py	Sat Jul 04 17:31:46 2015 +0200
@@ -770,7 +770,7 @@
                     value = eval(
                         arg,
                         self.currentThread.getCurrentFrame().f_globals,
-                        self.currentThread.getCurrentFrameLocals())
+                        self.currentThread.getFrameLocals(0))
                 except:
                     # Report the exception and the traceback
                     try:
@@ -801,7 +801,7 @@
             
             if cmd == DebugProtocol.RequestExec:
                 _globals = self.currentThread.getCurrentFrame().f_globals
-                _locals = self.currentThread.getCurrentFrameLocals()
+                _locals = self.currentThread.getFrameLocals(0)
                 try:
                     code = compile(arg + '\n', '<stdin>', 'single')
                     exec(code, _globals, _locals)
@@ -976,7 +976,8 @@
                                     frmnr -= 1
                                 _globals = cf.f_globals
                                 _locals = \
-                                    self.currentThread.getCurrentFrameLocals()
+                                    self.currentThread.getFrameLocals(
+                                        self.framenr)
                         # reset sys.stdout to our redirector (unconditionally)
                         if "sys" in _globals:
                             __stdout = _globals["sys"].stdout
--- a/Debugger/DebugViewer.py	Sat Jul 04 14:46:40 2015 +0200
+++ b/Debugger/DebugViewer.py	Sat Jul 04 17:31:46 2015 +0200
@@ -37,7 +37,7 @@
 
 class DebugViewer(QWidget):
     """
-    Class implementing a widget conatining various debug related views.
+    Class implementing a widget containing various debug related views.
     
     The individual tabs contain the interpreter shell (optional),
     the filesystem browser (optional), the two variables viewers
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Help/source.qhp	Sat Jul 04 14:46:40 2015 +0200
+++ b/Documentation/Help/source.qhp	Sat Jul 04 17:31:46 2015 +0200
@@ -2690,10 +2690,10 @@
       <keyword name="DebugBase.fix_frame_filename" id="DebugBase.fix_frame_filename" ref="eric6.DebugClients.Python3.DebugBase.html#DebugBase.fix_frame_filename" />
       <keyword name="DebugBase.getCurrentFrame" id="DebugBase.getCurrentFrame" ref="eric6.DebugClients.Python.DebugBase.html#DebugBase.getCurrentFrame" />
       <keyword name="DebugBase.getCurrentFrame" id="DebugBase.getCurrentFrame" ref="eric6.DebugClients.Python3.DebugBase.html#DebugBase.getCurrentFrame" />
-      <keyword name="DebugBase.getCurrentFrameLocals" id="DebugBase.getCurrentFrameLocals" ref="eric6.DebugClients.Python.DebugBase.html#DebugBase.getCurrentFrameLocals" />
-      <keyword name="DebugBase.getCurrentFrameLocals" id="DebugBase.getCurrentFrameLocals" ref="eric6.DebugClients.Python3.DebugBase.html#DebugBase.getCurrentFrameLocals" />
       <keyword name="DebugBase.getEvent" id="DebugBase.getEvent" ref="eric6.DebugClients.Python.DebugBase.html#DebugBase.getEvent" />
       <keyword name="DebugBase.getEvent" id="DebugBase.getEvent" ref="eric6.DebugClients.Python3.DebugBase.html#DebugBase.getEvent" />
+      <keyword name="DebugBase.getFrameLocals" id="DebugBase.getFrameLocals" ref="eric6.DebugClients.Python.DebugBase.html#DebugBase.getFrameLocals" />
+      <keyword name="DebugBase.getFrameLocals" id="DebugBase.getFrameLocals" ref="eric6.DebugClients.Python3.DebugBase.html#DebugBase.getFrameLocals" />
       <keyword name="DebugBase.getStack" id="DebugBase.getStack" ref="eric6.DebugClients.Python.DebugBase.html#DebugBase.getStack" />
       <keyword name="DebugBase.getStack" id="DebugBase.getStack" ref="eric6.DebugClients.Python3.DebugBase.html#DebugBase.getStack" />
       <keyword name="DebugBase.get_break" id="DebugBase.get_break" ref="eric6.DebugClients.Python.DebugBase.html#DebugBase.get_break" />
--- a/Documentation/Source/eric6.DebugClients.Python.DebugBase.html	Sat Jul 04 14:46:40 2015 +0200
+++ b/Documentation/Source/eric6.DebugClients.Python.DebugBase.html	Sat Jul 04 17:31:46 2015 +0200
@@ -111,12 +111,12 @@
 <td><a href="#DebugBase.getCurrentFrame">getCurrentFrame</a></td>
 <td>Public method to return the current frame.</td>
 </tr><tr>
-<td><a href="#DebugBase.getCurrentFrameLocals">getCurrentFrameLocals</a></td>
-<td>Public method to return the locals dictionary of the current frame.</td>
-</tr><tr>
 <td><a href="#DebugBase.getEvent">getEvent</a></td>
 <td>Protected method to return the last debugger event.</td>
 </tr><tr>
+<td><a href="#DebugBase.getFrameLocals">getFrameLocals</a></td>
+<td>Public method to return the locals dictionary of the current frame or a frame below.</td>
+</tr><tr>
 <td><a href="#DebugBase.getStack">getStack</a></td>
 <td>Public method to get the stack.</td>
 </tr><tr>
@@ -426,16 +426,6 @@
 <dd>
 the current frame
 </dd>
-</dl><a NAME="DebugBase.getCurrentFrameLocals" ID="DebugBase.getCurrentFrameLocals"></a>
-<h4>DebugBase.getCurrentFrameLocals</h4>
-<b>getCurrentFrameLocals</b>(<i></i>)
-<p>
-        Public method to return the locals dictionary of the current frame.
-</p><dl>
-<dt>Returns:</dt>
-<dd>
-locals dictionary of the current frame
-</dd>
 </dl><a NAME="DebugBase.getEvent" ID="DebugBase.getEvent"></a>
 <h4>DebugBase.getEvent</h4>
 <b>getEvent</b>(<i></i>)
@@ -446,6 +436,23 @@
 <dd>
 last debugger event (string)
 </dd>
+</dl><a NAME="DebugBase.getFrameLocals" ID="DebugBase.getFrameLocals"></a>
+<h4>DebugBase.getFrameLocals</h4>
+<b>getFrameLocals</b>(<i>frmnr=0</i>)
+<p>
+        Public method to return the locals dictionary of the current frame
+        or a frame below.
+</p><dl>
+<dt><i>frmnr=</i></dt>
+<dd>
+distance of frame to get locals dictionary of. 0 is
+            the current frame (int)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+locals dictionary of the frame
+</dd>
 </dl><a NAME="DebugBase.getStack" ID="DebugBase.getStack"></a>
 <h4>DebugBase.getStack</h4>
 <b>getStack</b>(<i></i>)
--- a/Documentation/Source/eric6.DebugClients.Python3.DebugBase.html	Sat Jul 04 14:46:40 2015 +0200
+++ b/Documentation/Source/eric6.DebugClients.Python3.DebugBase.html	Sat Jul 04 17:31:46 2015 +0200
@@ -114,12 +114,12 @@
 <td><a href="#DebugBase.getCurrentFrame">getCurrentFrame</a></td>
 <td>Public method to return the current frame.</td>
 </tr><tr>
-<td><a href="#DebugBase.getCurrentFrameLocals">getCurrentFrameLocals</a></td>
-<td>Public method to return the locals dictionary of the current frame.</td>
-</tr><tr>
 <td><a href="#DebugBase.getEvent">getEvent</a></td>
 <td>Protected method to return the last debugger event.</td>
 </tr><tr>
+<td><a href="#DebugBase.getFrameLocals">getFrameLocals</a></td>
+<td>Public method to return the locals dictionary of the current frame or a frame below.</td>
+</tr><tr>
 <td><a href="#DebugBase.getStack">getStack</a></td>
 <td>Public method to get the stack.</td>
 </tr><tr>
@@ -445,16 +445,6 @@
 <dd>
 the current frame
 </dd>
-</dl><a NAME="DebugBase.getCurrentFrameLocals" ID="DebugBase.getCurrentFrameLocals"></a>
-<h4>DebugBase.getCurrentFrameLocals</h4>
-<b>getCurrentFrameLocals</b>(<i></i>)
-<p>
-        Public method to return the locals dictionary of the current frame.
-</p><dl>
-<dt>Returns:</dt>
-<dd>
-locals dictionary of the current frame
-</dd>
 </dl><a NAME="DebugBase.getEvent" ID="DebugBase.getEvent"></a>
 <h4>DebugBase.getEvent</h4>
 <b>getEvent</b>(<i></i>)
@@ -465,6 +455,23 @@
 <dd>
 last debugger event (string)
 </dd>
+</dl><a NAME="DebugBase.getFrameLocals" ID="DebugBase.getFrameLocals"></a>
+<h4>DebugBase.getFrameLocals</h4>
+<b>getFrameLocals</b>(<i>frmnr=0</i>)
+<p>
+        Public method to return the locals dictionary of the current frame
+        or a frame below.
+</p><dl>
+<dt><i>frmnr=</i></dt>
+<dd>
+distance of frame to get locals dictionary of. 0 is
+            the current frame (int)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+locals dictionary of the frame
+</dd>
 </dl><a NAME="DebugBase.getStack" ID="DebugBase.getStack"></a>
 <h4>DebugBase.getStack</h4>
 <b>getStack</b>(<i></i>)
--- a/Documentation/Source/eric6.Debugger.DebugViewer.html	Sat Jul 04 14:46:40 2015 +0200
+++ b/Documentation/Source/eric6.Debugger.DebugViewer.html	Sat Jul 04 17:31:46 2015 +0200
@@ -44,7 +44,7 @@
 <table>
 <tr>
 <td><a href="#DebugViewer">DebugViewer</a></td>
-<td>Class implementing a widget conatining various debug related views.</td>
+<td>Class implementing a widget containing various debug related views.</td>
 </tr>
 </table>
 <h3>Functions</h3>
@@ -55,7 +55,7 @@
 <a NAME="DebugViewer" ID="DebugViewer"></a>
 <h2>DebugViewer</h2>
 <p>
-    Class implementing a widget conatining various debug related views.
+    Class implementing a widget containing various debug related views.
 </p><p>
     The individual tabs contain the interpreter shell (optional),
     the filesystem browser (optional), the two variables viewers
--- a/Documentation/Source/eric6.Helpviewer.GreaseMonkey.GreaseMonkeyConfiguration.GreaseMonkeyConfigurationDialog.html	Sat Jul 04 14:46:40 2015 +0200
+++ b/Documentation/Source/eric6.Helpviewer.GreaseMonkey.GreaseMonkeyConfiguration.GreaseMonkeyConfigurationDialog.html	Sat Jul 04 17:31:46 2015 +0200
@@ -73,7 +73,7 @@
 <td>Private slot to remove a script item.</td>
 </tr><tr>
 <td><a href="#GreaseMonkeyConfigurationDialog.on_downloadLabel_linkActivated">on_downloadLabel_linkActivated</a></td>
-<td>Private slot to open the userscript.org web site.</td>
+<td>Private slot to open the greasyfork.org web site.</td>
 </tr><tr>
 <td><a href="#GreaseMonkeyConfigurationDialog.on_openDirectoryButton_clicked">on_openDirectoryButton_clicked</a></td>
 <td>Private slot to open the GreaseMonkey scripts directory.</td>
@@ -143,7 +143,7 @@
 <h4>GreaseMonkeyConfigurationDialog.on_downloadLabel_linkActivated</h4>
 <b>on_downloadLabel_linkActivated</b>(<i>link</i>)
 <p>
-        Private slot to open the userscript.org web site.
+        Private slot to open the greasyfork.org web site.
 </p><dl>
 <dt><i>link</i></dt>
 <dd>

eric ide

mercurial