blob: 9d815f098f86317e4da99952d6ad908588699360 [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 Drake26fbd8b2000-10-14 04:55:15 +000015\refmodule{FrameWork}\refstmodindex{FrameWork} or standalone. As an
16example, it is used in \program{PythonCGISlave}.
Fred Drakeb4efb6c1998-02-18 17:19:11 +000017
Fred Drakeb4efb6c1998-02-18 17:19:11 +000018
Fred Drake41788db1998-04-04 06:23:02 +000019The \module{MiniAEFrame} module defines the following classes:
Fred Drakeb4efb6c1998-02-18 17:19:11 +000020
Fred Drakeb4efb6c1998-02-18 17:19:11 +000021
Fred Drake41788db1998-04-04 06:23:02 +000022\begin{classdesc}{AEServer}{}
Fred Drakeb4efb6c1998-02-18 17:19:11 +000023A class that handles AppleEvent dispatch. Your application should
24subclass this class together with either
Fred Drake41788db1998-04-04 06:23:02 +000025\class{MiniApplication} or
26\class{FrameWork.Application}. Your \method{__init__()} method should
27call the \method{__init__()} method for both classes.
28\end{classdesc}
Fred Drakeb4efb6c1998-02-18 17:19:11 +000029
Fred Drake41788db1998-04-04 06:23:02 +000030\begin{classdesc}{MiniApplication}{}
Fred Drakeb4efb6c1998-02-18 17:19:11 +000031A class that is more or less compatible with
Fred Drake41788db1998-04-04 06:23:02 +000032\class{FrameWork.Application} but with less functionality. Its
33event loop supports the apple menu, command-dot and AppleEvents; other
Fred Drakeb4efb6c1998-02-18 17:19:11 +000034events are passed on to the Python interpreter and/or Sioux.
Fred Drake41788db1998-04-04 06:23:02 +000035Useful if your application wants to use \class{AEServer} but does not
Fred Drakeb4efb6c1998-02-18 17:19:11 +000036provide its own windows, etc.
Fred Drake41788db1998-04-04 06:23:02 +000037\end{classdesc}
38
Fred Drakeb4efb6c1998-02-18 17:19:11 +000039
Fred Drakef6863c11999-03-02 16:37:17 +000040\subsection{AEServer Objects \label{aeserver-objects}}
Fred Drakeb4efb6c1998-02-18 17:19:11 +000041
Fred Drake41788db1998-04-04 06:23:02 +000042\begin{methoddesc}[AEServer]{installaehandler}{classe, type, callback}
43Installs an AppleEvent handler. \var{classe} and \var{type} are the
44four-character OSA Class and Type designators, \code{'****'} wildcards
45are allowed. When a matching AppleEvent is received the parameters are
Fred Drakeb4efb6c1998-02-18 17:19:11 +000046decoded and your callback is invoked.
Fred Drake41788db1998-04-04 06:23:02 +000047\end{methoddesc}
Fred Drakeb4efb6c1998-02-18 17:19:11 +000048
Fred Drake41788db1998-04-04 06:23:02 +000049\begin{methoddesc}[AEServer]{callback}{_object, **kwargs}
Fred Drakeb4efb6c1998-02-18 17:19:11 +000050Your callback is called with the OSA Direct Object as first positional
51parameter. The other parameters are passed as keyword arguments, with
Fred Drake41788db1998-04-04 06:23:02 +000052the 4-character designator as name. Three extra keyword parameters are
Fred Drakeb4efb6c1998-02-18 17:19:11 +000053passed: \code{_class} and \code{_type} are the Class and Type
54designators and \code{_attributes} is a dictionary with the AppleEvent
55attributes.
56
57The return value of your method is packed with
Fred Drake41788db1998-04-04 06:23:02 +000058\function{aetools.packevent()} and sent as reply.
59\end{methoddesc}
Fred Drakeb4efb6c1998-02-18 17:19:11 +000060
61Note that there are some serious problems with the current
Fred Drake41788db1998-04-04 06:23:02 +000062design. AppleEvents which have non-identifier 4-character designators
63for arguments are not implementable, and it is not possible to return
64an error to the originator. This will be addressed in a future
65release.