"""Base code for stack browser"""
def mi_open(self):
"""Setup initial data structures"""
- self.create_items()
self.cur_stackitem = None
self.cur_source = None
self.cur_modname = None
self.setprogramstate(self.parent.dbg.getprogramstate())
names, locations = self.parent.dbg.getstacktrace()
- self.stack.setcontent(names, locations)
+ self.stack_setcontent(names, locations)
self.cur_stackitem = len(names)-1
- self.stack.select(self.cur_stackitem)
+ self.stack_select(self.cur_stackitem)
self.setup_frame()
def setup_frame(self):
self.cont_varnames, self.cont_varvalues = \
self.parent.dbg.getframevars(self.cur_stackitem,
self.show_complex, self.show_system)
- self.vars.setcontent(self.cont_varnames, self.cont_varvalues)
+ self.setvars()
self.set_var_buttons()
msg = ""
self.setsource(msg)
if not self.cur_line:
- self.source.setcurline(1, ICON_ZERO)
+ self.source_setline(1, ICON_ZERO)
else:
- self.source.setcurline(self.cur_line, self.parent.dbg.icon)
+ self.source_setline(self.cur_line, self.parent.dbg.icon)
self.breaks_changed(self.cur_source)
def click_stack(self, number, *dummy):
if number == self.cur_stackitem: return
self.cur_stackitem = number
- self.stack.select(self.cur_stackitem)
+ self.stack_select(self.cur_stackitem)
self.setup_frame()
def click_var(self, var, *dummy):
def click_source(self, lineno, inborder):
if not inborder:
- self.source.select(lineno)
+ self.source_select(lineno)
self.cur_line = lineno
if lineno == None or not self.cur_source or not inborder:
return
def breaks_changed(self, filename):
if filename == self.cur_source:
list = self.parent.dbg.get_file_breaks(filename)
- self.source.setbreaks(list)
+ self.source_setbreaks(list)
def click_quit(self):
self.parent.quit()
def mi_open(self, module):
"""Setup initial data structures"""
- self.create_items()
self.cur_module = module
self.cur_source = None
self.cur_line = None
if not self.cur_module in modnames:
self.cur_module = None
if modnames <> self.cont_modules:
- self.modules.setcontent(modnames)
self.cont_modules = modnames
+ self.setmodulenames()
if self.cur_module:
- self.modules.select(self.cont_modules.index(self.cur_module))
+ self.module_select(self.cont_modules.index(self.cur_module))
else:
- self.modules.select(None)
+ self.module_select(None)
self.setup_module()
def setup_module(self):
"""Setup module-dependent widget data"""
self.parent.SetWatch()
if not self.cur_module:
- self.vars.setcontent([], [])
+ self.cont_varnames = []
+ self.cont_varvalues = []
else:
self.cont_varnames, self.cont_varvalues = getmodulevars(self.cur_module)
- self.vars.setcontent(self.cont_varnames, self.cont_varvalues)
+ self.setvars()
msg = ""
if not self.cur_module:
msg = "Not a python module"
self.cur_lineno = 0
self.setsource(msg)
- self.source.select(self.cur_line)
+ self.source_select(self.cur_line)
self.breaks_changed(self.cur_source)
self.parent.SetCursor()
def click_source(self, lineno, inborder):
if not inborder:
- self.source.select(lineno)
+ self.source_select(lineno)
self.cur_lineno = lineno
if lineno == None or not self.cur_source or not inborder:
return
def breaks_changed(self, filename):
if filename == self.cur_source:
list = self.parent.dbg.get_file_breaks(filename)
- self.source.setbreaks(list)
+ self.source_setbreaks(list)
def click_edit(self):
lino = self.cur_lineno
self.breakpointlist = []
self.curline = None
self.iconrect = (self.rect[0]+1, self.rect[1]+1,
- self.terect[0]-1, self.terect[3]-1)
+ self.terect[0]-1, self.rect[3]-SCROLLBAR)
self.curlinerange = (self.terect[1]+self.ted.lineHeight,
self.terect[3]-2*self.ted.lineHeight)
self.piccurrent = 512
return mactwit_browser.VarBrowser(parent).open(var)
def edit(self, file, line):
- return mactwit_edit(file, line)
+ return mactwit_edit.edit(file, line)
def Initialize():
self.SetPort()
Qd.TextFont(3)
Qd.TextSize(9)
- self.mi_open(module)
-
- def create_items(self):
- """Create the lists we need"""
+
tp, h, rect = self.wid.GetDialogItem(I_MODULES)
self.modules = MT_AnyList(self.wid, rect, 1)
tp, h, rect = self.wid.GetDialogItem(I_VARS)
self.vars = MT_AnyList(self.wid, rect, 2)
tp, h, rect = self.wid.GetDialogItem(I_SOURCE)
self.source = MT_IconTextWidget(self.wid, rect)
+
+ self.mi_open(module)
def setsource(self, msg):
tp, h, rect = self.wid.GetDialogItem(I_SOURCE_TITLE)
else:
Dlg.SetDialogItemText(h, msg)
self.source.setcontent(self.cur_source)
+
+ def source_setbreaks(self, list):
+ self.source.setbreaks(list)
+
+ def source_setline(self, lineno, icon):
+ self.source.setcurline(lineno, icon)
+ def source_select(self, lineno):
+ self.source.select(lineno)
+
+ def setmodulenames(self):
+ self.modules.setcontent(self.cont_modules)
+
+ def module_select(self, number):
+ self.modules.select(number)
+
+ def setvars(self):
+ self.vars.setcontent(self.cont_varnames, self.cont_varvalues)
+
def do_itemhit(self, item, event):
(what, message, when, where, modifiers) = event
Qd.SetPort(self.wid)
self.SetPort()
Qd.TextFont(3)
Qd.TextSize(9)
- self.mi_open()
-
- def create_items(self):
- """Create the lists we need"""
+
tp, h, rect = self.wid.GetDialogItem(I_STACK)
self.stack = MT_IndexList(self.wid, rect, 2)
tp, h, rect = self.wid.GetDialogItem(I_VARS)
self.vars = MT_AnyList(self.wid, rect, 2)
tp, h, rect = self.wid.GetDialogItem(I_SOURCE)
self.source = MT_IconTextWidget(self.wid, rect)
+
+ self.mi_open()
def setsource(self, msg):
tp, h, rect = self.wid.GetDialogItem(I_SOURCE_TITLE)
Dlg.SetDialogItemText(h, msg)
self.source.setcontent(self.cur_source)
+ def source_setbreaks(self, list):
+ self.source.setbreaks(list)
+
+ def source_setline(self, lineno, icon):
+ self.source.setcurline(lineno, icon)
+
+ def source_select(self, lineno):
+ self.source.select(lineno)
+
+ def stack_setcontent(self, names, locations):
+ self.stack.setcontent(names, locations)
+
+ def stack_select(self, number):
+ self.stack.select(number)
+
+ def setvars(self):
+ self.vars.setcontent(self.cont_varnames, self.cont_varvalues)
+
def setexception(self, name, value):
if name == None:
self.wid.HideDialogItem(I_EXC)