2 :mod:`MiniAEFrame` --- Open Scripting Architecture server support
3 =================================================================
5 .. module:: MiniAEFrame
7 :synopsis: Support to act as an Open Scripting Architecture (OSA) server ("Apple Events").
11 single: Open Scripting Architecture
15 The module :mod:`MiniAEFrame` provides a framework for an application that can
16 function as an Open Scripting Architecture (OSA) server, i.e. receive and
17 process AppleEvents. It can be used in conjunction with :mod:`FrameWork` or
18 standalone. As an example, it is used in :program:`PythonCGISlave`.
20 The :mod:`MiniAEFrame` module defines the following classes:
25 A class that handles AppleEvent dispatch. Your application should subclass this
26 class together with either :class:`MiniApplication` or
27 :class:`FrameWork.Application`. Your :meth:`__init__` method should call the
28 :meth:`__init__` method for both classes.
31 .. class:: MiniApplication()
33 A class that is more or less compatible with :class:`FrameWork.Application` but
34 with less functionality. Its event loop supports the apple menu, command-dot and
35 AppleEvents; other events are passed on to the Python interpreter and/or Sioux.
36 Useful if your application wants to use :class:`AEServer` but does not provide
46 .. method:: AEServer.installaehandler(classe, type, callback)
48 Installs an AppleEvent handler. *classe* and *type* are the four-character OSA
49 Class and Type designators, ``'****'`` wildcards are allowed. When a matching
50 AppleEvent is received the parameters are decoded and your callback is invoked.
53 .. method:: AEServer.callback(_object, **kwargs)
55 Your callback is called with the OSA Direct Object as first positional
56 parameter. The other parameters are passed as keyword arguments, with the
57 4-character designator as name. Three extra keyword parameters are passed:
58 ``_class`` and ``_type`` are the Class and Type designators and ``_attributes``
59 is a dictionary with the AppleEvent attributes.
61 The return value of your method is packed with :func:`aetools.packevent` and
64 Note that there are some serious problems with the current design. AppleEvents
65 which have non-identifier 4-character designators for arguments are not
66 implementable, and it is not possible to return an error to the originator. This
67 will be addressed in a future release.