summaryrefslogtreecommitdiffstats
path: root/Lib/plat-mac/aetools.py
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2003-06-13 14:27:35 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2003-06-13 14:27:35 (GMT)
commitc8882b10c490298c670cec8ad6239acfaf14a66a (patch)
tree71720a8fb0344f58045743bee501a2925951b990 /Lib/plat-mac/aetools.py
parentfdbe5223b7402ee34c4f0c06caa6faabd9e73e35 (diff)
downloadcpython-c8882b10c490298c670cec8ad6239acfaf14a66a.zip
cpython-c8882b10c490298c670cec8ad6239acfaf14a66a.tar.gz
cpython-c8882b10c490298c670cec8ad6239acfaf14a66a.tar.bz2
- Allow access to poperties of the "application" OSA class directly from
the toplevel package. This already worked for elements, but now for properties too. Fixes #753925. - Even better, the toplevel class (such as Finder.Finder) now inherits the element and property dictionaries of its application class and has the necessary glue to allow you to say f = Finder.Finder() f.get(f.name)
Diffstat (limited to 'Lib/plat-mac/aetools.py')
-rw-r--r--Lib/plat-mac/aetools.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/Lib/plat-mac/aetools.py b/Lib/plat-mac/aetools.py
index 79b8069..92d6ec9 100644
--- a/Lib/plat-mac/aetools.py
+++ b/Lib/plat-mac/aetools.py
@@ -154,7 +154,7 @@ class TalkTo:
Evt.WaitNextEvent(0,0)
return 1
__ensure_WMAvailable = classmethod(__ensure_WMAvailable)
-
+
def __init__(self, signature=None, start=0, timeout=0):
"""Create a communication channel with a particular application.
@@ -284,6 +284,18 @@ class TalkTo:
set = _set
+ # Magic glue to allow suite-generated classes to function somewhat
+ # like the "application" class in OSA.
+
+ def __getattr__(self, name):
+ if self._elemdict.has_key(name):
+ cls = self._elemdict[name]
+ return DelayedComponentItem(cls, None)
+ if self._propdict.has_key(name):
+ cls = self._propdict[name]
+ return cls()
+ raise AttributeError, name
+
# Tiny Finder class, for local use only
class _miniFinder(TalkTo):