1996-09-24 12:35:50 -03:00
|
|
|
# A stab at a python debugger
|
|
|
|
import Res
|
|
|
|
import Qd
|
|
|
|
import Dlg
|
|
|
|
import Win
|
|
|
|
import FrameWork
|
|
|
|
import EasyDialogs
|
|
|
|
import sys
|
1996-09-26 13:26:05 -03:00
|
|
|
import TwitCore
|
1996-09-24 12:35:50 -03:00
|
|
|
from mac_widgets import MT_AnyList, MT_IconTextWidget
|
|
|
|
|
|
|
|
# Our dialogs
|
1996-12-23 13:11:00 -04:00
|
|
|
ID_MODULES=500
|
1996-09-24 12:35:50 -03:00
|
|
|
I_MODULES_TITLE=1
|
|
|
|
I_MODULES=2
|
|
|
|
I_VARS_TITLE=3
|
|
|
|
I_VARS=4
|
|
|
|
I_SOURCE_TITLE=5
|
|
|
|
I_SOURCE=6
|
|
|
|
I_RULER=7
|
|
|
|
I_EDIT=8
|
|
|
|
|
1996-09-26 13:26:05 -03:00
|
|
|
class ModuleBrowser(FrameWork.DialogWindow, TwitCore.ModuleBrowser):
|
1996-09-24 12:35:50 -03:00
|
|
|
"""The module-browser dialog - mac-dependent part"""
|
|
|
|
def open(self, module):
|
|
|
|
FrameWork.DialogWindow.open(self, ID_MODULES)
|
|
|
|
self.SetPort()
|
|
|
|
Qd.TextFont(3)
|
|
|
|
Qd.TextSize(9)
|
1996-10-09 06:38:46 -03:00
|
|
|
|
1996-09-24 12:35:50 -03:00
|
|
|
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)
|
1996-10-09 06:38:46 -03:00
|
|
|
|
|
|
|
self.mi_open(module)
|
1996-09-24 12:35:50 -03:00
|
|
|
|
|
|
|
def setsource(self, msg):
|
|
|
|
tp, h, rect = self.wid.GetDialogItem(I_SOURCE_TITLE)
|
|
|
|
if self.cur_source:
|
|
|
|
Dlg.SetDialogItemText(h, self.cur_source)
|
|
|
|
else:
|
|
|
|
Dlg.SetDialogItemText(h, msg)
|
|
|
|
self.source.setcontent(self.cur_source)
|
1996-10-09 06:38:46 -03:00
|
|
|
|
|
|
|
def source_setbreaks(self, list):
|
|
|
|
self.source.setbreaks(list)
|
|
|
|
|
|
|
|
def source_setline(self, lineno, icon):
|
|
|
|
self.source.setcurline(lineno, icon)
|
1996-09-24 12:35:50 -03:00
|
|
|
|
1996-10-09 06:38:46 -03:00
|
|
|
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)
|
|
|
|
|
1996-09-24 12:35:50 -03:00
|
|
|
def do_itemhit(self, item, event):
|
|
|
|
(what, message, when, where, modifiers) = event
|
|
|
|
Qd.SetPort(self.wid)
|
|
|
|
where = Qd.GlobalToLocal(where)
|
|
|
|
|
|
|
|
if item == I_MODULES:
|
|
|
|
new_module, double = self.modules.click(where, 0)
|
|
|
|
self.click_module(new_module)
|
|
|
|
elif item == I_VARS:
|
|
|
|
new_var, double = self.vars.click(where, 0)
|
|
|
|
if double:
|
|
|
|
self.click_var(new_var)
|
|
|
|
elif item == I_SOURCE:
|
|
|
|
lineno, inborder = self.source.click(where, 0)
|
|
|
|
if lineno <> None and lineno >= 0:
|
|
|
|
self.click_source(lineno, inborder)
|
|
|
|
elif item == I_EDIT:
|
|
|
|
self.click_edit()
|
|
|
|
|
|
|
|
def do_rawupdate(self, window, event):
|
|
|
|
Qd.SetPort(self.wid)
|
|
|
|
rgn = self.wid.GetWindowPort().visRgn
|
|
|
|
tp, h, rect = self.wid.GetDialogItem(I_RULER)
|
|
|
|
Qd.MoveTo(rect[0], rect[1])
|
|
|
|
Qd.LineTo(rect[2], rect[1])
|
|
|
|
self.modules.update(rgn)
|
|
|
|
self.vars.update(rgn)
|
|
|
|
self.source.update(rgn)
|
|
|
|
|
1996-09-26 13:26:05 -03:00
|
|
|
def force_redraw(self):
|
|
|
|
Qd.SetPort(self.wid)
|
2001-01-23 10:56:31 -04:00
|
|
|
self.wid.InvalWindowRgn(self.wid.GetWindowPort().visRgn)
|
1996-09-26 13:26:05 -03:00
|
|
|
|
1996-09-24 12:35:50 -03:00
|
|
|
def do_activate(self, activate, event):
|
|
|
|
self.modules.activate(activate)
|
|
|
|
self.vars.activate(activate)
|
|
|
|
self.source.activate(activate)
|
|
|
|
|
|
|
|
def close(self):
|
|
|
|
self.parent.module_dialog = None
|
|
|
|
self.source.close()
|
|
|
|
del self.modules
|
|
|
|
del self.vars
|
|
|
|
del self.source
|
|
|
|
self.do_postclose()
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|
|
|
|
|