mirror of
https://github.com/python/cpython.git
synced 2024-11-30 18:51:15 +01:00
Prepared for Tk windowing implementation
This commit is contained in:
parent
b96aeafdc3
commit
0eb8837560
@ -250,7 +250,6 @@ class StackBrowser:
|
||||
"""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
|
||||
@ -269,9 +268,9 @@ class StackBrowser:
|
||||
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):
|
||||
@ -280,7 +279,7 @@ class StackBrowser:
|
||||
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 = ""
|
||||
@ -304,9 +303,9 @@ class StackBrowser:
|
||||
|
||||
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)
|
||||
|
||||
|
||||
@ -323,7 +322,7 @@ class StackBrowser:
|
||||
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):
|
||||
@ -332,7 +331,7 @@ class StackBrowser:
|
||||
|
||||
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
|
||||
@ -345,7 +344,7 @@ class StackBrowser:
|
||||
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()
|
||||
@ -391,7 +390,6 @@ class ModuleBrowser:
|
||||
|
||||
def mi_open(self, module):
|
||||
"""Setup initial data structures"""
|
||||
self.create_items()
|
||||
self.cur_module = module
|
||||
self.cur_source = None
|
||||
self.cur_line = None
|
||||
@ -408,22 +406,23 @@ class ModuleBrowser:
|
||||
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:
|
||||
@ -438,7 +437,7 @@ class ModuleBrowser:
|
||||
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()
|
||||
@ -464,7 +463,7 @@ class ModuleBrowser:
|
||||
|
||||
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
|
||||
@ -477,7 +476,7 @@ class ModuleBrowser:
|
||||
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
|
||||
|
@ -181,7 +181,7 @@ class MT_IconTextWidget(MT_TextWidget):
|
||||
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
|
||||
|
@ -234,7 +234,7 @@ class Twit(FrameWork.Application, TwitCore.Application, MiniAEFrame.AEServer):
|
||||
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():
|
||||
|
@ -27,16 +27,15 @@ class ModuleBrowser(FrameWork.DialogWindow, TwitCore.ModuleBrowser):
|
||||
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)
|
||||
@ -45,7 +44,25 @@ class ModuleBrowser(FrameWork.DialogWindow, TwitCore.ModuleBrowser):
|
||||
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)
|
||||
|
@ -37,16 +37,15 @@ class StackBrowser(FrameWork.DialogWindow, TwitCore.StackBrowser):
|
||||
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)
|
||||
@ -56,6 +55,24 @@ class StackBrowser(FrameWork.DialogWindow, TwitCore.StackBrowser):
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user