Commit 19a86e72 authored by Guido van Rossum's avatar Guido van Rossum

Added MINHEIGHT. Use self.dict as environment for evaluation.

parent fac6da22
# wdb.py -- a window-based Python debugger # wdbframewin.py -- frame window for wdb.py
# XXX To do:
# - display function name in window title
# - execute arbitrary statements instead of just evaluating expressions
# - allow setting variables by editing their values
import stdwin import stdwin
from stdwinevents import * from stdwinevents import *
...@@ -6,6 +12,7 @@ import basewin ...@@ -6,6 +12,7 @@ import basewin
import sys import sys
WIDTH = 40 WIDTH = 40
MINHEIGHT = 8
MAXHEIGHT = 16 MAXHEIGHT = 16
class FrameWindow(basewin.BaseWindow): class FrameWindow(basewin.BaseWindow):
...@@ -15,12 +22,13 @@ class FrameWindow(basewin.BaseWindow): ...@@ -15,12 +22,13 @@ class FrameWindow(basewin.BaseWindow):
self.frame = frame # Not used except for identity tests self.frame = frame # Not used except for identity tests
self.dict = dict self.dict = dict
self.name = name self.name = name
nl = max(4, len(self.dict)) nl = max(MINHEIGHT, len(self.dict) + 5)
nl = min(nl, MAXHEIGHT) nl = min(nl, MAXHEIGHT)
width = WIDTH*stdwin.textwidth('0') width = WIDTH*stdwin.textwidth('0')
height = nl*stdwin.lineheight() height = nl*stdwin.lineheight()
stdwin.setdefwinsize(width, height) stdwin.setdefwinsize(width, height)
self = basewin.BaseWindow.init(self, '--Frame ' + name + '--') self = basewin.BaseWindow.init(self, '--Frame ' + name + '--')
# XXX Should use current function name
self.initeditor() self.initeditor()
self.displaylist = ['>>>', '', '-'*WIDTH] self.displaylist = ['>>>', '', '-'*WIDTH]
self.refreshframe() self.refreshframe()
...@@ -60,7 +68,7 @@ class FrameWindow(basewin.BaseWindow): ...@@ -60,7 +68,7 @@ class FrameWindow(basewin.BaseWindow):
output = '' output = ''
else: else:
globals = self.frame.f_globals globals = self.frame.f_globals
locals = self.frame.f_locals locals = self.dict
try: try:
value = eval(expr, globals, locals) value = eval(expr, globals, locals)
output = repr.repr(value) output = repr.repr(value)
......
# wdb.py -- a window-based Python debugger # wdbframewin.py -- frame window for wdb.py
# XXX To do:
# - display function name in window title
# - execute arbitrary statements instead of just evaluating expressions
# - allow setting variables by editing their values
import stdwin import stdwin
from stdwinevents import * from stdwinevents import *
...@@ -6,6 +12,7 @@ import basewin ...@@ -6,6 +12,7 @@ import basewin
import sys import sys
WIDTH = 40 WIDTH = 40
MINHEIGHT = 8
MAXHEIGHT = 16 MAXHEIGHT = 16
class FrameWindow(basewin.BaseWindow): class FrameWindow(basewin.BaseWindow):
...@@ -15,12 +22,13 @@ class FrameWindow(basewin.BaseWindow): ...@@ -15,12 +22,13 @@ class FrameWindow(basewin.BaseWindow):
self.frame = frame # Not used except for identity tests self.frame = frame # Not used except for identity tests
self.dict = dict self.dict = dict
self.name = name self.name = name
nl = max(4, len(self.dict)) nl = max(MINHEIGHT, len(self.dict) + 5)
nl = min(nl, MAXHEIGHT) nl = min(nl, MAXHEIGHT)
width = WIDTH*stdwin.textwidth('0') width = WIDTH*stdwin.textwidth('0')
height = nl*stdwin.lineheight() height = nl*stdwin.lineheight()
stdwin.setdefwinsize(width, height) stdwin.setdefwinsize(width, height)
self = basewin.BaseWindow.init(self, '--Frame ' + name + '--') self = basewin.BaseWindow.init(self, '--Frame ' + name + '--')
# XXX Should use current function name
self.initeditor() self.initeditor()
self.displaylist = ['>>>', '', '-'*WIDTH] self.displaylist = ['>>>', '', '-'*WIDTH]
self.refreshframe() self.refreshframe()
...@@ -60,7 +68,7 @@ class FrameWindow(basewin.BaseWindow): ...@@ -60,7 +68,7 @@ class FrameWindow(basewin.BaseWindow):
output = '' output = ''
else: else:
globals = self.frame.f_globals globals = self.frame.f_globals
locals = self.frame.f_locals locals = self.dict
try: try:
value = eval(expr, globals, locals) value = eval(expr, globals, locals)
output = repr.repr(value) output = repr.repr(value)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment