blob: 346f412c3a32d41cb0c820a180c6c1f0c40fc34b [file] [log] [blame]
Fred Drakec817e271998-08-10 18:40:22 +00001\section{\module{MiniAEFrame} ---
2 Support to act as an Open Scripting Architecture server.}
Fred Drakefe7f3bc1998-07-23 17:55:31 +00003\declaremodule{standard}{MiniAEFrame}
4
5\modulesynopsis{Support to act as an Open Scripting Architecture (OSA) server
6(``Apple Events'').}
7
Fred Drakeb4efb6c1998-02-18 17:19:11 +00008
Fred Drake41788db1998-04-04 06:23:02 +00009The module \module{MiniAEFrame} provides a framework for an application
10that can function as an Open Scripting Architecture
11\index{Open Scripting Architecture}
12(OSA) server, i.e. receive and process
13AppleEvents\index{AppleEvents}. It can be used in conjunction with
14\module{FrameWork}\refstmodindex{FrameWork} or standalone.
Fred Drakeb4efb6c1998-02-18 17:19:11 +000015
16This module is temporary, it will eventually be replaced by a module
17that handles argument names better and possibly automates making your
18application scriptable.
19
Fred Drake41788db1998-04-04 06:23:02 +000020The \module{MiniAEFrame} module defines the following classes:
Fred Drakeb4efb6c1998-02-18 17:19:11 +000021
Fred Drakeb4efb6c1998-02-18 17:19:11 +000022
Fred Drake41788db1998-04-04 06:23:02 +000023\begin{classdesc}{AEServer}{}
Fred Drakeb4efb6c1998-02-18 17:19:11 +000024A class that handles AppleEvent dispatch. Your application should
25subclass this class together with either
Fred Drake41788db1998-04-04 06:23:02 +000026\class{MiniApplication} or
27\class{FrameWork.Application}. Your \method{__init__()} method should
28call the \method{__init__()} method for both classes.
29\end{classdesc}
Fred Drakeb4efb6c1998-02-18 17:19:11 +000030
Fred Drake41788db1998-04-04 06:23:02 +000031\begin{classdesc}{MiniApplication}{}
Fred Drakeb4efb6c1998-02-18 17:19:11 +000032A class that is more or less compatible with
Fred Drake41788db1998-04-04 06:23:02 +000033\class{FrameWork.Application} but with less functionality. Its
34event loop supports the apple menu, command-dot and AppleEvents; other
Fred Drakeb4efb6c1998-02-18 17:19:11 +000035events are passed on to the Python interpreter and/or Sioux.
Fred Drake41788db1998-04-04 06:23:02 +000036Useful if your application wants to use \class{AEServer} but does not
Fred Drakeb4efb6c1998-02-18 17:19:11 +000037provide its own windows, etc.
Fred Drake41788db1998-04-04 06:23:02 +000038\end{classdesc}
39
Fred Drakeb4efb6c1998-02-18 17:19:11 +000040
41\subsection{AEServer Objects}
Fred Drake41788db1998-04-04 06:23:02 +000042\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.