blob: 4ea2a41de2df99089832df394001bff1b90e3393 [file] [log] [blame]
Fred Drakec817e271998-08-10 18:40:22 +00001\section{\module{MiniAEFrame} ---
Fred Drakef6863c11999-03-02 16:37:17 +00002 Open Scripting Architecture server support}
Fred Drakefe7f3bc1998-07-23 17:55:31 +00003
Fred Drakef6863c11999-03-02 16:37:17 +00004\declaremodule{standard}{MiniAEFrame}
5 \platform{Mac}
Fred Drakefe7f3bc1998-07-23 17:55:31 +00006\modulesynopsis{Support to act as an Open Scripting Architecture (OSA) server
7(``Apple Events'').}
8
Fred Drakeb4efb6c1998-02-18 17:19:11 +00009
Fred Drake41788db1998-04-04 06:23:02 +000010The module \module{MiniAEFrame} provides a framework for an application
11that can function as an Open Scripting Architecture
12\index{Open Scripting Architecture}
13(OSA) server, i.e. receive and process
14AppleEvents\index{AppleEvents}. It can be used in conjunction with
Fred Drakef6863c11999-03-02 16:37:17 +000015\refmodule{FrameWork}\refstmodindex{FrameWork} or standalone.
Fred Drakeb4efb6c1998-02-18 17:19:11 +000016
17This module is temporary, it will eventually be replaced by a module
18that handles argument names better and possibly automates making your
19application scriptable.
20
Fred Drake41788db1998-04-04 06:23:02 +000021The \module{MiniAEFrame} module defines the following classes:
Fred Drakeb4efb6c1998-02-18 17:19:11 +000022
Fred Drakeb4efb6c1998-02-18 17:19:11 +000023
Fred Drake41788db1998-04-04 06:23:02 +000024\begin{classdesc}{AEServer}{}
Fred Drakeb4efb6c1998-02-18 17:19:11 +000025A class that handles AppleEvent dispatch. Your application should
26subclass this class together with either
Fred Drake41788db1998-04-04 06:23:02 +000027\class{MiniApplication} or
28\class{FrameWork.Application}. Your \method{__init__()} method should
29call the \method{__init__()} method for both classes.
30\end{classdesc}
Fred Drakeb4efb6c1998-02-18 17:19:11 +000031
Fred Drake41788db1998-04-04 06:23:02 +000032\begin{classdesc}{MiniApplication}{}
Fred Drakeb4efb6c1998-02-18 17:19:11 +000033A class that is more or less compatible with
Fred Drake41788db1998-04-04 06:23:02 +000034\class{FrameWork.Application} but with less functionality. Its
35event loop supports the apple menu, command-dot and AppleEvents; other
Fred Drakeb4efb6c1998-02-18 17:19:11 +000036events are passed on to the Python interpreter and/or Sioux.
Fred Drake41788db1998-04-04 06:23:02 +000037Useful if your application wants to use \class{AEServer} but does not
Fred Drakeb4efb6c1998-02-18 17:19:11 +000038provide its own windows, etc.
Fred Drake41788db1998-04-04 06:23:02 +000039\end{classdesc}
40
Fred Drakeb4efb6c1998-02-18 17:19:11 +000041
Fred Drakef6863c11999-03-02 16:37:17 +000042\subsection{AEServer Objects \label{aeserver-objects}}
Fred Drakeb4efb6c1998-02-18 17:19:11 +000043
Fred Drake41788db1998-04-04 06:23:02 +000044\begin{methoddesc}[AEServer]{installaehandler}{classe, type, callback}
45Installs an AppleEvent handler. \var{classe} and \var{type} are the
46four-character OSA Class and Type designators, \code{'****'} wildcards
47are allowed. When a matching AppleEvent is received the parameters are
Fred Drakeb4efb6c1998-02-18 17:19:11 +000048decoded and your callback is invoked.
Fred Drake41788db1998-04-04 06:23:02 +000049\end{methoddesc}
Fred Drakeb4efb6c1998-02-18 17:19:11 +000050
Fred Drake41788db1998-04-04 06:23:02 +000051\begin{methoddesc}[AEServer]{callback}{_object, **kwargs}
Fred Drakeb4efb6c1998-02-18 17:19:11 +000052Your callback is called with the OSA Direct Object as first positional
53parameter. The other parameters are passed as keyword arguments, with
Fred Drake41788db1998-04-04 06:23:02 +000054the 4-character designator as name. Three extra keyword parameters are
Fred Drakeb4efb6c1998-02-18 17:19:11 +000055passed: \code{_class} and \code{_type} are the Class and Type
56designators and \code{_attributes} is a dictionary with the AppleEvent
57attributes.
58
59The return value of your method is packed with
Fred Drake41788db1998-04-04 06:23:02 +000060\function{aetools.packevent()} and sent as reply.
61\end{methoddesc}
Fred Drakeb4efb6c1998-02-18 17:19:11 +000062
63Note that there are some serious problems with the current
Fred Drake41788db1998-04-04 06:23:02 +000064design. AppleEvents which have non-identifier 4-character designators
65for arguments are not implementable, and it is not possible to return
66an error to the originator. This will be addressed in a future
67release.