blob: a1cd6f4c35b30b0896f7ef745a318e1764371c98 [file] [log] [blame]
Fred Drake41788db1998-04-04 06:23:02 +00001\section{Standard Module \module{MiniAEFrame}}
Fred Drakeb4efb6c1998-02-18 17:19:11 +00002\stmodindex{MiniAEFrame}
3\label{module-MiniAEFrame}
4
Fred Drake41788db1998-04-04 06:23:02 +00005The module \module{MiniAEFrame} provides a framework for an application
6that can function as an Open Scripting Architecture
7\index{Open Scripting Architecture}
8(OSA) server, i.e. receive and process
9AppleEvents\index{AppleEvents}. It can be used in conjunction with
10\module{FrameWork}\refstmodindex{FrameWork} or standalone.
Fred Drakeb4efb6c1998-02-18 17:19:11 +000011
12This module is temporary, it will eventually be replaced by a module
13that handles argument names better and possibly automates making your
14application scriptable.
15
Fred Drake41788db1998-04-04 06:23:02 +000016The \module{MiniAEFrame} module defines the following classes:
Fred Drakeb4efb6c1998-02-18 17:19:11 +000017
Fred Drakeb4efb6c1998-02-18 17:19:11 +000018
Fred Drake41788db1998-04-04 06:23:02 +000019\begin{classdesc}{AEServer}{}
Fred Drakeb4efb6c1998-02-18 17:19:11 +000020A class that handles AppleEvent dispatch. Your application should
21subclass this class together with either
Fred Drake41788db1998-04-04 06:23:02 +000022\class{MiniApplication} or
23\class{FrameWork.Application}. Your \method{__init__()} method should
24call the \method{__init__()} method for both classes.
25\end{classdesc}
Fred Drakeb4efb6c1998-02-18 17:19:11 +000026
Fred Drake41788db1998-04-04 06:23:02 +000027\begin{classdesc}{MiniApplication}{}
Fred Drakeb4efb6c1998-02-18 17:19:11 +000028A class that is more or less compatible with
Fred Drake41788db1998-04-04 06:23:02 +000029\class{FrameWork.Application} but with less functionality. Its
30event loop supports the apple menu, command-dot and AppleEvents; other
Fred Drakeb4efb6c1998-02-18 17:19:11 +000031events are passed on to the Python interpreter and/or Sioux.
Fred Drake41788db1998-04-04 06:23:02 +000032Useful if your application wants to use \class{AEServer} but does not
Fred Drakeb4efb6c1998-02-18 17:19:11 +000033provide its own windows, etc.
Fred Drake41788db1998-04-04 06:23:02 +000034\end{classdesc}
35
Fred Drakeb4efb6c1998-02-18 17:19:11 +000036
37\subsection{AEServer Objects}
Fred Drake41788db1998-04-04 06:23:02 +000038\label{aeserver-objects}
Fred Drakeb4efb6c1998-02-18 17:19:11 +000039
Fred Drake41788db1998-04-04 06:23:02 +000040\begin{methoddesc}[AEServer]{installaehandler}{classe, type, callback}
41Installs an AppleEvent handler. \var{classe} and \var{type} are the
42four-character OSA Class and Type designators, \code{'****'} wildcards
43are allowed. When a matching AppleEvent is received the parameters are
Fred Drakeb4efb6c1998-02-18 17:19:11 +000044decoded and your callback is invoked.
Fred Drake41788db1998-04-04 06:23:02 +000045\end{methoddesc}
Fred Drakeb4efb6c1998-02-18 17:19:11 +000046
Fred Drake41788db1998-04-04 06:23:02 +000047\begin{methoddesc}[AEServer]{callback}{_object, **kwargs}
Fred Drakeb4efb6c1998-02-18 17:19:11 +000048Your callback is called with the OSA Direct Object as first positional
49parameter. The other parameters are passed as keyword arguments, with
Fred Drake41788db1998-04-04 06:23:02 +000050the 4-character designator as name. Three extra keyword parameters are
Fred Drakeb4efb6c1998-02-18 17:19:11 +000051passed: \code{_class} and \code{_type} are the Class and Type
52designators and \code{_attributes} is a dictionary with the AppleEvent
53attributes.
54
55The return value of your method is packed with
Fred Drake41788db1998-04-04 06:23:02 +000056\function{aetools.packevent()} and sent as reply.
57\end{methoddesc}
Fred Drakeb4efb6c1998-02-18 17:19:11 +000058
59Note that there are some serious problems with the current
Fred Drake41788db1998-04-04 06:23:02 +000060design. AppleEvents which have non-identifier 4-character designators
61for arguments are not implementable, and it is not possible to return
62an error to the originator. This will be addressed in a future
63release.