1 \section{\module{MiniAEFrame
} ---
2 Open Scripting Architecture server support
}
4 \declaremodule{standard
}{MiniAEFrame
}
6 \modulesynopsis{Support to act as an Open Scripting Architecture (OSA) server
10 The module
\module{MiniAEFrame
} provides a framework for an application
11 that can function as an Open Scripting Architecture
12 \index{Open Scripting Architecture
}
13 (OSA) server, i.e. receive and process
14 AppleEvents
\index{AppleEvents
}. It can be used in conjunction with
15 \refmodule{FrameWork
}\refstmodindex{FrameWork
} or standalone.
17 This module is temporary, it will eventually be replaced by a module
18 that handles argument names better and possibly automates making your
19 application scriptable.
21 The
\module{MiniAEFrame
} module defines the following classes:
24 \begin{classdesc
}{AEServer
}{}
25 A class that handles AppleEvent dispatch. Your application should
26 subclass this class together with either
27 \class{MiniApplication
} or
28 \class{FrameWork.Application
}. Your
\method{__init__()
} method should
29 call the
\method{__init__()
} method for both classes.
32 \begin{classdesc
}{MiniApplication
}{}
33 A class that is more or less compatible with
34 \class{FrameWork.Application
} but with less functionality. Its
35 event loop supports the apple menu, command-dot and AppleEvents; other
36 events are passed on to the Python interpreter and/or Sioux.
37 Useful if your application wants to use
\class{AEServer
} but does not
38 provide its own windows, etc.
42 \subsection{AEServer Objects
\label{aeserver-objects
}}
44 \begin{methoddesc
}[AEServer
]{installaehandler
}{classe, type, callback
}
45 Installs an AppleEvent handler.
\var{classe
} and
\var{type
} are the
46 four-character OSA Class and Type designators,
\code{'****'
} wildcards
47 are allowed. When a matching AppleEvent is received the parameters are
48 decoded and your callback is invoked.
51 \begin{methoddesc
}[AEServer
]{callback
}{_object, **kwargs
}
52 Your callback is called with the OSA Direct Object as first positional
53 parameter. The other parameters are passed as keyword arguments, with
54 the
4-character designator as name. Three extra keyword parameters are
55 passed:
\code{_class
} and
\code{_type
} are the Class and Type
56 designators and
\code{_attributes
} is a dictionary with the AppleEvent
59 The return value of your method is packed with
60 \function{aetools.packevent()
} and sent as reply.
63 Note that there are some serious problems with the current
64 design. AppleEvents which have non-identifier
4-character designators
65 for arguments are not implementable, and it is not possible to return
66 an error to the originator. This will be addressed in a future