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