summaryrefslogtreecommitdiffstats
path: root/Mac/Lib
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1995-08-14 11:46:24 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1995-08-14 11:46:24 (GMT)
commita4b1d0030ef5ea1c45f29fe52048e4470740be68 (patch)
tree8b410579aecd7d816c0d6c64660a815efd202b1d /Mac/Lib
parentf33a69f2739a2ad7968c0cada7577cbe130602b4 (diff)
downloadcpython-a4b1d0030ef5ea1c45f29fe52048e4470740be68.zip
cpython-a4b1d0030ef5ea1c45f29fe52048e4470740be68.tar.gz
cpython-a4b1d0030ef5ea1c45f29fe52048e4470740be68.tar.bz2
Interface to the Mac List Manager.
Diffstat (limited to 'Mac/Lib')
-rw-r--r--Mac/Lib/test/tlist.py79
-rw-r--r--Mac/Lib/toolbox/Lists.py15
2 files changed, 94 insertions, 0 deletions
diff --git a/Mac/Lib/test/tlist.py b/Mac/Lib/test/tlist.py
new file mode 100644
index 0000000..bf483e1
--- /dev/null
+++ b/Mac/Lib/test/tlist.py
@@ -0,0 +1,79 @@
+# Test List module.
+# Draw a window with all the files in the current folder.
+# double-clicking will change folder.
+#
+# This test expects Win, Evt and FrameWork (and anything used by those)
+# to work.
+
+from FrameWork import *
+import Win
+import Qd
+import List
+import os
+
+class TestList(Application):
+ def __init__(self):
+ os.chdir('Moes:')
+ self.makemenubar()
+ self.makewindow()
+
+ def makewindow(self):
+ r = (40, 40, 400, 300)
+ w = Win.NewWindow(r, "List test", 1, 0, -1, 1, 0x55555555)
+ r2 = (0, 0, 345, 245)
+ self.list = List.LNew(r2, (0, 0, 1, 1), (0,0), 0, w, 0, 1, 1, 1)
+ self.filllist()
+ w.DrawGrowIcon()
+ self.win = w
+
+ def makeusermenus(self):
+ self.filemenu = m = Menu(self.menubar, "File")
+ self.quititem = MenuItem(m, "Quit", "Q", self.quit)
+
+ def quit(self, *args):
+ raise self
+
+ def do_about(self, id, item, window, event):
+ EasyDialogs.Message("""Test the List Manager interface.
+ Double-click on a folder to change directory""")
+
+ def do_activateEvt(self, *args):
+ self.list.LActivate(1) # XXXX Wrong...
+
+ def do_update(self, *args):
+ print 'LUPDATE'
+ self.list.LUpdate()
+
+ def do_inContent(self, partcode, window, event):
+ (what, message, when, where, modifiers) = event
+ Qd.SetPort(window)
+ local = Qd.GlobalToLocal(where)
+ print 'CLICK', where, '->', local
+ dclick = self.list.LClick(local, modifiers)
+ if dclick:
+ h, v = self.list.LLastClick()
+ file = self.list.LGetCell(1000, (h, v))
+ os.chdir(file)
+ self.filllist()
+
+ def filllist(self):
+ """Fill the list with the contents of the current directory"""
+ l = self.list
+ l.LSetDrawingMode(0)
+ l.LDelRow(0, 0)
+ contents = os.listdir(':')
+ print contents
+ l.LAddRow(len(contents), 0)
+ for i in range(len(contents)):
+ l.LSetCell(contents[i], (0, i))
+ l.LSetDrawingMode(1)
+ l.LUpdate()
+
+
+def main():
+ App = TestList()
+ App.mainloop()
+
+if __name__ == '__main__':
+ main()
+
diff --git a/Mac/Lib/toolbox/Lists.py b/Mac/Lib/toolbox/Lists.py
new file mode 100644
index 0000000..79a5f73
--- /dev/null
+++ b/Mac/Lib/toolbox/Lists.py
@@ -0,0 +1,15 @@
+# Generated from 'Sap:CodeWarrior6:Metrowerks C/C++:Headers:Universal Headers 2.0.1f:Lists.h'
+
+lDoVAutoscroll = 2
+lDoHAutoscroll = 1
+lOnlyOne = -128
+lExtendDrag = 64
+lNoDisjoint = 32
+lNoExtend = 16
+lNoRect = 8
+lUseSense = 4
+lNoNilHilite = 2
+lInitMsg = 0
+lDrawMsg = 1
+lHiliteMsg = 2
+lCloseMsg = 3