- 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)
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 @@
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 @@
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):