cinap_lenrekadd hg and python4bb9e2215 years agoHistory
65 lines · 2.5 KB · TeX
RawDownload
\section{\module{MiniAEFrame} ---         Open Scripting Architecture server support} \declaremodule{standard}{MiniAEFrame}  \platform{Mac}\modulesynopsis{Support to act as an Open Scripting Architecture (OSA) server(``Apple Events'').}  The module \module{MiniAEFrame} provides a framework for an applicationthat can function as an Open Scripting Architecture\index{Open Scripting Architecture}(OSA) server, i.e. receive and processAppleEvents\index{AppleEvents}. It can be used in conjunction with\refmodule{FrameWork}\refstmodindex{FrameWork} or standalone. As anexample, it is used in \program{PythonCGISlave}.  The \module{MiniAEFrame} module defines the following classes:  \begin{classdesc}{AEServer}{}A class that handles AppleEvent dispatch. Your application shouldsubclass this class together with either\class{MiniApplication} or\class{FrameWork.Application}. Your \method{__init__()} method shouldcall 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. Itsevent loop supports the apple menu, command-dot and AppleEvents; otherevents are passed on to the Python interpreter and/or Sioux.Useful if your application wants to use \class{AEServer} but does notprovide 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 thefour-character OSA Class and Type designators, \code{'****'} wildcardsare allowed. When a matching AppleEvent is received the parameters aredecoded and your callback is invoked.\end{methoddesc} \begin{methoddesc}[AEServer]{callback}{_object, **kwargs}Your callback is called with the OSA Direct Object as first positionalparameter. The other parameters are passed as keyword arguments, withthe 4-character designator as name. Three extra keyword parameters arepassed: \code{_class} and \code{_type} are the Class and Typedesignators and \code{_attributes} is a dictionary with the AppleEventattributes. 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 currentdesign. AppleEvents which have non-identifier 4-character designatorsfor arguments are not implementable, and it is not possible to returnan error to the originator. This will be addressed in a futurerelease.