Fred Drake | c817e27 | 1998-08-10 18:40:22 +0000 | [diff] [blame] | 1 | \section{\module{MiniAEFrame} --- |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 2 | Open Scripting Architecture server support} |
Fred Drake | fe7f3bc | 1998-07-23 17:55:31 +0000 | [diff] [blame] | 3 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 4 | \declaremodule{standard}{MiniAEFrame} |
| 5 | \platform{Mac} |
Fred Drake | fe7f3bc | 1998-07-23 17:55:31 +0000 | [diff] [blame] | 6 | \modulesynopsis{Support to act as an Open Scripting Architecture (OSA) server |
| 7 | (``Apple Events'').} |
| 8 | |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 9 | |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 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 |
Fred Drake | 26fbd8b | 2000-10-14 04:55:15 +0000 | [diff] [blame] | 15 | \refmodule{FrameWork}\refstmodindex{FrameWork} or standalone. As an |
| 16 | example, it is used in \program{PythonCGISlave}. |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 17 | |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 18 | |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 19 | The \module{MiniAEFrame} module defines the following classes: |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 20 | |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 21 | |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 22 | \begin{classdesc}{AEServer}{} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 23 | A class that handles AppleEvent dispatch. Your application should |
| 24 | subclass this class together with either |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 25 | \class{MiniApplication} or |
| 26 | \class{FrameWork.Application}. Your \method{__init__()} method should |
| 27 | call the \method{__init__()} method for both classes. |
| 28 | \end{classdesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 29 | |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 30 | \begin{classdesc}{MiniApplication}{} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 31 | A class that is more or less compatible with |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 32 | \class{FrameWork.Application} but with less functionality. Its |
| 33 | event loop supports the apple menu, command-dot and AppleEvents; other |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 34 | events are passed on to the Python interpreter and/or Sioux. |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 35 | Useful if your application wants to use \class{AEServer} but does not |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 36 | provide its own windows, etc. |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 37 | \end{classdesc} |
| 38 | |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 39 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 40 | \subsection{AEServer Objects \label{aeserver-objects}} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 41 | |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 42 | \begin{methoddesc}[AEServer]{installaehandler}{classe, type, callback} |
| 43 | Installs an AppleEvent handler. \var{classe} and \var{type} are the |
| 44 | four-character OSA Class and Type designators, \code{'****'} wildcards |
| 45 | are allowed. When a matching AppleEvent is received the parameters are |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 46 | decoded and your callback is invoked. |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 47 | \end{methoddesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 48 | |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 49 | \begin{methoddesc}[AEServer]{callback}{_object, **kwargs} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 50 | Your callback is called with the OSA Direct Object as first positional |
| 51 | parameter. The other parameters are passed as keyword arguments, with |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 52 | the 4-character designator as name. Three extra keyword parameters are |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 53 | passed: \code{_class} and \code{_type} are the Class and Type |
| 54 | designators and \code{_attributes} is a dictionary with the AppleEvent |
| 55 | attributes. |
| 56 | |
| 57 | The return value of your method is packed with |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 58 | \function{aetools.packevent()} and sent as reply. |
| 59 | \end{methoddesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 60 | |
| 61 | Note that there are some serious problems with the current |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 62 | design. AppleEvents which have non-identifier 4-character designators |
| 63 | for arguments are not implementable, and it is not possible to return |
| 64 | an error to the originator. This will be addressed in a future |
| 65 | release. |