Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 1 | \section{Standard Module \module{MiniAEFrame}} |
Fred Drake | fe7f3bc | 1998-07-23 17:55:31 +0000 | [diff] [blame^] | 2 | \declaremodule{standard}{MiniAEFrame} |
| 3 | |
| 4 | \modulesynopsis{Support to act as an Open Scripting Architecture (OSA) server |
| 5 | (``Apple Events'').} |
| 6 | |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 7 | |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 8 | The module \module{MiniAEFrame} provides a framework for an application |
| 9 | that can function as an Open Scripting Architecture |
| 10 | \index{Open Scripting Architecture} |
| 11 | (OSA) server, i.e. receive and process |
| 12 | AppleEvents\index{AppleEvents}. It can be used in conjunction with |
| 13 | \module{FrameWork}\refstmodindex{FrameWork} or standalone. |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 14 | |
| 15 | This module is temporary, it will eventually be replaced by a module |
| 16 | that handles argument names better and possibly automates making your |
| 17 | application scriptable. |
| 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 | |
| 40 | \subsection{AEServer Objects} |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 41 | \label{aeserver-objects} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 42 | |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 43 | \begin{methoddesc}[AEServer]{installaehandler}{classe, type, callback} |
| 44 | Installs an AppleEvent handler. \var{classe} and \var{type} are the |
| 45 | four-character OSA Class and Type designators, \code{'****'} wildcards |
| 46 | are allowed. When a matching AppleEvent is received the parameters are |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 47 | decoded and your callback is invoked. |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 48 | \end{methoddesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 49 | |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 50 | \begin{methoddesc}[AEServer]{callback}{_object, **kwargs} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 51 | Your callback is called with the OSA Direct Object as first positional |
| 52 | parameter. The other parameters are passed as keyword arguments, with |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 53 | the 4-character designator as name. Three extra keyword parameters are |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 54 | passed: \code{_class} and \code{_type} are the Class and Type |
| 55 | designators and \code{_attributes} is a dictionary with the AppleEvent |
| 56 | attributes. |
| 57 | |
| 58 | The return value of your method is packed with |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 59 | \function{aetools.packevent()} and sent as reply. |
| 60 | \end{methoddesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 61 | |
| 62 | Note that there are some serious problems with the current |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 63 | design. AppleEvents which have non-identifier 4-character designators |
| 64 | for arguments are not implementable, and it is not possible to return |
| 65 | an error to the originator. This will be addressed in a future |
| 66 | release. |