diff options
author | Just van Rossum <just@lettererror.com> | 1999-10-30 11:46:18 (GMT) |
---|---|---|
committer | Just van Rossum <just@lettererror.com> | 1999-10-30 11:46:18 (GMT) |
commit | 7171df3e7e48156d47aedb78842242f30f0332e2 (patch) | |
tree | c73bc941c742eab314966b8be0467a960a5a9322 /Mac/Tools | |
parent | afca4153a5aaacda9fa5161caeb55c4fd453810c (diff) | |
download | cpython-7171df3e7e48156d47aedb78842242f30f0332e2.zip cpython-7171df3e7e48156d47aedb78842242f30f0332e2.tar.gz cpython-7171df3e7e48156d47aedb78842242f30f0332e2.tar.bz2 |
Very minor little things... -- jvr
Diffstat (limited to 'Mac/Tools')
-rw-r--r-- | Mac/Tools/IDE/Wapplication.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Mac/Tools/IDE/Wapplication.py b/Mac/Tools/IDE/Wapplication.py index ed639fa..dcad29f 100644 --- a/Mac/Tools/IDE/Wapplication.py +++ b/Mac/Tools/IDE/Wapplication.py @@ -245,8 +245,13 @@ class Application(FrameWork.Application): self.menubar = MenuBar(self) FrameWork.AppleMenu(self.menubar, self.getabouttext(), self.do_about) self.makeusermenus() - - def scriptswalk(self, top, menu): + + def scriptswalk(self, top, menu, done=None): + if done is None: + done = {} + if done.has_key(top): + return + done[top] = 1 import os, macfs, string try: names = os.listdir(top) @@ -258,12 +263,14 @@ class Application(FrameWork.Application): for name in names: fss, isdir, isalias = macfs.ResolveAliasFile(name) path = fss.as_pathname() + if done.has_key(path): + continue name = string.strip(name) if name[-3:] == '---': menu.addseparator() elif isdir: submenu = FrameWork.SubMenu(menu, name) - self.scriptswalk(path, submenu) + self.scriptswalk(path, submenu, done) else: creator, type = fss.GetCreatorType() if type == 'TEXT': @@ -271,6 +278,7 @@ class Application(FrameWork.Application): name = name[:-3] item = FrameWork.MenuItem(menu, name, None, self.domenu_script) self._scripts[(menu.id, item.item)] = path + done[path] = 1 os.chdir(savedir) def domenu_script(self, id, item, window, event): @@ -352,7 +360,8 @@ class Application(FrameWork.Application): import string lowpath = string.lower(filename) for wid, window in self._windows.items(): - if hasattr(window, "path") and lowpath == string.lower(window.path): + if hasattr(window, "path") and type(window.path) == StringType and \ + lowpath == string.lower(window.path): return window elif hasattr(window, "path") and filename == wid.GetWTitle(): return window |