blob: 00666fa28a93b4bb310255436ca300128d4dc37b [file] [log] [blame]
Fred Drakeb4efb6c1998-02-18 17:19:11 +00001\section{Standard Module \sectcode{MiniAEFrame}}
2\stmodindex{MiniAEFrame}
3\label{module-MiniAEFrame}
4
5The module \var{MiniAEFrame} provides a framework for an application
6that can function as an OSA server, i.e. receive and process
7AppleEvents. It can be used in conjunction with \var{FrameWork} or
8standalone.
9
10This module is temporary, it will eventually be replaced by a module
11that handles argument names better and possibly automates making your
12application scriptable.
13
14The \var{MiniAEFrame} module defines the following classes:
15
16\setindexsubitem{(in module MiniAEFrame)}
17
18\begin{funcdesc}{AEServer}{}
19A class that handles AppleEvent dispatch. Your application should
20subclass this class together with either
21\code{MiniAEFrame.MiniApplication} or
22\code{FrameWork.Application}. Your \code{__init__} method should call
23the \code{__init__} method for both classes.
24\end{funcdesc}
25
26\begin{funcdesc}{MiniApplication}{}
27A class that is more or less compatible with
28\code{FrameWork.Application} but with less functionality. Its
29eventloop supports the apple menu, command-dot and AppleEvents, other
30events are passed on to the Python interpreter and/or Sioux.
31Useful if your application wants to use \code{AEServer} but does not
32provide its own windows, etc.
33\end{funcdesc}
34
35\subsection{AEServer Objects}
36
37\setindexsubitem{(AEServer method)}
38
39\begin{funcdesc}{installaehandler}{classe\, type\, callback}
40Installs an AppleEvent handler. \code{Classe} and \code{type} are the
41four-char OSA Class and Type designators, \code{'****'} wildcards are
42allowed. When a matching AppleEvent is received the parameters are
43decoded and your callback is invoked.
44\end{funcdesc}
45
46\begin{funcdesc}{callback}{_object\, **kwargs}
47Your callback is called with the OSA Direct Object as first positional
48parameter. The other parameters are passed as keyword arguments, with
49the 4-char designator as name. Three extra keyword parameters are
50passed: \code{_class} and \code{_type} are the Class and Type
51designators and \code{_attributes} is a dictionary with the AppleEvent
52attributes.
53
54The return value of your method is packed with
55\code{aetools.packevent} and sent as reply.
56\end{funcdesc}
57
58Note that there are some serious problems with the current
59design. AppleEvents which have non-identifier 4-char designators for
60arguments are not implementable, and it is not possible to return an
61error to the originator. This will be addressed in a future release.