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