summaryrefslogtreecommitdiffstats
path: root/Doc/lib/libminiae.tex
blob: a1cd6f4c35b30b0896f7ef745a318e1764371c98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
\section{Standard Module \module{MiniAEFrame}}
\stmodindex{MiniAEFrame}
\label{module-MiniAEFrame}

The module \module{MiniAEFrame} provides a framework for an application
that can function as an Open Scripting Architecture
\index{Open Scripting Architecture}
(OSA) server, i.e. receive and process
AppleEvents\index{AppleEvents}. It can be used in conjunction with
\module{FrameWork}\refstmodindex{FrameWork} or standalone.

This module is temporary, it will eventually be replaced by a module
that handles argument names better and possibly automates making your
application scriptable.

The \module{MiniAEFrame} module defines the following classes:


\begin{classdesc}{AEServer}{}
A class that handles AppleEvent dispatch. Your application should
subclass this class together with either
\class{MiniApplication} or
\class{FrameWork.Application}. Your \method{__init__()} method should
call the \method{__init__()} method for both classes.
\end{classdesc}

\begin{classdesc}{MiniApplication}{}
A class that is more or less compatible with
\class{FrameWork.Application} but with less functionality. Its
event loop supports the apple menu, command-dot and AppleEvents; other
events are passed on to the Python interpreter and/or Sioux.
Useful if your application wants to use \class{AEServer} but does not
provide its own windows, etc.
\end{classdesc}


\subsection{AEServer Objects}
\label{aeserver-objects}

\begin{methoddesc}[AEServer]{installaehandler}{classe, type, callback}
Installs an AppleEvent handler. \var{classe} and \var{type} are the
four-character OSA Class and Type designators, \code{'****'} wildcards
are allowed. When a matching AppleEvent is received the parameters are
decoded and your callback is invoked.
\end{methoddesc}

\begin{methoddesc}[AEServer]{callback}{_object, **kwargs}
Your callback is called with the OSA Direct Object as first positional
parameter. The other parameters are passed as keyword arguments, with
the 4-character designator as name. Three extra keyword parameters are
passed: \code{_class} and \code{_type} are the Class and Type
designators and \code{_attributes} is a dictionary with the AppleEvent
attributes.

The return value of your method is packed with
\function{aetools.packevent()} and sent as reply.
\end{methoddesc}

Note that there are some serious problems with the current
design. AppleEvents which have non-identifier 4-character designators
for arguments are not implementable, and it is not possible to return
an error to the originator. This will be addressed in a future
release.