Kaydet (Commit) 41788db3 authored tarafından Fred Drake's avatar Fred Drake

Logical markup.

Index entries.
üst 9b28fe28
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
\stmodindex{FrameWork} \stmodindex{FrameWork}
\label{module-FrameWork} \label{module-FrameWork}
The \code{FrameWork} module contains classes that together provide a The \module{FrameWork} module contains classes that together provide a
framework for an interactive Macintosh application. The programmer framework for an interactive Macintosh application. The programmer
builds an application by creating subclasses that override various builds an application by creating subclasses that override various
methods of the bases classes, thereby implementing the functionality methods of the bases classes, thereby implementing the functionality
...@@ -11,18 +11,17 @@ different levels, i.e. to handle clicks in a single dialog window in a ...@@ -11,18 +11,17 @@ different levels, i.e. to handle clicks in a single dialog window in a
non-standard way it is not necessary to override the complete event non-standard way it is not necessary to override the complete event
handling. handling.
The \code{FrameWork} is still very much work-in-progress, and the The \module{FrameWork} is still very much work-in-progress, and the
documentation describes only the most important functionality, and not documentation describes only the most important functionality, and not
in the most logical manner at that. Examine the source or the examples in the most logical manner at that. Examine the source or the examples
for more details. for more details.
The \code{FrameWork} module defines the following functions: The \module{FrameWork} module defines the following functions:
\setindexsubitem{(in module FrameWork)}
\begin{funcdesc}{Application}{} \begin{funcdesc}{Application}{}
An object representing the complete application. See below for a An object representing the complete application. See below for a
description of the methods. The default \code{__init__} routine description of the methods. The default \method{__init__()} routine
creates an empty window dictionary and a menu bar with an apple menu. creates an empty window dictionary and a menu bar with an apple menu.
\end{funcdesc} \end{funcdesc}
...@@ -88,23 +87,25 @@ Set the mouse cursor to a watch. ...@@ -88,23 +87,25 @@ Set the mouse cursor to a watch.
Set the mouse cursor to an arrow. Set the mouse cursor to an arrow.
\end{funcdesc} \end{funcdesc}
\subsection{Application objects} \subsection{Application Objects}
\label{application-objects}
Application objects have the following methods, among others: Application objects have the following methods, among others:
\setindexsubitem{(Application method)} \setindexsubitem{(Application method)}
\begin{funcdesc}{makeusermenus}{} \begin{funcdesc}{makeusermenus}{}
Override this method if you need menus in your application. Append the Override this method if you need menus in your application. Append the
menus to \code{self.menubar}. menus to the attribute \member{menubar}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{getabouttext}{} \begin{funcdesc}{getabouttext}{}
Override this method to return a text string describing your Override this method to return a text string describing your
application. Alternatively, override the \code{do_about} method for application. Alternatively, override the \method{do_about()} method
more elaborate about messages. for more elaborate ``about'' messages.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{mainloop}{\optional{mask, wait}} \begin{funcdesc}{mainloop}{\optional{mask\optional{, wait}}}
This routine is the main event loop, call it to set your application This routine is the main event loop, call it to set your application
rolling. \var{Mask} is the mask of events you want to handle, rolling. \var{Mask} is the mask of events you want to handle,
\var{wait} is the number of ticks you want to leave to other \var{wait} is the number of ticks you want to leave to other
...@@ -117,13 +118,14 @@ overridden. The default methods take care of dispatching events to ...@@ -117,13 +118,14 @@ overridden. The default methods take care of dispatching events to
windows and dialogs, handling drags and resizes, Apple Events, events windows and dialogs, handling drags and resizes, Apple Events, events
for non-FrameWork windows, etc. for non-FrameWork windows, etc.
In general, all event handlers should return 1 if the event is fully In general, all event handlers should return \code{1} if the event is fully
handled and 0 otherwise (because the front window was not a FrameWork handled and \code{0} otherwise (because the front window was not a FrameWork
window, for instance). This is needed so that update events and such window, for instance). This is needed so that update events and such
can be passed on to other windows like the Sioux console window. can be passed on to other windows like the Sioux console window.
Calling \code{MacOS.HandleEvent} is not allowed within \var{our_dispatch} Calling \function{MacOS.HandleEvent()} is not allowed within
or its callees, since this may result in an infinite loop if the \var{our_dispatch} or its callees, since this may result in an
code is called through the Python inner-loop event handler. infinite loop if the code is called through the Python inner-loop
event handler.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{asyncevents}{onoff} \begin{funcdesc}{asyncevents}{onoff}
...@@ -142,7 +144,8 @@ The old on/off value is returned. ...@@ -142,7 +144,8 @@ The old on/off value is returned.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{_quit}{} \begin{funcdesc}{_quit}{}
Terminate the event \code{mainloop} at the next convenient moment. Terminate the running \method{mainloop()} call at the next convenient
moment.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{do_char}{c, event} \begin{funcdesc}{do_char}{c, event}
...@@ -165,6 +168,7 @@ null-event is passed (so you can look at mouse position, etc). ...@@ -165,6 +168,7 @@ null-event is passed (so you can look at mouse position, etc).
\end{funcdesc} \end{funcdesc}
\subsection{Window Objects} \subsection{Window Objects}
\label{window-objects}
Window objects have the following methods, among others: Window objects have the following methods, among others:
...@@ -202,6 +206,7 @@ The window was activated (\code{activate==1}) or deactivated ...@@ -202,6 +206,7 @@ The window was activated (\code{activate==1}) or deactivated
\end{funcdesc} \end{funcdesc}
\subsection{ControlsWindow Object} \subsection{ControlsWindow Object}
\label{controlswindow-object}
ControlsWindow objects have the following methods besides those of ControlsWindow objects have the following methods besides those of
\code{Window} objects: \code{Window} objects:
...@@ -214,40 +219,41 @@ user. Tracking and such has already been taken care of. ...@@ -214,40 +219,41 @@ user. Tracking and such has already been taken care of.
\end{funcdesc} \end{funcdesc}
\subsection{ScrolledWindow Object} \subsection{ScrolledWindow Object}
\label{scrolledwindow-object}
ScrolledWindow objects are ControlsWindow objects with the following ScrolledWindow objects are ControlsWindow objects with the following
extra methods: extra methods:
\setindexsubitem{(ScrolledWindow method)} \setindexsubitem{(ScrolledWindow method)}
\begin{funcdesc}{scrollbars}{\optional{wantx, wanty}} \begin{funcdesc}{scrollbars}{\optional{wantx\optional{, wanty}}}
Create (or destroy) horizontal and vertical scrollbars. The arguments Create (or destroy) horizontal and vertical scrollbars. The arguments
specify which you want (default: both). The scrollbars always have specify which you want (default: both). The scrollbars always have
minimum \code{0} and maximum \code{32767}. minimum \code{0} and maximum \code{32767}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{getscrollbarvalues}{} \begin{funcdesc}{getscrollbarvalues}{}
You must supply this method. It should return a tuple \code{x, y} You must supply this method. It should return a tuple \code{(\var{x},
giving the current position of the scrollbars (between \code{0} and \var{y})} giving the current position of the scrollbars (between
\code{32767}). You can return \code{None} for either to indicate the \code{0} and \code{32767}). You can return \code{None} for either to
whole document is visible in that direction. indicate the whole document is visible in that direction.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{updatescrollbars}{} \begin{funcdesc}{updatescrollbars}{}
Call this method when the document has changed. It will call Call this method when the document has changed. It will call
\code{getscrollbarvalues} and update the scrollbars. \method{getscrollbarvalues()} and update the scrollbars.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{scrollbar_callback}{which, what, value} \begin{funcdesc}{scrollbar_callback}{which, what, value}
Supplied by you and called after user interaction. \code{Which} will Supplied by you and called after user interaction. \var{which} will
be \code{'x'} or \code{'y'}, \code{what} will be \code{'-'}, be \code{'x'} or \code{'y'}, \var{what} will be \code{'-'},
\code{'--'}, \code{'set'}, \code{'++'} or \code{'+'}. For \code{'--'}, \code{'set'}, \code{'++'} or \code{'+'}. For
\code{'set'}, \code{value} will contain the new scrollbar position. \code{'set'}, \var{value} will contain the new scrollbar position.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{scalebarvalues}{absmin, absmax, curmin, curmax} \begin{funcdesc}{scalebarvalues}{absmin, absmax, curmin, curmax}
Auxiliary method to help you calculate values to return from Auxiliary method to help you calculate values to return from
\code{getscrollbarvalues}. You pass document minimum and maximum value \method{getscrollbarvalues()}. You pass document minimum and maximum value
and topmost (leftmost) and bottommost (rightmost) visible values and and topmost (leftmost) and bottommost (rightmost) visible values and
it returns the correct number or \code{None}. it returns the correct number or \code{None}.
\end{funcdesc} \end{funcdesc}
...@@ -270,6 +276,7 @@ and has been handled. ...@@ -270,6 +276,7 @@ and has been handled.
\end{funcdesc} \end{funcdesc}
\subsection{DialogWindow Objects} \subsection{DialogWindow Objects}
\label{dialogwindow-objects}
DialogWindow objects have the following methods besides those of DialogWindow objects have the following methods besides those of
\code{Window} objects: \code{Window} objects:
......
\section{Standard Module \sectcode{MiniAEFrame}} \section{Standard Module \module{MiniAEFrame}}
\stmodindex{MiniAEFrame} \stmodindex{MiniAEFrame}
\label{module-MiniAEFrame} \label{module-MiniAEFrame}
The module \var{MiniAEFrame} provides a framework for an application The module \module{MiniAEFrame} provides a framework for an application
that can function as an OSA server, i.e. receive and process that can function as an Open Scripting Architecture
AppleEvents. It can be used in conjunction with \var{FrameWork} or \index{Open Scripting Architecture}
standalone. (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 This module is temporary, it will eventually be replaced by a module
that handles argument names better and possibly automates making your that handles argument names better and possibly automates making your
application scriptable. application scriptable.
The \var{MiniAEFrame} module defines the following classes: The \module{MiniAEFrame} module defines the following classes:
\setindexsubitem{(in module MiniAEFrame)}
\begin{funcdesc}{AEServer}{} \begin{classdesc}{AEServer}{}
A class that handles AppleEvent dispatch. Your application should A class that handles AppleEvent dispatch. Your application should
subclass this class together with either subclass this class together with either
\code{MiniAEFrame.MiniApplication} or \class{MiniApplication} or
\code{FrameWork.Application}. Your \code{__init__} method should call \class{FrameWork.Application}. Your \method{__init__()} method should
the \code{__init__} method for both classes. call the \method{__init__()} method for both classes.
\end{funcdesc} \end{classdesc}
\begin{funcdesc}{MiniApplication}{} \begin{classdesc}{MiniApplication}{}
A class that is more or less compatible with A class that is more or less compatible with
\code{FrameWork.Application} but with less functionality. Its \class{FrameWork.Application} but with less functionality. Its
eventloop supports the apple menu, command-dot and AppleEvents, other event loop supports the apple menu, command-dot and AppleEvents; other
events are passed on to the Python interpreter and/or Sioux. events are passed on to the Python interpreter and/or Sioux.
Useful if your application wants to use \code{AEServer} but does not Useful if your application wants to use \class{AEServer} but does not
provide its own windows, etc. provide its own windows, etc.
\end{funcdesc} \end{classdesc}
\subsection{AEServer Objects}
\setindexsubitem{(AEServer method)} \subsection{AEServer Objects}
\label{aeserver-objects}
\begin{funcdesc}{installaehandler}{classe, type, callback} \begin{methoddesc}[AEServer]{installaehandler}{classe, type, callback}
Installs an AppleEvent handler. \code{Classe} and \code{type} are the Installs an AppleEvent handler. \var{classe} and \var{type} are the
four-char OSA Class and Type designators, \code{'****'} wildcards are four-character OSA Class and Type designators, \code{'****'} wildcards
allowed. When a matching AppleEvent is received the parameters are are allowed. When a matching AppleEvent is received the parameters are
decoded and your callback is invoked. decoded and your callback is invoked.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{callback}{_object, **kwargs} \begin{methoddesc}[AEServer]{callback}{_object, **kwargs}
Your callback is called with the OSA Direct Object as first positional Your callback is called with the OSA Direct Object as first positional
parameter. The other parameters are passed as keyword arguments, with parameter. The other parameters are passed as keyword arguments, with
the 4-char designator as name. Three extra keyword parameters are the 4-character designator as name. Three extra keyword parameters are
passed: \code{_class} and \code{_type} are the Class and Type passed: \code{_class} and \code{_type} are the Class and Type
designators and \code{_attributes} is a dictionary with the AppleEvent designators and \code{_attributes} is a dictionary with the AppleEvent
attributes. attributes.
The return value of your method is packed with The return value of your method is packed with
\code{aetools.packevent} and sent as reply. \function{aetools.packevent()} and sent as reply.
\end{funcdesc} \end{methoddesc}
Note that there are some serious problems with the current Note that there are some serious problems with the current
design. AppleEvents which have non-identifier 4-char designators for design. AppleEvents which have non-identifier 4-character designators
arguments are not implementable, and it is not possible to return an for arguments are not implementable, and it is not possible to return
error to the originator. This will be addressed in a future release. an error to the originator. This will be addressed in a future
release.
\section{Built-in Module \sectcode{ctb}} \section{Built-in Module \sectcode{ctb}}
\label{module-ctb} \label{module-ctb}
\bimodindex{ctb} \bimodindex{ctb}
\setindexsubitem{(in module ctb)}
This module provides a partial interface to the Macintosh This module provides a partial interface to the Macintosh
Communications Toolbox. Currently, only Connection Manager tools are Communications Toolbox. Currently, only Connection Manager tools are
supported. It may not be available in all Mac Python versions. supported. It may not be available in all Mac Python versions.
\index{Communications Toolbox, Macintosh}
\index{Macintosh Communications Toolbox}
\index{Connection Manager}
\begin{datadesc}{error} \begin{datadesc}{error}
The exception raised on errors. The exception raised on errors.
...@@ -14,40 +16,41 @@ The exception raised on errors. ...@@ -14,40 +16,41 @@ The exception raised on errors.
\begin{datadesc}{cmData} \begin{datadesc}{cmData}
\dataline{cmCntl} \dataline{cmCntl}
\dataline{cmAttn} \dataline{cmAttn}
Flags for the \var{channel} argument of the \var{Read} and \var{Write} Flags for the \var{channel} argument of the \method{Read()} and
methods. \method{Write()} methods.
\end{datadesc} \end{datadesc}
\begin{datadesc}{cmFlagsEOM} \begin{datadesc}{cmFlagsEOM}
End-of-message flag for \var{Read} and \var{Write}. End-of-message flag for \method{Read()} and \method{Write()}.
\end{datadesc} \end{datadesc}
\begin{datadesc}{choose*} \begin{datadesc}{choose*}
Values returned by \var{Choose}. Values returned by \method{Choose()}.
\end{datadesc} \end{datadesc}
\begin{datadesc}{cmStatus*} \begin{datadesc}{cmStatus*}
Bits in the status as returned by \var{Status}. Bits in the status as returned by \method{Status()}.
\end{datadesc} \end{datadesc}
\begin{funcdesc}{available}{} \begin{funcdesc}{available}{}
Return 1 if the communication toolbox is available, zero otherwise. Return \code{1} if the Communication Toolbox is available, zero otherwise.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{CMNew}{name, sizes} \begin{funcdesc}{CMNew}{name, sizes}
Create a connection object using the connection tool named Create a connection object using the connection tool named
\var{name}. \var{sizes} is a 6-tuple given buffer sizes for data in, \var{name}. \var{sizes} is a 6-tuple given buffer sizes for data in,
data out, control in, control out, attention in and attention out. data out, control in, control out, attention in and attention out.
Alternatively, passing \code{None} will result in default buffer sizes. Alternatively, passing \code{None} for \var{sizes} will result in
default buffer sizes.
\end{funcdesc} \end{funcdesc}
\subsection{connection object} \subsection{connection object}
\label{connection-object}
For all connection methods that take a \var{timeout} argument, a value For all connection methods that take a \var{timeout} argument, a value
of \code{-1} is indefinite, meaning that the command runs to completion. of \code{-1} is indefinite, meaning that the command runs to completion.
\setindexsubitem{(connection object attribute)} \begin{memberdesc}[connection]{callback}
\begin{datadesc}{callback}
If this member is set to a value other than \code{None} it should point If this member is set to a value other than \code{None} it should point
to a function accepting a single argument (the connection to a function accepting a single argument (the connection
object). This will make all connection object methods work object). This will make all connection object methods work
...@@ -57,94 +60,92 @@ completion. ...@@ -57,94 +60,92 @@ completion.
\emph{Note:} for reasons beyond my understanding the callback routine \emph{Note:} for reasons beyond my understanding the callback routine
is currently never called. You are advised against using asynchronous is currently never called. You are advised against using asynchronous
calls for the time being. calls for the time being.
\end{datadesc} \end{memberdesc}
\setindexsubitem{(connection object method)} \begin{methoddesc}[connection]{Open}{timeout}
\begin{funcdesc}{Open}{timeout}
Open an outgoing connection, waiting at most \var{timeout} seconds for Open an outgoing connection, waiting at most \var{timeout} seconds for
the connection to be established. the connection to be established.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Listen}{timeout} \begin{methoddesc}[connection]{Listen}{timeout}
Wait for an incoming connection. Stop waiting after \var{timeout} Wait for an incoming connection. Stop waiting after \var{timeout}
seconds. This call is only meaningful to some tools. seconds. This call is only meaningful to some tools.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{accept}{yesno} \begin{methoddesc}[connection]{accept}{yesno}
Accept (when \var{yesno} is non-zero) or reject an incoming call after Accept (when \var{yesno} is non-zero) or reject an incoming call after
\var{Listen} returned. \method{Listen()} returned.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Close}{timeout, now} \begin{methoddesc}[connection]{Close}{timeout, now}
Close a connection. When \var{now} is zero, the close is orderly Close a connection. When \var{now} is zero, the close is orderly
(i.e.\ outstanding output is flushed, etc.)\ with a timeout of (i.e.\ outstanding output is flushed, etc.)\ with a timeout of
\var{timeout} seconds. When \var{now} is non-zero the close is \var{timeout} seconds. When \var{now} is non-zero the close is
immediate, discarding output. immediate, discarding output.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Read}{len, chan, timeout} \begin{methoddesc}[connection]{Read}{len, chan, timeout}
Read \var{len} bytes, or until \var{timeout} seconds have passed, from Read \var{len} bytes, or until \var{timeout} seconds have passed, from
the channel \var{chan} (which is one of \var{cmData}, \var{cmCntl} or the channel \var{chan} (which is one of \constant{cmData},
\var{cmAttn}). Return a 2-tuple:\ the data read and the end-of-message \constant{cmCntl} or \constant{cmAttn}). Return a 2-tuple:\ the data
flag. read and the end-of-message flag, \constant{cmFlagsEOM}.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Write}{buf, chan, timeout, eom} \begin{methoddesc}[connection]{Write}{buf, chan, timeout, eom}
Write \var{buf} to channel \var{chan}, aborting after \var{timeout} Write \var{buf} to channel \var{chan}, aborting after \var{timeout}
seconds. When \var{eom} has the value \var{cmFlagsEOM} an seconds. When \var{eom} has the value \constant{cmFlagsEOM}, an
end-of-message indicator will be written after the data (if this end-of-message indicator will be written after the data (if this
concept has a meaning for this communication tool). The method returns concept has a meaning for this communication tool). The method returns
the number of bytes written. the number of bytes written.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Status}{} \begin{methoddesc}[connection]{Status}{}
Return connection status as the 2-tuple \code{(\var{sizes}, Return connection status as the 2-tuple \code{(\var{sizes},
\var{flags})}. \var{sizes} is a 6-tuple giving the actual buffer sizes used \var{flags})}. \var{sizes} is a 6-tuple giving the actual buffer sizes used
(see \var{CMNew}), \var{flags} is a set of bits describing the state (see \function{CMNew()}), \var{flags} is a set of bits describing the state
of the connection. of the connection.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{GetConfig}{} \begin{methoddesc}[connection]{GetConfig}{}
Return the configuration string of the communication tool. These Return the configuration string of the communication tool. These
configuration strings are tool-dependent, but usually easily parsed configuration strings are tool-dependent, but usually easily parsed
and modified. and modified.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{SetConfig}{str} \begin{methoddesc}[connection]{SetConfig}{str}
Set the configuration string for the tool. The strings are parsed Set the configuration string for the tool. The strings are parsed
left-to-right, with later values taking precedence. This means left-to-right, with later values taking precedence. This means
individual configuration parameters can be modified by simply appending individual configuration parameters can be modified by simply appending
something like \code{'baud 4800'} to the end of the string returned by something like \code{'baud 4800'} to the end of the string returned by
\var{GetConfig} and passing that to this method. The method returns \method{GetConfig()} and passing that to this method. The method returns
the number of characters actually parsed by the tool before it the number of characters actually parsed by the tool before it
encountered an error (or completed successfully). encountered an error (or completed successfully).
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Choose}{} \begin{methoddesc}[connection]{Choose}{}
Present the user with a dialog to choose a communication tool and Present the user with a dialog to choose a communication tool and
configure it. If there is an outstanding connection some choices (like configure it. If there is an outstanding connection some choices (like
selecting a different tool) may cause the connection to be selecting a different tool) may cause the connection to be
aborted. The return value (one of the \var{choose*} constants) will aborted. The return value (one of the \constant{choose*} constants) will
indicate this. indicate this.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Idle}{} \begin{methoddesc}[connection]{Idle}{}
Give the tool a chance to use the processor. You should call this Give the tool a chance to use the processor. You should call this
method regularly. method regularly.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Abort}{} \begin{methoddesc}[connection]{Abort}{}
Abort an outstanding asynchronous \var{Open} or \var{Listen}. Abort an outstanding asynchronous \method{Open()} or \method{Listen()}.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Reset}{} \begin{methoddesc}[connection]{Reset}{}
Reset a connection. Exact meaning depends on the tool. Reset a connection. Exact meaning depends on the tool.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Break}{length} \begin{methoddesc}[connection]{Break}{length}
Send a break. Whether this means anything, what it means and Send a break. Whether this means anything, what it means and
interpretation of the \var{length} parameter depend on the tool in interpretation of the \var{length} parameter depends on the tool in
use. use.
\end{funcdesc} \end{methoddesc}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
\stmodindex{FrameWork} \stmodindex{FrameWork}
\label{module-FrameWork} \label{module-FrameWork}
The \code{FrameWork} module contains classes that together provide a The \module{FrameWork} module contains classes that together provide a
framework for an interactive Macintosh application. The programmer framework for an interactive Macintosh application. The programmer
builds an application by creating subclasses that override various builds an application by creating subclasses that override various
methods of the bases classes, thereby implementing the functionality methods of the bases classes, thereby implementing the functionality
...@@ -11,18 +11,17 @@ different levels, i.e. to handle clicks in a single dialog window in a ...@@ -11,18 +11,17 @@ different levels, i.e. to handle clicks in a single dialog window in a
non-standard way it is not necessary to override the complete event non-standard way it is not necessary to override the complete event
handling. handling.
The \code{FrameWork} is still very much work-in-progress, and the The \module{FrameWork} is still very much work-in-progress, and the
documentation describes only the most important functionality, and not documentation describes only the most important functionality, and not
in the most logical manner at that. Examine the source or the examples in the most logical manner at that. Examine the source or the examples
for more details. for more details.
The \code{FrameWork} module defines the following functions: The \module{FrameWork} module defines the following functions:
\setindexsubitem{(in module FrameWork)}
\begin{funcdesc}{Application}{} \begin{funcdesc}{Application}{}
An object representing the complete application. See below for a An object representing the complete application. See below for a
description of the methods. The default \code{__init__} routine description of the methods. The default \method{__init__()} routine
creates an empty window dictionary and a menu bar with an apple menu. creates an empty window dictionary and a menu bar with an apple menu.
\end{funcdesc} \end{funcdesc}
...@@ -88,23 +87,25 @@ Set the mouse cursor to a watch. ...@@ -88,23 +87,25 @@ Set the mouse cursor to a watch.
Set the mouse cursor to an arrow. Set the mouse cursor to an arrow.
\end{funcdesc} \end{funcdesc}
\subsection{Application objects} \subsection{Application Objects}
\label{application-objects}
Application objects have the following methods, among others: Application objects have the following methods, among others:
\setindexsubitem{(Application method)} \setindexsubitem{(Application method)}
\begin{funcdesc}{makeusermenus}{} \begin{funcdesc}{makeusermenus}{}
Override this method if you need menus in your application. Append the Override this method if you need menus in your application. Append the
menus to \code{self.menubar}. menus to the attribute \member{menubar}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{getabouttext}{} \begin{funcdesc}{getabouttext}{}
Override this method to return a text string describing your Override this method to return a text string describing your
application. Alternatively, override the \code{do_about} method for application. Alternatively, override the \method{do_about()} method
more elaborate about messages. for more elaborate ``about'' messages.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{mainloop}{\optional{mask, wait}} \begin{funcdesc}{mainloop}{\optional{mask\optional{, wait}}}
This routine is the main event loop, call it to set your application This routine is the main event loop, call it to set your application
rolling. \var{Mask} is the mask of events you want to handle, rolling. \var{Mask} is the mask of events you want to handle,
\var{wait} is the number of ticks you want to leave to other \var{wait} is the number of ticks you want to leave to other
...@@ -117,13 +118,14 @@ overridden. The default methods take care of dispatching events to ...@@ -117,13 +118,14 @@ overridden. The default methods take care of dispatching events to
windows and dialogs, handling drags and resizes, Apple Events, events windows and dialogs, handling drags and resizes, Apple Events, events
for non-FrameWork windows, etc. for non-FrameWork windows, etc.
In general, all event handlers should return 1 if the event is fully In general, all event handlers should return \code{1} if the event is fully
handled and 0 otherwise (because the front window was not a FrameWork handled and \code{0} otherwise (because the front window was not a FrameWork
window, for instance). This is needed so that update events and such window, for instance). This is needed so that update events and such
can be passed on to other windows like the Sioux console window. can be passed on to other windows like the Sioux console window.
Calling \code{MacOS.HandleEvent} is not allowed within \var{our_dispatch} Calling \function{MacOS.HandleEvent()} is not allowed within
or its callees, since this may result in an infinite loop if the \var{our_dispatch} or its callees, since this may result in an
code is called through the Python inner-loop event handler. infinite loop if the code is called through the Python inner-loop
event handler.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{asyncevents}{onoff} \begin{funcdesc}{asyncevents}{onoff}
...@@ -142,7 +144,8 @@ The old on/off value is returned. ...@@ -142,7 +144,8 @@ The old on/off value is returned.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{_quit}{} \begin{funcdesc}{_quit}{}
Terminate the event \code{mainloop} at the next convenient moment. Terminate the running \method{mainloop()} call at the next convenient
moment.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{do_char}{c, event} \begin{funcdesc}{do_char}{c, event}
...@@ -165,6 +168,7 @@ null-event is passed (so you can look at mouse position, etc). ...@@ -165,6 +168,7 @@ null-event is passed (so you can look at mouse position, etc).
\end{funcdesc} \end{funcdesc}
\subsection{Window Objects} \subsection{Window Objects}
\label{window-objects}
Window objects have the following methods, among others: Window objects have the following methods, among others:
...@@ -202,6 +206,7 @@ The window was activated (\code{activate==1}) or deactivated ...@@ -202,6 +206,7 @@ The window was activated (\code{activate==1}) or deactivated
\end{funcdesc} \end{funcdesc}
\subsection{ControlsWindow Object} \subsection{ControlsWindow Object}
\label{controlswindow-object}
ControlsWindow objects have the following methods besides those of ControlsWindow objects have the following methods besides those of
\code{Window} objects: \code{Window} objects:
...@@ -214,40 +219,41 @@ user. Tracking and such has already been taken care of. ...@@ -214,40 +219,41 @@ user. Tracking and such has already been taken care of.
\end{funcdesc} \end{funcdesc}
\subsection{ScrolledWindow Object} \subsection{ScrolledWindow Object}
\label{scrolledwindow-object}
ScrolledWindow objects are ControlsWindow objects with the following ScrolledWindow objects are ControlsWindow objects with the following
extra methods: extra methods:
\setindexsubitem{(ScrolledWindow method)} \setindexsubitem{(ScrolledWindow method)}
\begin{funcdesc}{scrollbars}{\optional{wantx, wanty}} \begin{funcdesc}{scrollbars}{\optional{wantx\optional{, wanty}}}
Create (or destroy) horizontal and vertical scrollbars. The arguments Create (or destroy) horizontal and vertical scrollbars. The arguments
specify which you want (default: both). The scrollbars always have specify which you want (default: both). The scrollbars always have
minimum \code{0} and maximum \code{32767}. minimum \code{0} and maximum \code{32767}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{getscrollbarvalues}{} \begin{funcdesc}{getscrollbarvalues}{}
You must supply this method. It should return a tuple \code{x, y} You must supply this method. It should return a tuple \code{(\var{x},
giving the current position of the scrollbars (between \code{0} and \var{y})} giving the current position of the scrollbars (between
\code{32767}). You can return \code{None} for either to indicate the \code{0} and \code{32767}). You can return \code{None} for either to
whole document is visible in that direction. indicate the whole document is visible in that direction.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{updatescrollbars}{} \begin{funcdesc}{updatescrollbars}{}
Call this method when the document has changed. It will call Call this method when the document has changed. It will call
\code{getscrollbarvalues} and update the scrollbars. \method{getscrollbarvalues()} and update the scrollbars.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{scrollbar_callback}{which, what, value} \begin{funcdesc}{scrollbar_callback}{which, what, value}
Supplied by you and called after user interaction. \code{Which} will Supplied by you and called after user interaction. \var{which} will
be \code{'x'} or \code{'y'}, \code{what} will be \code{'-'}, be \code{'x'} or \code{'y'}, \var{what} will be \code{'-'},
\code{'--'}, \code{'set'}, \code{'++'} or \code{'+'}. For \code{'--'}, \code{'set'}, \code{'++'} or \code{'+'}. For
\code{'set'}, \code{value} will contain the new scrollbar position. \code{'set'}, \var{value} will contain the new scrollbar position.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{scalebarvalues}{absmin, absmax, curmin, curmax} \begin{funcdesc}{scalebarvalues}{absmin, absmax, curmin, curmax}
Auxiliary method to help you calculate values to return from Auxiliary method to help you calculate values to return from
\code{getscrollbarvalues}. You pass document minimum and maximum value \method{getscrollbarvalues()}. You pass document minimum and maximum value
and topmost (leftmost) and bottommost (rightmost) visible values and and topmost (leftmost) and bottommost (rightmost) visible values and
it returns the correct number or \code{None}. it returns the correct number or \code{None}.
\end{funcdesc} \end{funcdesc}
...@@ -270,6 +276,7 @@ and has been handled. ...@@ -270,6 +276,7 @@ and has been handled.
\end{funcdesc} \end{funcdesc}
\subsection{DialogWindow Objects} \subsection{DialogWindow Objects}
\label{dialogwindow-objects}
DialogWindow objects have the following methods besides those of DialogWindow objects have the following methods besides those of
\code{Window} objects: \code{Window} objects:
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
\label{module-macconsole} \label{module-macconsole}
\bimodindex{macconsole} \bimodindex{macconsole}
\setindexsubitem{(in module macconsole)}
This module is available on the Macintosh, provided Python has been This module is available on the Macintosh, provided Python has been
built using the Think \C{} compiler. It provides an interface to the built using the Think \C{} compiler. It provides an interface to the
......
...@@ -4,8 +4,10 @@ ...@@ -4,8 +4,10 @@
This module provides an interface to the Macintosh Domain Name This module provides an interface to the Macintosh Domain Name
Resolver. It is usually used in conjunction with the \module{mactcp} Resolver. It is usually used in conjunction with the \module{mactcp}
module, to map hostnames to IP-addresses. It may not be available in module, to map hostnames to IP addresses. It may not be available in
all Mac Python versions. all Mac Python versions.
\index{Macintosh Domain Name Resolver}
\index{Domain Name Resolver, Macintosh}
The \module{macdnr} module defines the following functions: The \module{macdnr} module defines the following functions:
...@@ -46,11 +48,12 @@ variety. ...@@ -46,11 +48,12 @@ variety.
\begin{funcdesc}{MXInfo}{domain} \begin{funcdesc}{MXInfo}{domain}
Query the nameservers for a mail exchanger for \var{domain}. This is Query the nameservers for a mail exchanger for \var{domain}. This is
the hostname of a host willing to accept SMTP mail for the given the hostname of a host willing to accept SMTP\index{SMTP} mail for the
domain. Returns a dnr result object of the ``mx'' variety. given domain. Returns a dnr result object of the ``mx'' variety.
\end{funcdesc} \end{funcdesc}
\subsection{dnr result object} \subsection{dnr result object}
\label{dnr-result-object}
Since the DNR calls all execute asynchronously you do not get the Since the DNR calls all execute asynchronously you do not get the
results back immediately. Instead, you get a dnr result object. You results back immediately. Instead, you get a dnr result object. You
...@@ -64,50 +67,48 @@ The \member{rtnCode} and \member{cname} attributes are always ...@@ -64,50 +67,48 @@ The \member{rtnCode} and \member{cname} attributes are always
available, the others depend on the type of query (address, hinfo or available, the others depend on the type of query (address, hinfo or
mx). mx).
\setindexsubitem{(dnr result method)}
% Add args, as in {arg1, arg2 \optional{, arg3}} % Add args, as in {arg1, arg2 \optional{, arg3}}
\begin{funcdesc}{wait}{} \begin{methoddesc}[dnr result]{wait}{}
Wait for the query to complete. Wait for the query to complete.
\end{funcdesc} \end{methoddesc}
% Add args, as in {arg1, arg2 \optional{, arg3}} % Add args, as in {arg1, arg2 \optional{, arg3}}
\begin{funcdesc}{isdone}{} \begin{methoddesc}[dnr result]{isdone}{}
Return \code{1} if the query is complete. Return \code{1} if the query is complete.
\end{funcdesc} \end{methoddesc}
\setindexsubitem{(dnr result attribute)}
\begin{datadesc}{rtnCode} \begin{memberdesc}[dnr result]{rtnCode}
The error code returned by the query. The error code returned by the query.
\end{datadesc} \end{memberdesc}
\begin{datadesc}{cname} \begin{memberdesc}[dnr result]{cname}
The canonical name of the host that was queried. The canonical name of the host that was queried.
\end{datadesc} \end{memberdesc}
\begin{datadesc}{ip0} \begin{memberdesc}[dnr result]{ip0}
\dataline{ip1} \memberline[dnr result]{ip1}
\dataline{ip2} \memberline[dnr result]{ip2}
\dataline{ip3} \memberline[dnr result]{ip3}
At most four integer IP addresses for this host. Unused entries are At most four integer IP addresses for this host. Unused entries are
zero. Valid only for address queries. zero. Valid only for address queries.
\end{datadesc} \end{memberdesc}
\begin{datadesc}{cpuType} \begin{memberdesc}[dnr result]{cpuType}
\dataline{osType} \memberline[dnr result]{osType}
Textual strings giving the machine type an OS name. Valid for ``hinfo'' Textual strings giving the machine type an OS name. Valid for ``hinfo''
queries. queries.
\end{datadesc} \end{memberdesc}
\begin{datadesc}{exchange} \begin{memberdesc}[dnr result]{exchange}
The name of a mail-exchanger host. Valid for ``mx'' queries. The name of a mail-exchanger host. Valid for ``mx'' queries.
\end{datadesc} \end{memberdesc}
\begin{datadesc}{preference} \begin{memberdesc}[dnr result]{preference}
The preference of this mx record. Not too useful, since the Macintosh The preference of this mx record. Not too useful, since the Macintosh
will only return a single mx record. Valid for ``mx'' queries only. will only return a single mx record. Valid for ``mx'' queries only.
\end{datadesc} \end{memberdesc}
The simplest way to use the module to convert names to dotted-decimal The simplest way to use the module to convert names to dotted-decimal
strings, without worrying about idle time, etc: strings, without worrying about idle time, etc:
......
This diff is collapsed.
...@@ -30,7 +30,7 @@ Exception raised on errors in the \module{ic} module. ...@@ -30,7 +30,7 @@ Exception raised on errors in the \module{ic} module.
The \module{ic} module defines the following functions: The \module{ic} module defines the following functions:
\begin{funcdesc}{IC}{\optional{signature\optional{, ic}}} \begin{funcdesc}{IC}{\optional{signature\optional{, ic}}}
Create an internet config object. The signature is a 4-char creator Create an internet config object. The signature is a 4-character creator
code of the current application (default \code{'Pyth'}) which may code of the current application (default \code{'Pyth'}) which may
influence some of ICs settings. The optional \var{ic} argument is a influence some of ICs settings. The optional \var{ic} argument is a
low-level \code{icglue.icinstance} created beforehand, this may be low-level \code{icglue.icinstance} created beforehand, this may be
...@@ -62,7 +62,7 @@ documentation. ...@@ -62,7 +62,7 @@ documentation.
If the module does not know how to represent the data it returns an If the module does not know how to represent the data it returns an
instance of the \code{ICOpaqueData} type, with the raw data in its instance of the \code{ICOpaqueData} type, with the raw data in its
\var{data} attribute. Objects of this type are also acceptable values \member{data} attribute. Objects of this type are also acceptable values
for assignment. for assignment.
Besides the dictionary interface IC objects have the following methods: Besides the dictionary interface IC objects have the following methods:
...@@ -82,21 +82,22 @@ position and the URL. The optional \var{start} and \var{end} can be ...@@ -82,21 +82,22 @@ position and the URL. The optional \var{start} and \var{end} can be
used to limit the search, so for instance if a user clicks in a long used to limit the search, so for instance if a user clicks in a long
textfield you can pass the whole textfield and the click-position in textfield you can pass the whole textfield and the click-position in
\var{start} and this routine will return the whole URL in which the \var{start} and this routine will return the whole URL in which the
user clicked. \var{Hint} is again an optional scheme used to complete user clicked. As above, \var{hint} is an optional scheme used to
incomplete URLs. complete incomplete URLs.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{mapfile}{file} \begin{funcdesc}{mapfile}{file}
Return the mapping entry for the given \var{file}, which can be passed Return the mapping entry for the given \var{file}, which can be passed
as either a filename or an \code{macfs.FSSpec} object, and which need as either a filename or an \function{macfs.FSSpec()} result, and which
not exist. need not exist.
The mapping entry is returned as a tuple \code{(}\var{version}, The mapping entry is returned as a tuple \code{(}\var{version},
\var{type}, \var{creator}, \var{postcreator}, \var{flags}, \var{type}, \var{creator}, \var{postcreator}, \var{flags},
\var{extension}, \var{appname}, \var{postappname}, \var{mimetype}, \var{extension}, \var{appname}, \var{postappname}, \var{mimetype},
\var{entryname}\code{)}, where \var{version} is the entry version \var{entryname}\code{)}, where \var{version} is the entry version
number, \var{type} is the 4-char filetype, \var{creator} is the 4-char number, \var{type} is the 4-character filetype, \var{creator} is the
creator type, \var{postcreator} is the 4-char creator code of an 4-character creator type, \var{postcreator} is the 4-character creator
code of an
optional application to post-process the file after downloading, optional application to post-process the file after downloading,
\var{flags} are various bits specifying whether to transfer in binary \var{flags} are various bits specifying whether to transfer in binary
or ascii and such, \var{extension} is the filename extension for this or ascii and such, \var{extension} is the filename extension for this
...@@ -107,7 +108,7 @@ file and \var{entryname} is the name of this entry. ...@@ -107,7 +108,7 @@ file and \var{entryname} is the name of this entry.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{maptypecreator}{type, creator\optional{, filename}} \begin{funcdesc}{maptypecreator}{type, creator\optional{, filename}}
Return the mapping entry for files with given 4-char \var{type} and Return the mapping entry for files with given 4-character \var{type} and
\var{creator} codes. The optional \var{filename} may be specified to \var{creator} codes. The optional \var{filename} may be specified to
further help finding the correct entry (if the creator code is further help finding the correct entry (if the creator code is
\code{'????'}, for instance). \code{'????'}, for instance).
...@@ -117,7 +118,7 @@ The mapping entry is returned in the same format as for \var{mapfile}. ...@@ -117,7 +118,7 @@ The mapping entry is returned in the same format as for \var{mapfile}.
\begin{funcdesc}{settypecreator}{file} \begin{funcdesc}{settypecreator}{file}
Given an existing \var{file}, specified either as a filename or as an Given an existing \var{file}, specified either as a filename or as an
\code{macfs.FSSpec} record, set its creator and type correctly based \function{macfs.FSSpec()} result, set its creator and type correctly based
on its extension. The finder is told about the change, so the finder on its extension. The finder is told about the change, so the finder
icon will be updated quickly. icon will be updated quickly.
\end{funcdesc} \end{funcdesc}
\section{Built-in Module \sectcode{macspeech}} \section{Built-in Module \module{macspeech}}
\label{module-macspeech} \label{module-macspeech}
\bimodindex{macspeech} \bimodindex{macspeech}
\setindexsubitem{(in module macspeech)}
This module provides an interface to the Macintosh Speech Manager, This module provides an interface to the Macintosh Speech Manager,
\index{Macintosh Speech Manager}
\index{Speech Manager, Macintosh}
allowing you to let the Macintosh utter phrases. You need a version of allowing you to let the Macintosh utter phrases. You need a version of
the speech manager extension (version 1 and 2 have been tested) in the Speech Manager extension (version 1 and 2 have been tested) in
your \code{Extensions} folder for this to work. The module does not your \file{Extensions} folder for this to work. The module does not
provide full access to all features of the Speech Manager yet. It may provide full access to all features of the Speech Manager yet. It may
not be available in all Mac Python versions. not be available in all Mac Python versions.
\begin{funcdesc}{Available}{} \begin{funcdesc}{Available}{}
Test availability of the Speech Manager extension (and, on the Test availability of the Speech Manager extension (and, on the
PowerPC, the Speech Manager shared library). Return 0 or 1. PowerPC, the Speech Manager shared library). Return \code{0} or
\code{1}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{Version}{} \begin{funcdesc}{Version}{}
...@@ -23,7 +25,7 @@ Return the (integer) version number of the Speech Manager. ...@@ -23,7 +25,7 @@ Return the (integer) version number of the Speech Manager.
\begin{funcdesc}{SpeakString}{str} \begin{funcdesc}{SpeakString}{str}
Utter the string \var{str} using the default voice, Utter the string \var{str} using the default voice,
asynchronously. This aborts any speech that may still be active from asynchronously. This aborts any speech that may still be active from
prior \code{SpeakString} invocations. prior \function{SpeakString()} invocations.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{Busy}{} \begin{funcdesc}{Busy}{}
...@@ -35,53 +37,57 @@ Return the number of different voices available. ...@@ -35,53 +37,57 @@ Return the number of different voices available.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{GetIndVoice}{num} \begin{funcdesc}{GetIndVoice}{num}
Return a voice object for voice number \var{num}. Return a \pytype{Voice} object for voice number \var{num}.
\end{funcdesc} \end{funcdesc}
\subsection{voice objects} \subsection{Voice Objects}
\label{voice-objects}
Voice objects contain the description of a voice. It is currently not Voice objects contain the description of a voice. It is currently not
yet possible to access the parameters of a voice. yet possible to access the parameters of a voice.
\setindexsubitem{(voice object method)} \setindexsubitem{(voice object method)}
\begin{funcdesc}{GetGender}{} \begin{methoddesc}[Voice]{GetGender}{}
Return the gender of the voice: 0 for male, 1 for female and -1 for neuter. Return the gender of the voice: \code{0} for male, \code{1} for female
\end{funcdesc} and \code{-1} for neuter.
\end{methoddesc}
\begin{funcdesc}{NewChannel}{} \begin{methoddesc}[Voice]{NewChannel}{}
Return a new speech channel object using this voice. Return a new Speech Channel object using this voice.
\end{funcdesc} \end{methoddesc}
\subsection{speech channel objects} \subsection{Speech Channel Objects}
A speech channel object allows you to speak strings with slightly more \label{speech-channel-objects}
control than \code{SpeakString()}, and allows you to use multiple
A Speech Channel object allows you to speak strings with slightly more
control than \function{SpeakString()}, and allows you to use multiple
speakers at the same time. Please note that channel pitch and rate are speakers at the same time. Please note that channel pitch and rate are
interrelated in some way, so that to make your Macintosh sing you will interrelated in some way, so that to make your Macintosh sing you will
have to adjust both. have to adjust both.
\setindexsubitem{(speech channel object method)} \begin{methoddesc}[Speech Channel]{SpeakText}{str}
\begin{funcdesc}{SpeakText}{str}
Start uttering the given string. Start uttering the given string.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Stop}{} \begin{methoddesc}[Speech Channel]{Stop}{}
Stop babbling. Stop babbling.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{GetPitch}{} \begin{methoddesc}[Speech Channel]{GetPitch}{}
Return the current pitch of the channel, as a floating-point number. Return the current pitch of the channel, as a floating-point number.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{SetPitch}{pitch} \begin{methoddesc}[Speech Channel]{SetPitch}{pitch}
Set the pitch of the channel. Set the pitch of the channel.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{GetRate}{} \begin{methoddesc}[Speech Channel]{GetRate}{}
Get the speech rate (utterances per minute) of the channel as a Get the speech rate (utterances per minute) of the channel as a
floating point number. floating point number.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{SetRate}{rate} \begin{methoddesc}[Speech Channel]{SetRate}{rate}
Set the speech rate of the channel. Set the speech rate of the channel.
\end{funcdesc} \end{methoddesc}
\section{Standard Module \sectcode{EasyDialogs}} \section{Standard Module \module{EasyDialogs}}
\label{module-EasyDialogs} \label{module-EasyDialogs}
\stmodindex{EasyDialogs} \stmodindex{EasyDialogs}
The \code{EasyDialogs} module contains some simple dialogs for The \module{EasyDialogs} module contains some simple dialogs for
the Macintosh, modelled after the \code{stdwin} dialogs with similar the Macintosh, modelled after the \module{stdwin} dialogs with similar
names. All routines have an optional parameter \var{id} with which you names. All routines have an optional parameter \var{id} with which you
can override the DLOG resource used for the dialog, as long as the can override the DLOG resource used for the dialog, as long as the
item numbers correspond. See the source for details. item numbers correspond. See the source for details.
The \module{EasyDialogs} module defines the following functions:
The \code{EasyDialogs} module defines the following functions:
\setindexsubitem{(in module EasyDialogs)}
\begin{funcdesc}{Message}{str} \begin{funcdesc}{Message}{str}
A modal dialog with the message text \var{str}, which should be at A modal dialog with the message text \var{str}, which should be at
...@@ -19,11 +18,11 @@ user clicks ``OK''. ...@@ -19,11 +18,11 @@ user clicks ``OK''.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{AskString}{prompt\optional{, default}} \begin{funcdesc}{AskString}{prompt\optional{, default}}
Ask the user to input a string value, in a modal dialog. \var{Prompt} Ask the user to input a string value, in a modal dialog. \var{prompt}
is the promt message, the optional \var{default} arg is the initial is the promt message, the optional \var{default} arg is the initial
value for the string. All strings can be at most 255 bytes value for the string. All strings can be at most 255 bytes
long. \var{AskString} returns the string entered or \code{None} in long. \function{AskString()} returns the string entered or \code{None}
case the user cancelled. in case the user cancelled.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{AskYesNoCancel}{question\optional{, default}} \begin{funcdesc}{AskYesNoCancel}{question\optional{, default}}
...@@ -34,19 +33,19 @@ hitting return is \code{0}. This can be changed with the optional ...@@ -34,19 +33,19 @@ hitting return is \code{0}. This can be changed with the optional
\var{default} argument. \var{default} argument.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{ProgressBar}{\optional{label, maxval}} \begin{funcdesc}{ProgressBar}{\optional{label\optional{, maxval}}}
Display a modeless progress dialog with a thermometer bar. \var{Label} Display a modeless progress dialog with a thermometer bar. \var{label}
is the textstring displayed (default ``Working...''), \var{maxval} is is the text string displayed (default ``Working...''), \var{maxval} is
the value at which progress is complete (default 100). The returned the value at which progress is complete (default \code{100}). The
object has one method, \code{set(value)}, which sets the value of the returned object has one method, \code{set(\var{value})}, which sets
progress bar. The bar remains visible until the object returned is the value of the progress bar. The bar remains visible until the
discarded. object returned is discarded.
The progress bar has a ``cancel'' button, but it is currently The progress bar has a ``cancel'' button, but it is currently
non-functional. non-functional.
\end{funcdesc} \end{funcdesc}
Note that \code{EasyDialogs} does not currently use the notification Note that \module{EasyDialogs} does not currently use the notification
manager. This means that displaying dialogs while the program is in manager. This means that displaying dialogs while the program is in
the background will lead to unexpected results and possibly the background will lead to unexpected results and possibly
crashes. Also, all dialogs are modeless and hence expect to be at the crashes. Also, all dialogs are modeless and hence expect to be at the
......
\section{Standard Module \sectcode{MiniAEFrame}} \section{Standard Module \module{MiniAEFrame}}
\stmodindex{MiniAEFrame} \stmodindex{MiniAEFrame}
\label{module-MiniAEFrame} \label{module-MiniAEFrame}
The module \var{MiniAEFrame} provides a framework for an application The module \module{MiniAEFrame} provides a framework for an application
that can function as an OSA server, i.e. receive and process that can function as an Open Scripting Architecture
AppleEvents. It can be used in conjunction with \var{FrameWork} or \index{Open Scripting Architecture}
standalone. (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 This module is temporary, it will eventually be replaced by a module
that handles argument names better and possibly automates making your that handles argument names better and possibly automates making your
application scriptable. application scriptable.
The \var{MiniAEFrame} module defines the following classes: The \module{MiniAEFrame} module defines the following classes:
\setindexsubitem{(in module MiniAEFrame)}
\begin{funcdesc}{AEServer}{} \begin{classdesc}{AEServer}{}
A class that handles AppleEvent dispatch. Your application should A class that handles AppleEvent dispatch. Your application should
subclass this class together with either subclass this class together with either
\code{MiniAEFrame.MiniApplication} or \class{MiniApplication} or
\code{FrameWork.Application}. Your \code{__init__} method should call \class{FrameWork.Application}. Your \method{__init__()} method should
the \code{__init__} method for both classes. call the \method{__init__()} method for both classes.
\end{funcdesc} \end{classdesc}
\begin{funcdesc}{MiniApplication}{} \begin{classdesc}{MiniApplication}{}
A class that is more or less compatible with A class that is more or less compatible with
\code{FrameWork.Application} but with less functionality. Its \class{FrameWork.Application} but with less functionality. Its
eventloop supports the apple menu, command-dot and AppleEvents, other event loop supports the apple menu, command-dot and AppleEvents; other
events are passed on to the Python interpreter and/or Sioux. events are passed on to the Python interpreter and/or Sioux.
Useful if your application wants to use \code{AEServer} but does not Useful if your application wants to use \class{AEServer} but does not
provide its own windows, etc. provide its own windows, etc.
\end{funcdesc} \end{classdesc}
\subsection{AEServer Objects}
\setindexsubitem{(AEServer method)} \subsection{AEServer Objects}
\label{aeserver-objects}
\begin{funcdesc}{installaehandler}{classe, type, callback} \begin{methoddesc}[AEServer]{installaehandler}{classe, type, callback}
Installs an AppleEvent handler. \code{Classe} and \code{type} are the Installs an AppleEvent handler. \var{classe} and \var{type} are the
four-char OSA Class and Type designators, \code{'****'} wildcards are four-character OSA Class and Type designators, \code{'****'} wildcards
allowed. When a matching AppleEvent is received the parameters are are allowed. When a matching AppleEvent is received the parameters are
decoded and your callback is invoked. decoded and your callback is invoked.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{callback}{_object, **kwargs} \begin{methoddesc}[AEServer]{callback}{_object, **kwargs}
Your callback is called with the OSA Direct Object as first positional Your callback is called with the OSA Direct Object as first positional
parameter. The other parameters are passed as keyword arguments, with parameter. The other parameters are passed as keyword arguments, with
the 4-char designator as name. Three extra keyword parameters are the 4-character designator as name. Three extra keyword parameters are
passed: \code{_class} and \code{_type} are the Class and Type passed: \code{_class} and \code{_type} are the Class and Type
designators and \code{_attributes} is a dictionary with the AppleEvent designators and \code{_attributes} is a dictionary with the AppleEvent
attributes. attributes.
The return value of your method is packed with The return value of your method is packed with
\code{aetools.packevent} and sent as reply. \function{aetools.packevent()} and sent as reply.
\end{funcdesc} \end{methoddesc}
Note that there are some serious problems with the current Note that there are some serious problems with the current
design. AppleEvents which have non-identifier 4-char designators for design. AppleEvents which have non-identifier 4-character designators
arguments are not implementable, and it is not possible to return an for arguments are not implementable, and it is not possible to return
error to the originator. This will be addressed in a future release. an error to the originator. This will be addressed in a future
release.
\section{Built-in Module \sectcode{ctb}} \section{Built-in Module \sectcode{ctb}}
\label{module-ctb} \label{module-ctb}
\bimodindex{ctb} \bimodindex{ctb}
\setindexsubitem{(in module ctb)}
This module provides a partial interface to the Macintosh This module provides a partial interface to the Macintosh
Communications Toolbox. Currently, only Connection Manager tools are Communications Toolbox. Currently, only Connection Manager tools are
supported. It may not be available in all Mac Python versions. supported. It may not be available in all Mac Python versions.
\index{Communications Toolbox, Macintosh}
\index{Macintosh Communications Toolbox}
\index{Connection Manager}
\begin{datadesc}{error} \begin{datadesc}{error}
The exception raised on errors. The exception raised on errors.
...@@ -14,40 +16,41 @@ The exception raised on errors. ...@@ -14,40 +16,41 @@ The exception raised on errors.
\begin{datadesc}{cmData} \begin{datadesc}{cmData}
\dataline{cmCntl} \dataline{cmCntl}
\dataline{cmAttn} \dataline{cmAttn}
Flags for the \var{channel} argument of the \var{Read} and \var{Write} Flags for the \var{channel} argument of the \method{Read()} and
methods. \method{Write()} methods.
\end{datadesc} \end{datadesc}
\begin{datadesc}{cmFlagsEOM} \begin{datadesc}{cmFlagsEOM}
End-of-message flag for \var{Read} and \var{Write}. End-of-message flag for \method{Read()} and \method{Write()}.
\end{datadesc} \end{datadesc}
\begin{datadesc}{choose*} \begin{datadesc}{choose*}
Values returned by \var{Choose}. Values returned by \method{Choose()}.
\end{datadesc} \end{datadesc}
\begin{datadesc}{cmStatus*} \begin{datadesc}{cmStatus*}
Bits in the status as returned by \var{Status}. Bits in the status as returned by \method{Status()}.
\end{datadesc} \end{datadesc}
\begin{funcdesc}{available}{} \begin{funcdesc}{available}{}
Return 1 if the communication toolbox is available, zero otherwise. Return \code{1} if the Communication Toolbox is available, zero otherwise.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{CMNew}{name, sizes} \begin{funcdesc}{CMNew}{name, sizes}
Create a connection object using the connection tool named Create a connection object using the connection tool named
\var{name}. \var{sizes} is a 6-tuple given buffer sizes for data in, \var{name}. \var{sizes} is a 6-tuple given buffer sizes for data in,
data out, control in, control out, attention in and attention out. data out, control in, control out, attention in and attention out.
Alternatively, passing \code{None} will result in default buffer sizes. Alternatively, passing \code{None} for \var{sizes} will result in
default buffer sizes.
\end{funcdesc} \end{funcdesc}
\subsection{connection object} \subsection{connection object}
\label{connection-object}
For all connection methods that take a \var{timeout} argument, a value For all connection methods that take a \var{timeout} argument, a value
of \code{-1} is indefinite, meaning that the command runs to completion. of \code{-1} is indefinite, meaning that the command runs to completion.
\setindexsubitem{(connection object attribute)} \begin{memberdesc}[connection]{callback}
\begin{datadesc}{callback}
If this member is set to a value other than \code{None} it should point If this member is set to a value other than \code{None} it should point
to a function accepting a single argument (the connection to a function accepting a single argument (the connection
object). This will make all connection object methods work object). This will make all connection object methods work
...@@ -57,94 +60,92 @@ completion. ...@@ -57,94 +60,92 @@ completion.
\emph{Note:} for reasons beyond my understanding the callback routine \emph{Note:} for reasons beyond my understanding the callback routine
is currently never called. You are advised against using asynchronous is currently never called. You are advised against using asynchronous
calls for the time being. calls for the time being.
\end{datadesc} \end{memberdesc}
\setindexsubitem{(connection object method)} \begin{methoddesc}[connection]{Open}{timeout}
\begin{funcdesc}{Open}{timeout}
Open an outgoing connection, waiting at most \var{timeout} seconds for Open an outgoing connection, waiting at most \var{timeout} seconds for
the connection to be established. the connection to be established.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Listen}{timeout} \begin{methoddesc}[connection]{Listen}{timeout}
Wait for an incoming connection. Stop waiting after \var{timeout} Wait for an incoming connection. Stop waiting after \var{timeout}
seconds. This call is only meaningful to some tools. seconds. This call is only meaningful to some tools.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{accept}{yesno} \begin{methoddesc}[connection]{accept}{yesno}
Accept (when \var{yesno} is non-zero) or reject an incoming call after Accept (when \var{yesno} is non-zero) or reject an incoming call after
\var{Listen} returned. \method{Listen()} returned.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Close}{timeout, now} \begin{methoddesc}[connection]{Close}{timeout, now}
Close a connection. When \var{now} is zero, the close is orderly Close a connection. When \var{now} is zero, the close is orderly
(i.e.\ outstanding output is flushed, etc.)\ with a timeout of (i.e.\ outstanding output is flushed, etc.)\ with a timeout of
\var{timeout} seconds. When \var{now} is non-zero the close is \var{timeout} seconds. When \var{now} is non-zero the close is
immediate, discarding output. immediate, discarding output.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Read}{len, chan, timeout} \begin{methoddesc}[connection]{Read}{len, chan, timeout}
Read \var{len} bytes, or until \var{timeout} seconds have passed, from Read \var{len} bytes, or until \var{timeout} seconds have passed, from
the channel \var{chan} (which is one of \var{cmData}, \var{cmCntl} or the channel \var{chan} (which is one of \constant{cmData},
\var{cmAttn}). Return a 2-tuple:\ the data read and the end-of-message \constant{cmCntl} or \constant{cmAttn}). Return a 2-tuple:\ the data
flag. read and the end-of-message flag, \constant{cmFlagsEOM}.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Write}{buf, chan, timeout, eom} \begin{methoddesc}[connection]{Write}{buf, chan, timeout, eom}
Write \var{buf} to channel \var{chan}, aborting after \var{timeout} Write \var{buf} to channel \var{chan}, aborting after \var{timeout}
seconds. When \var{eom} has the value \var{cmFlagsEOM} an seconds. When \var{eom} has the value \constant{cmFlagsEOM}, an
end-of-message indicator will be written after the data (if this end-of-message indicator will be written after the data (if this
concept has a meaning for this communication tool). The method returns concept has a meaning for this communication tool). The method returns
the number of bytes written. the number of bytes written.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Status}{} \begin{methoddesc}[connection]{Status}{}
Return connection status as the 2-tuple \code{(\var{sizes}, Return connection status as the 2-tuple \code{(\var{sizes},
\var{flags})}. \var{sizes} is a 6-tuple giving the actual buffer sizes used \var{flags})}. \var{sizes} is a 6-tuple giving the actual buffer sizes used
(see \var{CMNew}), \var{flags} is a set of bits describing the state (see \function{CMNew()}), \var{flags} is a set of bits describing the state
of the connection. of the connection.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{GetConfig}{} \begin{methoddesc}[connection]{GetConfig}{}
Return the configuration string of the communication tool. These Return the configuration string of the communication tool. These
configuration strings are tool-dependent, but usually easily parsed configuration strings are tool-dependent, but usually easily parsed
and modified. and modified.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{SetConfig}{str} \begin{methoddesc}[connection]{SetConfig}{str}
Set the configuration string for the tool. The strings are parsed Set the configuration string for the tool. The strings are parsed
left-to-right, with later values taking precedence. This means left-to-right, with later values taking precedence. This means
individual configuration parameters can be modified by simply appending individual configuration parameters can be modified by simply appending
something like \code{'baud 4800'} to the end of the string returned by something like \code{'baud 4800'} to the end of the string returned by
\var{GetConfig} and passing that to this method. The method returns \method{GetConfig()} and passing that to this method. The method returns
the number of characters actually parsed by the tool before it the number of characters actually parsed by the tool before it
encountered an error (or completed successfully). encountered an error (or completed successfully).
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Choose}{} \begin{methoddesc}[connection]{Choose}{}
Present the user with a dialog to choose a communication tool and Present the user with a dialog to choose a communication tool and
configure it. If there is an outstanding connection some choices (like configure it. If there is an outstanding connection some choices (like
selecting a different tool) may cause the connection to be selecting a different tool) may cause the connection to be
aborted. The return value (one of the \var{choose*} constants) will aborted. The return value (one of the \constant{choose*} constants) will
indicate this. indicate this.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Idle}{} \begin{methoddesc}[connection]{Idle}{}
Give the tool a chance to use the processor. You should call this Give the tool a chance to use the processor. You should call this
method regularly. method regularly.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Abort}{} \begin{methoddesc}[connection]{Abort}{}
Abort an outstanding asynchronous \var{Open} or \var{Listen}. Abort an outstanding asynchronous \method{Open()} or \method{Listen()}.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Reset}{} \begin{methoddesc}[connection]{Reset}{}
Reset a connection. Exact meaning depends on the tool. Reset a connection. Exact meaning depends on the tool.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Break}{length} \begin{methoddesc}[connection]{Break}{length}
Send a break. Whether this means anything, what it means and Send a break. Whether this means anything, what it means and
interpretation of the \var{length} parameter depend on the tool in interpretation of the \var{length} parameter depends on the tool in
use. use.
\end{funcdesc} \end{methoddesc}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
\stmodindex{FrameWork} \stmodindex{FrameWork}
\label{module-FrameWork} \label{module-FrameWork}
The \code{FrameWork} module contains classes that together provide a The \module{FrameWork} module contains classes that together provide a
framework for an interactive Macintosh application. The programmer framework for an interactive Macintosh application. The programmer
builds an application by creating subclasses that override various builds an application by creating subclasses that override various
methods of the bases classes, thereby implementing the functionality methods of the bases classes, thereby implementing the functionality
...@@ -11,18 +11,17 @@ different levels, i.e. to handle clicks in a single dialog window in a ...@@ -11,18 +11,17 @@ different levels, i.e. to handle clicks in a single dialog window in a
non-standard way it is not necessary to override the complete event non-standard way it is not necessary to override the complete event
handling. handling.
The \code{FrameWork} is still very much work-in-progress, and the The \module{FrameWork} is still very much work-in-progress, and the
documentation describes only the most important functionality, and not documentation describes only the most important functionality, and not
in the most logical manner at that. Examine the source or the examples in the most logical manner at that. Examine the source or the examples
for more details. for more details.
The \code{FrameWork} module defines the following functions: The \module{FrameWork} module defines the following functions:
\setindexsubitem{(in module FrameWork)}
\begin{funcdesc}{Application}{} \begin{funcdesc}{Application}{}
An object representing the complete application. See below for a An object representing the complete application. See below for a
description of the methods. The default \code{__init__} routine description of the methods. The default \method{__init__()} routine
creates an empty window dictionary and a menu bar with an apple menu. creates an empty window dictionary and a menu bar with an apple menu.
\end{funcdesc} \end{funcdesc}
...@@ -88,23 +87,25 @@ Set the mouse cursor to a watch. ...@@ -88,23 +87,25 @@ Set the mouse cursor to a watch.
Set the mouse cursor to an arrow. Set the mouse cursor to an arrow.
\end{funcdesc} \end{funcdesc}
\subsection{Application objects} \subsection{Application Objects}
\label{application-objects}
Application objects have the following methods, among others: Application objects have the following methods, among others:
\setindexsubitem{(Application method)} \setindexsubitem{(Application method)}
\begin{funcdesc}{makeusermenus}{} \begin{funcdesc}{makeusermenus}{}
Override this method if you need menus in your application. Append the Override this method if you need menus in your application. Append the
menus to \code{self.menubar}. menus to the attribute \member{menubar}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{getabouttext}{} \begin{funcdesc}{getabouttext}{}
Override this method to return a text string describing your Override this method to return a text string describing your
application. Alternatively, override the \code{do_about} method for application. Alternatively, override the \method{do_about()} method
more elaborate about messages. for more elaborate ``about'' messages.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{mainloop}{\optional{mask, wait}} \begin{funcdesc}{mainloop}{\optional{mask\optional{, wait}}}
This routine is the main event loop, call it to set your application This routine is the main event loop, call it to set your application
rolling. \var{Mask} is the mask of events you want to handle, rolling. \var{Mask} is the mask of events you want to handle,
\var{wait} is the number of ticks you want to leave to other \var{wait} is the number of ticks you want to leave to other
...@@ -117,13 +118,14 @@ overridden. The default methods take care of dispatching events to ...@@ -117,13 +118,14 @@ overridden. The default methods take care of dispatching events to
windows and dialogs, handling drags and resizes, Apple Events, events windows and dialogs, handling drags and resizes, Apple Events, events
for non-FrameWork windows, etc. for non-FrameWork windows, etc.
In general, all event handlers should return 1 if the event is fully In general, all event handlers should return \code{1} if the event is fully
handled and 0 otherwise (because the front window was not a FrameWork handled and \code{0} otherwise (because the front window was not a FrameWork
window, for instance). This is needed so that update events and such window, for instance). This is needed so that update events and such
can be passed on to other windows like the Sioux console window. can be passed on to other windows like the Sioux console window.
Calling \code{MacOS.HandleEvent} is not allowed within \var{our_dispatch} Calling \function{MacOS.HandleEvent()} is not allowed within
or its callees, since this may result in an infinite loop if the \var{our_dispatch} or its callees, since this may result in an
code is called through the Python inner-loop event handler. infinite loop if the code is called through the Python inner-loop
event handler.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{asyncevents}{onoff} \begin{funcdesc}{asyncevents}{onoff}
...@@ -142,7 +144,8 @@ The old on/off value is returned. ...@@ -142,7 +144,8 @@ The old on/off value is returned.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{_quit}{} \begin{funcdesc}{_quit}{}
Terminate the event \code{mainloop} at the next convenient moment. Terminate the running \method{mainloop()} call at the next convenient
moment.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{do_char}{c, event} \begin{funcdesc}{do_char}{c, event}
...@@ -165,6 +168,7 @@ null-event is passed (so you can look at mouse position, etc). ...@@ -165,6 +168,7 @@ null-event is passed (so you can look at mouse position, etc).
\end{funcdesc} \end{funcdesc}
\subsection{Window Objects} \subsection{Window Objects}
\label{window-objects}
Window objects have the following methods, among others: Window objects have the following methods, among others:
...@@ -202,6 +206,7 @@ The window was activated (\code{activate==1}) or deactivated ...@@ -202,6 +206,7 @@ The window was activated (\code{activate==1}) or deactivated
\end{funcdesc} \end{funcdesc}
\subsection{ControlsWindow Object} \subsection{ControlsWindow Object}
\label{controlswindow-object}
ControlsWindow objects have the following methods besides those of ControlsWindow objects have the following methods besides those of
\code{Window} objects: \code{Window} objects:
...@@ -214,40 +219,41 @@ user. Tracking and such has already been taken care of. ...@@ -214,40 +219,41 @@ user. Tracking and such has already been taken care of.
\end{funcdesc} \end{funcdesc}
\subsection{ScrolledWindow Object} \subsection{ScrolledWindow Object}
\label{scrolledwindow-object}
ScrolledWindow objects are ControlsWindow objects with the following ScrolledWindow objects are ControlsWindow objects with the following
extra methods: extra methods:
\setindexsubitem{(ScrolledWindow method)} \setindexsubitem{(ScrolledWindow method)}
\begin{funcdesc}{scrollbars}{\optional{wantx, wanty}} \begin{funcdesc}{scrollbars}{\optional{wantx\optional{, wanty}}}
Create (or destroy) horizontal and vertical scrollbars. The arguments Create (or destroy) horizontal and vertical scrollbars. The arguments
specify which you want (default: both). The scrollbars always have specify which you want (default: both). The scrollbars always have
minimum \code{0} and maximum \code{32767}. minimum \code{0} and maximum \code{32767}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{getscrollbarvalues}{} \begin{funcdesc}{getscrollbarvalues}{}
You must supply this method. It should return a tuple \code{x, y} You must supply this method. It should return a tuple \code{(\var{x},
giving the current position of the scrollbars (between \code{0} and \var{y})} giving the current position of the scrollbars (between
\code{32767}). You can return \code{None} for either to indicate the \code{0} and \code{32767}). You can return \code{None} for either to
whole document is visible in that direction. indicate the whole document is visible in that direction.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{updatescrollbars}{} \begin{funcdesc}{updatescrollbars}{}
Call this method when the document has changed. It will call Call this method when the document has changed. It will call
\code{getscrollbarvalues} and update the scrollbars. \method{getscrollbarvalues()} and update the scrollbars.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{scrollbar_callback}{which, what, value} \begin{funcdesc}{scrollbar_callback}{which, what, value}
Supplied by you and called after user interaction. \code{Which} will Supplied by you and called after user interaction. \var{which} will
be \code{'x'} or \code{'y'}, \code{what} will be \code{'-'}, be \code{'x'} or \code{'y'}, \var{what} will be \code{'-'},
\code{'--'}, \code{'set'}, \code{'++'} or \code{'+'}. For \code{'--'}, \code{'set'}, \code{'++'} or \code{'+'}. For
\code{'set'}, \code{value} will contain the new scrollbar position. \code{'set'}, \var{value} will contain the new scrollbar position.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{scalebarvalues}{absmin, absmax, curmin, curmax} \begin{funcdesc}{scalebarvalues}{absmin, absmax, curmin, curmax}
Auxiliary method to help you calculate values to return from Auxiliary method to help you calculate values to return from
\code{getscrollbarvalues}. You pass document minimum and maximum value \method{getscrollbarvalues()}. You pass document minimum and maximum value
and topmost (leftmost) and bottommost (rightmost) visible values and and topmost (leftmost) and bottommost (rightmost) visible values and
it returns the correct number or \code{None}. it returns the correct number or \code{None}.
\end{funcdesc} \end{funcdesc}
...@@ -270,6 +276,7 @@ and has been handled. ...@@ -270,6 +276,7 @@ and has been handled.
\end{funcdesc} \end{funcdesc}
\subsection{DialogWindow Objects} \subsection{DialogWindow Objects}
\label{dialogwindow-objects}
DialogWindow objects have the following methods besides those of DialogWindow objects have the following methods besides those of
\code{Window} objects: \code{Window} objects:
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
\label{module-macconsole} \label{module-macconsole}
\bimodindex{macconsole} \bimodindex{macconsole}
\setindexsubitem{(in module macconsole)}
This module is available on the Macintosh, provided Python has been This module is available on the Macintosh, provided Python has been
built using the Think \C{} compiler. It provides an interface to the built using the Think \C{} compiler. It provides an interface to the
......
...@@ -4,8 +4,10 @@ ...@@ -4,8 +4,10 @@
This module provides an interface to the Macintosh Domain Name This module provides an interface to the Macintosh Domain Name
Resolver. It is usually used in conjunction with the \module{mactcp} Resolver. It is usually used in conjunction with the \module{mactcp}
module, to map hostnames to IP-addresses. It may not be available in module, to map hostnames to IP addresses. It may not be available in
all Mac Python versions. all Mac Python versions.
\index{Macintosh Domain Name Resolver}
\index{Domain Name Resolver, Macintosh}
The \module{macdnr} module defines the following functions: The \module{macdnr} module defines the following functions:
...@@ -46,11 +48,12 @@ variety. ...@@ -46,11 +48,12 @@ variety.
\begin{funcdesc}{MXInfo}{domain} \begin{funcdesc}{MXInfo}{domain}
Query the nameservers for a mail exchanger for \var{domain}. This is Query the nameservers for a mail exchanger for \var{domain}. This is
the hostname of a host willing to accept SMTP mail for the given the hostname of a host willing to accept SMTP\index{SMTP} mail for the
domain. Returns a dnr result object of the ``mx'' variety. given domain. Returns a dnr result object of the ``mx'' variety.
\end{funcdesc} \end{funcdesc}
\subsection{dnr result object} \subsection{dnr result object}
\label{dnr-result-object}
Since the DNR calls all execute asynchronously you do not get the Since the DNR calls all execute asynchronously you do not get the
results back immediately. Instead, you get a dnr result object. You results back immediately. Instead, you get a dnr result object. You
...@@ -64,50 +67,48 @@ The \member{rtnCode} and \member{cname} attributes are always ...@@ -64,50 +67,48 @@ The \member{rtnCode} and \member{cname} attributes are always
available, the others depend on the type of query (address, hinfo or available, the others depend on the type of query (address, hinfo or
mx). mx).
\setindexsubitem{(dnr result method)}
% Add args, as in {arg1, arg2 \optional{, arg3}} % Add args, as in {arg1, arg2 \optional{, arg3}}
\begin{funcdesc}{wait}{} \begin{methoddesc}[dnr result]{wait}{}
Wait for the query to complete. Wait for the query to complete.
\end{funcdesc} \end{methoddesc}
% Add args, as in {arg1, arg2 \optional{, arg3}} % Add args, as in {arg1, arg2 \optional{, arg3}}
\begin{funcdesc}{isdone}{} \begin{methoddesc}[dnr result]{isdone}{}
Return \code{1} if the query is complete. Return \code{1} if the query is complete.
\end{funcdesc} \end{methoddesc}
\setindexsubitem{(dnr result attribute)}
\begin{datadesc}{rtnCode} \begin{memberdesc}[dnr result]{rtnCode}
The error code returned by the query. The error code returned by the query.
\end{datadesc} \end{memberdesc}
\begin{datadesc}{cname} \begin{memberdesc}[dnr result]{cname}
The canonical name of the host that was queried. The canonical name of the host that was queried.
\end{datadesc} \end{memberdesc}
\begin{datadesc}{ip0} \begin{memberdesc}[dnr result]{ip0}
\dataline{ip1} \memberline[dnr result]{ip1}
\dataline{ip2} \memberline[dnr result]{ip2}
\dataline{ip3} \memberline[dnr result]{ip3}
At most four integer IP addresses for this host. Unused entries are At most four integer IP addresses for this host. Unused entries are
zero. Valid only for address queries. zero. Valid only for address queries.
\end{datadesc} \end{memberdesc}
\begin{datadesc}{cpuType} \begin{memberdesc}[dnr result]{cpuType}
\dataline{osType} \memberline[dnr result]{osType}
Textual strings giving the machine type an OS name. Valid for ``hinfo'' Textual strings giving the machine type an OS name. Valid for ``hinfo''
queries. queries.
\end{datadesc} \end{memberdesc}
\begin{datadesc}{exchange} \begin{memberdesc}[dnr result]{exchange}
The name of a mail-exchanger host. Valid for ``mx'' queries. The name of a mail-exchanger host. Valid for ``mx'' queries.
\end{datadesc} \end{memberdesc}
\begin{datadesc}{preference} \begin{memberdesc}[dnr result]{preference}
The preference of this mx record. Not too useful, since the Macintosh The preference of this mx record. Not too useful, since the Macintosh
will only return a single mx record. Valid for ``mx'' queries only. will only return a single mx record. Valid for ``mx'' queries only.
\end{datadesc} \end{memberdesc}
The simplest way to use the module to convert names to dotted-decimal The simplest way to use the module to convert names to dotted-decimal
strings, without worrying about idle time, etc: strings, without worrying about idle time, etc:
......
This diff is collapsed.
...@@ -30,7 +30,7 @@ Exception raised on errors in the \module{ic} module. ...@@ -30,7 +30,7 @@ Exception raised on errors in the \module{ic} module.
The \module{ic} module defines the following functions: The \module{ic} module defines the following functions:
\begin{funcdesc}{IC}{\optional{signature\optional{, ic}}} \begin{funcdesc}{IC}{\optional{signature\optional{, ic}}}
Create an internet config object. The signature is a 4-char creator Create an internet config object. The signature is a 4-character creator
code of the current application (default \code{'Pyth'}) which may code of the current application (default \code{'Pyth'}) which may
influence some of ICs settings. The optional \var{ic} argument is a influence some of ICs settings. The optional \var{ic} argument is a
low-level \code{icglue.icinstance} created beforehand, this may be low-level \code{icglue.icinstance} created beforehand, this may be
...@@ -62,7 +62,7 @@ documentation. ...@@ -62,7 +62,7 @@ documentation.
If the module does not know how to represent the data it returns an If the module does not know how to represent the data it returns an
instance of the \code{ICOpaqueData} type, with the raw data in its instance of the \code{ICOpaqueData} type, with the raw data in its
\var{data} attribute. Objects of this type are also acceptable values \member{data} attribute. Objects of this type are also acceptable values
for assignment. for assignment.
Besides the dictionary interface IC objects have the following methods: Besides the dictionary interface IC objects have the following methods:
...@@ -82,21 +82,22 @@ position and the URL. The optional \var{start} and \var{end} can be ...@@ -82,21 +82,22 @@ position and the URL. The optional \var{start} and \var{end} can be
used to limit the search, so for instance if a user clicks in a long used to limit the search, so for instance if a user clicks in a long
textfield you can pass the whole textfield and the click-position in textfield you can pass the whole textfield and the click-position in
\var{start} and this routine will return the whole URL in which the \var{start} and this routine will return the whole URL in which the
user clicked. \var{Hint} is again an optional scheme used to complete user clicked. As above, \var{hint} is an optional scheme used to
incomplete URLs. complete incomplete URLs.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{mapfile}{file} \begin{funcdesc}{mapfile}{file}
Return the mapping entry for the given \var{file}, which can be passed Return the mapping entry for the given \var{file}, which can be passed
as either a filename or an \code{macfs.FSSpec} object, and which need as either a filename or an \function{macfs.FSSpec()} result, and which
not exist. need not exist.
The mapping entry is returned as a tuple \code{(}\var{version}, The mapping entry is returned as a tuple \code{(}\var{version},
\var{type}, \var{creator}, \var{postcreator}, \var{flags}, \var{type}, \var{creator}, \var{postcreator}, \var{flags},
\var{extension}, \var{appname}, \var{postappname}, \var{mimetype}, \var{extension}, \var{appname}, \var{postappname}, \var{mimetype},
\var{entryname}\code{)}, where \var{version} is the entry version \var{entryname}\code{)}, where \var{version} is the entry version
number, \var{type} is the 4-char filetype, \var{creator} is the 4-char number, \var{type} is the 4-character filetype, \var{creator} is the
creator type, \var{postcreator} is the 4-char creator code of an 4-character creator type, \var{postcreator} is the 4-character creator
code of an
optional application to post-process the file after downloading, optional application to post-process the file after downloading,
\var{flags} are various bits specifying whether to transfer in binary \var{flags} are various bits specifying whether to transfer in binary
or ascii and such, \var{extension} is the filename extension for this or ascii and such, \var{extension} is the filename extension for this
...@@ -107,7 +108,7 @@ file and \var{entryname} is the name of this entry. ...@@ -107,7 +108,7 @@ file and \var{entryname} is the name of this entry.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{maptypecreator}{type, creator\optional{, filename}} \begin{funcdesc}{maptypecreator}{type, creator\optional{, filename}}
Return the mapping entry for files with given 4-char \var{type} and Return the mapping entry for files with given 4-character \var{type} and
\var{creator} codes. The optional \var{filename} may be specified to \var{creator} codes. The optional \var{filename} may be specified to
further help finding the correct entry (if the creator code is further help finding the correct entry (if the creator code is
\code{'????'}, for instance). \code{'????'}, for instance).
...@@ -117,7 +118,7 @@ The mapping entry is returned in the same format as for \var{mapfile}. ...@@ -117,7 +118,7 @@ The mapping entry is returned in the same format as for \var{mapfile}.
\begin{funcdesc}{settypecreator}{file} \begin{funcdesc}{settypecreator}{file}
Given an existing \var{file}, specified either as a filename or as an Given an existing \var{file}, specified either as a filename or as an
\code{macfs.FSSpec} record, set its creator and type correctly based \function{macfs.FSSpec()} result, set its creator and type correctly based
on its extension. The finder is told about the change, so the finder on its extension. The finder is told about the change, so the finder
icon will be updated quickly. icon will be updated quickly.
\end{funcdesc} \end{funcdesc}
\section{Built-in Module \sectcode{macspeech}} \section{Built-in Module \module{macspeech}}
\label{module-macspeech} \label{module-macspeech}
\bimodindex{macspeech} \bimodindex{macspeech}
\setindexsubitem{(in module macspeech)}
This module provides an interface to the Macintosh Speech Manager, This module provides an interface to the Macintosh Speech Manager,
\index{Macintosh Speech Manager}
\index{Speech Manager, Macintosh}
allowing you to let the Macintosh utter phrases. You need a version of allowing you to let the Macintosh utter phrases. You need a version of
the speech manager extension (version 1 and 2 have been tested) in the Speech Manager extension (version 1 and 2 have been tested) in
your \code{Extensions} folder for this to work. The module does not your \file{Extensions} folder for this to work. The module does not
provide full access to all features of the Speech Manager yet. It may provide full access to all features of the Speech Manager yet. It may
not be available in all Mac Python versions. not be available in all Mac Python versions.
\begin{funcdesc}{Available}{} \begin{funcdesc}{Available}{}
Test availability of the Speech Manager extension (and, on the Test availability of the Speech Manager extension (and, on the
PowerPC, the Speech Manager shared library). Return 0 or 1. PowerPC, the Speech Manager shared library). Return \code{0} or
\code{1}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{Version}{} \begin{funcdesc}{Version}{}
...@@ -23,7 +25,7 @@ Return the (integer) version number of the Speech Manager. ...@@ -23,7 +25,7 @@ Return the (integer) version number of the Speech Manager.
\begin{funcdesc}{SpeakString}{str} \begin{funcdesc}{SpeakString}{str}
Utter the string \var{str} using the default voice, Utter the string \var{str} using the default voice,
asynchronously. This aborts any speech that may still be active from asynchronously. This aborts any speech that may still be active from
prior \code{SpeakString} invocations. prior \function{SpeakString()} invocations.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{Busy}{} \begin{funcdesc}{Busy}{}
...@@ -35,53 +37,57 @@ Return the number of different voices available. ...@@ -35,53 +37,57 @@ Return the number of different voices available.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{GetIndVoice}{num} \begin{funcdesc}{GetIndVoice}{num}
Return a voice object for voice number \var{num}. Return a \pytype{Voice} object for voice number \var{num}.
\end{funcdesc} \end{funcdesc}
\subsection{voice objects} \subsection{Voice Objects}
\label{voice-objects}
Voice objects contain the description of a voice. It is currently not Voice objects contain the description of a voice. It is currently not
yet possible to access the parameters of a voice. yet possible to access the parameters of a voice.
\setindexsubitem{(voice object method)} \setindexsubitem{(voice object method)}
\begin{funcdesc}{GetGender}{} \begin{methoddesc}[Voice]{GetGender}{}
Return the gender of the voice: 0 for male, 1 for female and -1 for neuter. Return the gender of the voice: \code{0} for male, \code{1} for female
\end{funcdesc} and \code{-1} for neuter.
\end{methoddesc}
\begin{funcdesc}{NewChannel}{} \begin{methoddesc}[Voice]{NewChannel}{}
Return a new speech channel object using this voice. Return a new Speech Channel object using this voice.
\end{funcdesc} \end{methoddesc}
\subsection{speech channel objects} \subsection{Speech Channel Objects}
A speech channel object allows you to speak strings with slightly more \label{speech-channel-objects}
control than \code{SpeakString()}, and allows you to use multiple
A Speech Channel object allows you to speak strings with slightly more
control than \function{SpeakString()}, and allows you to use multiple
speakers at the same time. Please note that channel pitch and rate are speakers at the same time. Please note that channel pitch and rate are
interrelated in some way, so that to make your Macintosh sing you will interrelated in some way, so that to make your Macintosh sing you will
have to adjust both. have to adjust both.
\setindexsubitem{(speech channel object method)} \begin{methoddesc}[Speech Channel]{SpeakText}{str}
\begin{funcdesc}{SpeakText}{str}
Start uttering the given string. Start uttering the given string.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Stop}{} \begin{methoddesc}[Speech Channel]{Stop}{}
Stop babbling. Stop babbling.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{GetPitch}{} \begin{methoddesc}[Speech Channel]{GetPitch}{}
Return the current pitch of the channel, as a floating-point number. Return the current pitch of the channel, as a floating-point number.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{SetPitch}{pitch} \begin{methoddesc}[Speech Channel]{SetPitch}{pitch}
Set the pitch of the channel. Set the pitch of the channel.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{GetRate}{} \begin{methoddesc}[Speech Channel]{GetRate}{}
Get the speech rate (utterances per minute) of the channel as a Get the speech rate (utterances per minute) of the channel as a
floating point number. floating point number.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{SetRate}{rate} \begin{methoddesc}[Speech Channel]{SetRate}{rate}
Set the speech rate of the channel. Set the speech rate of the channel.
\end{funcdesc} \end{methoddesc}
\section{Standard Module \sectcode{EasyDialogs}} \section{Standard Module \module{EasyDialogs}}
\label{module-EasyDialogs} \label{module-EasyDialogs}
\stmodindex{EasyDialogs} \stmodindex{EasyDialogs}
The \code{EasyDialogs} module contains some simple dialogs for The \module{EasyDialogs} module contains some simple dialogs for
the Macintosh, modelled after the \code{stdwin} dialogs with similar the Macintosh, modelled after the \module{stdwin} dialogs with similar
names. All routines have an optional parameter \var{id} with which you names. All routines have an optional parameter \var{id} with which you
can override the DLOG resource used for the dialog, as long as the can override the DLOG resource used for the dialog, as long as the
item numbers correspond. See the source for details. item numbers correspond. See the source for details.
The \module{EasyDialogs} module defines the following functions:
The \code{EasyDialogs} module defines the following functions:
\setindexsubitem{(in module EasyDialogs)}
\begin{funcdesc}{Message}{str} \begin{funcdesc}{Message}{str}
A modal dialog with the message text \var{str}, which should be at A modal dialog with the message text \var{str}, which should be at
...@@ -19,11 +18,11 @@ user clicks ``OK''. ...@@ -19,11 +18,11 @@ user clicks ``OK''.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{AskString}{prompt\optional{, default}} \begin{funcdesc}{AskString}{prompt\optional{, default}}
Ask the user to input a string value, in a modal dialog. \var{Prompt} Ask the user to input a string value, in a modal dialog. \var{prompt}
is the promt message, the optional \var{default} arg is the initial is the promt message, the optional \var{default} arg is the initial
value for the string. All strings can be at most 255 bytes value for the string. All strings can be at most 255 bytes
long. \var{AskString} returns the string entered or \code{None} in long. \function{AskString()} returns the string entered or \code{None}
case the user cancelled. in case the user cancelled.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{AskYesNoCancel}{question\optional{, default}} \begin{funcdesc}{AskYesNoCancel}{question\optional{, default}}
...@@ -34,19 +33,19 @@ hitting return is \code{0}. This can be changed with the optional ...@@ -34,19 +33,19 @@ hitting return is \code{0}. This can be changed with the optional
\var{default} argument. \var{default} argument.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{ProgressBar}{\optional{label, maxval}} \begin{funcdesc}{ProgressBar}{\optional{label\optional{, maxval}}}
Display a modeless progress dialog with a thermometer bar. \var{Label} Display a modeless progress dialog with a thermometer bar. \var{label}
is the textstring displayed (default ``Working...''), \var{maxval} is is the text string displayed (default ``Working...''), \var{maxval} is
the value at which progress is complete (default 100). The returned the value at which progress is complete (default \code{100}). The
object has one method, \code{set(value)}, which sets the value of the returned object has one method, \code{set(\var{value})}, which sets
progress bar. The bar remains visible until the object returned is the value of the progress bar. The bar remains visible until the
discarded. object returned is discarded.
The progress bar has a ``cancel'' button, but it is currently The progress bar has a ``cancel'' button, but it is currently
non-functional. non-functional.
\end{funcdesc} \end{funcdesc}
Note that \code{EasyDialogs} does not currently use the notification Note that \module{EasyDialogs} does not currently use the notification
manager. This means that displaying dialogs while the program is in manager. This means that displaying dialogs while the program is in
the background will lead to unexpected results and possibly the background will lead to unexpected results and possibly
crashes. Also, all dialogs are modeless and hence expect to be at the crashes. Also, all dialogs are modeless and hence expect to be at the
......
\section{Standard Module \sectcode{MiniAEFrame}} \section{Standard Module \module{MiniAEFrame}}
\stmodindex{MiniAEFrame} \stmodindex{MiniAEFrame}
\label{module-MiniAEFrame} \label{module-MiniAEFrame}
The module \var{MiniAEFrame} provides a framework for an application The module \module{MiniAEFrame} provides a framework for an application
that can function as an OSA server, i.e. receive and process that can function as an Open Scripting Architecture
AppleEvents. It can be used in conjunction with \var{FrameWork} or \index{Open Scripting Architecture}
standalone. (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 This module is temporary, it will eventually be replaced by a module
that handles argument names better and possibly automates making your that handles argument names better and possibly automates making your
application scriptable. application scriptable.
The \var{MiniAEFrame} module defines the following classes: The \module{MiniAEFrame} module defines the following classes:
\setindexsubitem{(in module MiniAEFrame)}
\begin{funcdesc}{AEServer}{} \begin{classdesc}{AEServer}{}
A class that handles AppleEvent dispatch. Your application should A class that handles AppleEvent dispatch. Your application should
subclass this class together with either subclass this class together with either
\code{MiniAEFrame.MiniApplication} or \class{MiniApplication} or
\code{FrameWork.Application}. Your \code{__init__} method should call \class{FrameWork.Application}. Your \method{__init__()} method should
the \code{__init__} method for both classes. call the \method{__init__()} method for both classes.
\end{funcdesc} \end{classdesc}
\begin{funcdesc}{MiniApplication}{} \begin{classdesc}{MiniApplication}{}
A class that is more or less compatible with A class that is more or less compatible with
\code{FrameWork.Application} but with less functionality. Its \class{FrameWork.Application} but with less functionality. Its
eventloop supports the apple menu, command-dot and AppleEvents, other event loop supports the apple menu, command-dot and AppleEvents; other
events are passed on to the Python interpreter and/or Sioux. events are passed on to the Python interpreter and/or Sioux.
Useful if your application wants to use \code{AEServer} but does not Useful if your application wants to use \class{AEServer} but does not
provide its own windows, etc. provide its own windows, etc.
\end{funcdesc} \end{classdesc}
\subsection{AEServer Objects}
\setindexsubitem{(AEServer method)} \subsection{AEServer Objects}
\label{aeserver-objects}
\begin{funcdesc}{installaehandler}{classe, type, callback} \begin{methoddesc}[AEServer]{installaehandler}{classe, type, callback}
Installs an AppleEvent handler. \code{Classe} and \code{type} are the Installs an AppleEvent handler. \var{classe} and \var{type} are the
four-char OSA Class and Type designators, \code{'****'} wildcards are four-character OSA Class and Type designators, \code{'****'} wildcards
allowed. When a matching AppleEvent is received the parameters are are allowed. When a matching AppleEvent is received the parameters are
decoded and your callback is invoked. decoded and your callback is invoked.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{callback}{_object, **kwargs} \begin{methoddesc}[AEServer]{callback}{_object, **kwargs}
Your callback is called with the OSA Direct Object as first positional Your callback is called with the OSA Direct Object as first positional
parameter. The other parameters are passed as keyword arguments, with parameter. The other parameters are passed as keyword arguments, with
the 4-char designator as name. Three extra keyword parameters are the 4-character designator as name. Three extra keyword parameters are
passed: \code{_class} and \code{_type} are the Class and Type passed: \code{_class} and \code{_type} are the Class and Type
designators and \code{_attributes} is a dictionary with the AppleEvent designators and \code{_attributes} is a dictionary with the AppleEvent
attributes. attributes.
The return value of your method is packed with The return value of your method is packed with
\code{aetools.packevent} and sent as reply. \function{aetools.packevent()} and sent as reply.
\end{funcdesc} \end{methoddesc}
Note that there are some serious problems with the current Note that there are some serious problems with the current
design. AppleEvents which have non-identifier 4-char designators for design. AppleEvents which have non-identifier 4-character designators
arguments are not implementable, and it is not possible to return an for arguments are not implementable, and it is not possible to return
error to the originator. This will be addressed in a future release. an error to the originator. This will be addressed in a future
release.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment