summaryrefslogtreecommitdiffstats
path: root/Mac/Tools/twit/mactwit_mod.py
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1996-09-24 15:35:50 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1996-09-24 15:35:50 (GMT)
commit4892ab7f79dbd7a0ee19afa83944be5f3f5b0507 (patch)
tree7c00da4abdfe4f10013d57b6216f24da7f0824a6 /Mac/Tools/twit/mactwit_mod.py
parentf5b31c94a29674d1ca7d7f9c86cc91d16f060952 (diff)
downloadcpython-4892ab7f79dbd7a0ee19afa83944be5f3f5b0507.zip
cpython-4892ab7f79dbd7a0ee19afa83944be5f3f5b0507.tar.gz
cpython-4892ab7f79dbd7a0ee19afa83944be5f3f5b0507.tar.bz2
The Window Independent Tracer (which will probably move elsewhere once
it is truly window-independent:-)
Diffstat (limited to 'Mac/Tools/twit/mactwit_mod.py')
-rw-r--r--Mac/Tools/twit/mactwit_mod.py92
1 files changed, 92 insertions, 0 deletions
diff --git a/Mac/Tools/twit/mactwit_mod.py b/Mac/Tools/twit/mactwit_mod.py
new file mode 100644
index 0000000..e3a42bb
--- /dev/null
+++ b/Mac/Tools/twit/mactwit_mod.py
@@ -0,0 +1,92 @@
+# A stab at a python debugger
+import Res
+import Qd
+import Dlg
+import Win
+import FrameWork
+import EasyDialogs
+import sys
+from mac_widgets import MT_AnyList, MT_IconTextWidget
+
+# Our dialogs
+ID_MODULES=512
+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
+
+class ModuleBrowser(FrameWork.DialogWindow):
+ """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)
+ 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)
+
+ 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)
+
+ 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)
+
+ 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()
+