summaryrefslogtreecommitdiffstats
path: root/Mac/Lib/test/tmenu.py
diff options
context:
space:
mode:
Diffstat (limited to 'Mac/Lib/test/tmenu.py')
-rw-r--r--Mac/Lib/test/tmenu.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/Mac/Lib/test/tmenu.py b/Mac/Lib/test/tmenu.py
index 1b156d7..bc972a8 100644
--- a/Mac/Lib/test/tmenu.py
+++ b/Mac/Lib/test/tmenu.py
@@ -2,12 +2,19 @@
import os
from Menu import *
-
-# Since we can't (yet) list the mounted volumes, here's a list of some:
-my_volumes = ['C:', 'D:', 'E:', 'F:']
+import macfs
+import sys
def main():
global oldbar
+ my_volumes = []
+ while 1:
+ fss, ok = macfs.GetDirectory()
+ if not ok:
+ break
+ my_volumes.append(fss.as_pathname())
+ if not my_volumes:
+ return
oldbar = GetMenuBar()
ClearMenuBar()
makevolmenus(my_volumes)
@@ -40,10 +47,10 @@ def adddirectory(menu, dir, maxdepth = 1):
for file in files:
item = item+1
menu.AppendMenu('x') # add a dummy string
- menu.SetItem(item, file) # set the actual text
+ menu.SetMenuItemText(item, file) # set the actual text
fullname = os.path.join(dir, file)
if os.path.isdir(fullname):
- menu.SetItem(item, ':' + file + ':') # append colons
+ menu.SetMenuItemText(item, ':' + file + ':') # append colons
if maxdepth > 0:
id = nextid()
submenu = NewMenu(id, fullname)
@@ -58,3 +65,4 @@ def adddirectory(menu, dir, maxdepth = 1):
if __name__ == '__main__':
main()
+ sys.exit(1) # To allow the user to interact...