Updated the Mac documentation to the current state of affairs.
This commit is contained in:
parent
90975f1ff9
commit
7aeba45b84
|
@ -12,7 +12,7 @@
|
|||
The \module{aepack} module defines functions for converting (packing)
|
||||
Python variables to AppleEvent descriptors and back (unpacking).
|
||||
Within Python the AppleEvent descriptor is handled by Python objects
|
||||
of built-in type \pytype{AEDesc}, defined in module \refmodule{AE}.
|
||||
of built-in type \class{AEDesc}, defined in module \refmodule{AE}.
|
||||
|
||||
The \module{aepack} module defines the following functions:
|
||||
|
||||
|
@ -25,21 +25,20 @@ Apple Event descriptor types is used, as follows:
|
|||
|
||||
\begin{tableii}{l|l}{textrm}{Python type}{descriptor type}
|
||||
\lineii{\class{FSSpec}}{typeFSS}
|
||||
\lineii{\class{FSRef}}{typeFSRef}
|
||||
\lineii{\class{Alias}}{typeAlias}
|
||||
\lineii{integer}{typeLong (32 bit integer)}
|
||||
\lineii{float}{typeFloat (64 bit floating point)}
|
||||
\lineii{string}{typeText}
|
||||
\lineii{unicode}{typeUnicodeText}
|
||||
\lineii{list}{typeAEList}
|
||||
\lineii{dictionary}{typeAERecord}
|
||||
\lineii{instance}{\emph{see below}}
|
||||
\end{tableii}
|
||||
|
||||
\pytype{FSSpec} and \pytype{Alias} are built-in object types defined
|
||||
in the module \refmodule{macfs}.
|
||||
|
||||
If \var{x} is a Python instance then this function attempts to call an
|
||||
\method{__aepack__()} method. This method should return an
|
||||
\pytype{AE.AEDesc} object.
|
||||
\class{AE.AEDesc} object.
|
||||
|
||||
If the conversion \var{x} is not defined above, this function returns
|
||||
the Python string representation of a value (the repr() function)
|
||||
|
|
|
@ -1,159 +0,0 @@
|
|||
\section{\module{ctb} ---
|
||||
Interface to the Communications Tool Box}
|
||||
|
||||
\declaremodule{builtin}{ctb}
|
||||
\platform{Mac}
|
||||
\modulesynopsis{Interfaces to the Communications Tool Box. Only the
|
||||
Connection Manager is supported.}
|
||||
|
||||
|
||||
This module provides a partial interface to the Macintosh
|
||||
Communications Toolbox. Currently, only Connection Manager tools are
|
||||
supported.
|
||||
|
||||
This module is only available under MacOS9 or earlier, in classic PPC
|
||||
MacPython.
|
||||
\index{Communications Toolbox, Macintosh}
|
||||
\index{Macintosh Communications Toolbox}
|
||||
\index{Connection Manager}
|
||||
|
||||
\begin{datadesc}{error}
|
||||
The exception raised on errors.
|
||||
\end{datadesc}
|
||||
|
||||
\begin{datadesc}{cmData}
|
||||
\dataline{cmCntl}
|
||||
\dataline{cmAttn}
|
||||
Flags for the \var{channel} argument of the \method{Read()} and
|
||||
\method{Write()} methods.
|
||||
\end{datadesc}
|
||||
|
||||
\begin{datadesc}{cmFlagsEOM}
|
||||
End-of-message flag for \method{Read()} and \method{Write()}.
|
||||
\end{datadesc}
|
||||
|
||||
\begin{datadesc}{choose*}
|
||||
Values returned by \method{Choose()}.
|
||||
\end{datadesc}
|
||||
|
||||
\begin{datadesc}{cmStatus*}
|
||||
Bits in the status as returned by \method{Status()}.
|
||||
\end{datadesc}
|
||||
|
||||
\begin{funcdesc}{available}{}
|
||||
Return \code{1} if the Communication Toolbox is available, zero otherwise.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{CMNew}{name, sizes}
|
||||
Create a connection object using the connection tool named
|
||||
\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.
|
||||
Alternatively, passing \code{None} for \var{sizes} will result in
|
||||
default buffer sizes.
|
||||
\end{funcdesc}
|
||||
|
||||
|
||||
\subsection{Connection Objects \label{connection-object}}
|
||||
|
||||
For all connection methods that take a \var{timeout} argument, a value
|
||||
of \code{-1} is indefinite, meaning that the command runs to completion.
|
||||
|
||||
\begin{memberdesc}[connection]{callback}
|
||||
If this member is set to a value other than \code{None} it should point
|
||||
to a function accepting a single argument (the connection
|
||||
object). This will make all connection object methods work
|
||||
asynchronously, with the callback routine being called upon
|
||||
completion.
|
||||
|
||||
\note{For reasons beyond my understanding, the callback routine
|
||||
is currently never called. You are advised against using asynchronous
|
||||
calls for the time being.}
|
||||
\end{memberdesc}
|
||||
|
||||
|
||||
\begin{methoddesc}[connection]{Open}{timeout}
|
||||
Open an outgoing connection, waiting at most \var{timeout} seconds for
|
||||
the connection to be established.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[connection]{Listen}{timeout}
|
||||
Wait for an incoming connection. Stop waiting after \var{timeout}
|
||||
seconds. This call is only meaningful to some tools.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[connection]{accept}{yesno}
|
||||
Accept (when \var{yesno} is non-zero) or reject an incoming call after
|
||||
\method{Listen()} returned.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[connection]{Close}{timeout, now}
|
||||
Close a connection. When \var{now} is zero, the close is orderly
|
||||
(outstanding output is flushed, etc.)\ with a timeout of
|
||||
\var{timeout} seconds. When \var{now} is non-zero the close is
|
||||
immediate, discarding output.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[connection]{Read}{len, chan, timeout}
|
||||
Read \var{len} bytes, or until \var{timeout} seconds have passed, from
|
||||
the channel \var{chan} (which is one of \constant{cmData},
|
||||
\constant{cmCntl} or \constant{cmAttn}). Return a 2-tuple:\ the data
|
||||
read and the end-of-message flag, \constant{cmFlagsEOM}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[connection]{Write}{buf, chan, timeout, eom}
|
||||
Write \var{buf} to channel \var{chan}, aborting after \var{timeout}
|
||||
seconds. When \var{eom} has the value \constant{cmFlagsEOM}, an
|
||||
end-of-message indicator will be written after the data (if this
|
||||
concept has a meaning for this communication tool). The method returns
|
||||
the number of bytes written.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[connection]{Status}{}
|
||||
Return connection status as the 2-tuple \code{(\var{sizes},
|
||||
\var{flags})}. \var{sizes} is a 6-tuple giving the actual buffer sizes used
|
||||
(see \function{CMNew()}), \var{flags} is a set of bits describing the state
|
||||
of the connection.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[connection]{GetConfig}{}
|
||||
Return the configuration string of the communication tool. These
|
||||
configuration strings are tool-dependent, but usually easily parsed
|
||||
and modified.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[connection]{SetConfig}{str}
|
||||
Set the configuration string for the tool. The strings are parsed
|
||||
left-to-right, with later values taking precedence. This means
|
||||
individual configuration parameters can be modified by simply appending
|
||||
something like \code{'baud 4800'} to the end of the string returned by
|
||||
\method{GetConfig()} and passing that to this method. The method returns
|
||||
the number of characters actually parsed by the tool before it
|
||||
encountered an error (or completed successfully).
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[connection]{Choose}{}
|
||||
Present the user with a dialog to choose a communication tool and
|
||||
configure it. If there is an outstanding connection some choices (like
|
||||
selecting a different tool) may cause the connection to be
|
||||
aborted. The return value (one of the \constant{choose*} constants) will
|
||||
indicate this.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[connection]{Idle}{}
|
||||
Give the tool a chance to use the processor. You should call this
|
||||
method regularly.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[connection]{Abort}{}
|
||||
Abort an outstanding asynchronous \method{Open()} or \method{Listen()}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[connection]{Reset}{}
|
||||
Reset a connection. Exact meaning depends on the tool.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[connection]{Break}{length}
|
||||
Send a break. Whether this means anything, what it means and
|
||||
interpretation of the \var{length} parameter depends on the tool in
|
||||
use.
|
||||
\end{methoddesc}
|
|
@ -6,9 +6,10 @@
|
|||
\modulesynopsis{Implementations for the \module{os} module.}
|
||||
|
||||
|
||||
This module implements the operating system dependent functionality
|
||||
This module implements the Mac OS 9 operating system dependent functionality
|
||||
provided by the standard module \module{os}\refstmodindex{os}. It is
|
||||
best accessed through the \module{os} module.
|
||||
best accessed through the \module{os} module. This module is only available in
|
||||
MacPython-OS9, on MacPython-OSX \module{posix} is used.
|
||||
|
||||
The following functions are available in this module:
|
||||
\function{chdir()},
|
||||
|
@ -29,23 +30,7 @@ The following functions are available in this module:
|
|||
\function{write()},
|
||||
as well as the exception \exception{error}. Note that the times
|
||||
returned by \function{stat()} are floating-point values, like all time
|
||||
values in MacPython.
|
||||
|
||||
One additional function is available, but only under Classic MacPython,
|
||||
not under Carbon MacPython:
|
||||
|
||||
\begin{funcdesc}{xstat}{path}
|
||||
This function returns the same information as \function{stat()}, but
|
||||
with three additional values appended: the size of the resource fork
|
||||
of the file and its 4-character creator and type.
|
||||
Availability: Classic MacPython only.
|
||||
\deprecated{2.3}{Use the \function{\refmodule{macfs}.FSSpec()}
|
||||
function to get an FSSpec object for the file, then
|
||||
use the \method{GetCreatorType()} method to get the
|
||||
creator and type information. It will no longer be
|
||||
possible to get the size of the resource fork.}
|
||||
\end{funcdesc}
|
||||
|
||||
values in MacPython-OS9.
|
||||
|
||||
\section{\module{macpath} ---
|
||||
MacOS path manipulation functions}
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
\section{\module{macfs} ---
|
||||
Various file system services}
|
||||
|
||||
\declaremodule{builtin}{macfs}
|
||||
\declaremodule{standard}{macfs}
|
||||
\platform{Mac}
|
||||
\modulesynopsis{Support for FSSpec, the Alias Manager,
|
||||
\program{finder} aliases, and the Standard File package.}
|
||||
|
||||
\deprecated{2.3}{The macfs module should be considered obsolete. For
|
||||
\class{FSSpec}, \class{FSRef} and \class{Alias} handling use the
|
||||
Carbon.File or Carbon.Folder module. For file dialogs use the
|
||||
\module{EasyDialogs} module.}
|
||||
|
||||
This module provides access to Macintosh FSSpec handling, the Alias
|
||||
Manager, \program{finder} aliases and the Standard File package.
|
||||
|
@ -15,9 +19,9 @@ Manager, \program{finder} aliases and the Standard File package.
|
|||
|
||||
Whenever a function or method expects a \var{file} argument, this
|
||||
argument can be one of three things:\ (1) a full or partial Macintosh
|
||||
pathname, (2) an \pytype{FSSpec} object or (3) a 3-tuple
|
||||
pathname, (2) an \class{FSSpec} object or (3) a 3-tuple
|
||||
\code{(\var{wdRefNum}, \var{parID}, \var{name})} as described in
|
||||
\citetitle{Inside Macintosh:\ Files}. An \pytype{FSSpec} can point to
|
||||
\citetitle{Inside Macintosh:\ Files}. An \class{FSSpec} can point to
|
||||
a non-existing file, as long as the folder containing the file exists.
|
||||
Under MacPython the same is true for a pathname, but not under unix-Pyton
|
||||
because of the way pathnames and FSRefs works. See Apple's documentation
|
||||
|
@ -26,42 +30,39 @@ for details.
|
|||
A description of aliases and the
|
||||
Standard File package can also be found there.
|
||||
|
||||
\note{A module, \refmodule{macfsn}, is auto-imported to replace
|
||||
StandardFile calls in \module{macfs} with NavServices calls.}
|
||||
|
||||
\begin{funcdesc}{FSSpec}{file}
|
||||
Create an \pytype{FSSpec} object for the specified file.
|
||||
Create an \class{FSSpec} object for the specified file.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{RawFSSpec}{data}
|
||||
Create an \pytype{FSSpec} object given the raw data for the \C{}
|
||||
structure for the \pytype{FSSpec} as a string. This is mainly useful
|
||||
if you have obtained an \pytype{FSSpec} structure over a network.
|
||||
Create an \class{FSSpec} object given the raw data for the \C{}
|
||||
structure for the \class{FSSpec} as a string. This is mainly useful
|
||||
if you have obtained an \class{FSSpec} structure over a network.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{RawAlias}{data}
|
||||
Create an \pytype{Alias} object given the raw data for the \C{}
|
||||
Create an \class{Alias} object given the raw data for the \C{}
|
||||
structure for the alias as a string. This is mainly useful if you
|
||||
have obtained an \pytype{FSSpec} structure over a network.
|
||||
have obtained an \class{FSSpec} structure over a network.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{FInfo}{}
|
||||
Create a zero-filled \pytype{FInfo} object.
|
||||
Create a zero-filled \class{FInfo} object.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{ResolveAliasFile}{file}
|
||||
Resolve an alias file. Returns a 3-tuple \code{(\var{fsspec},
|
||||
\var{isfolder}, \var{aliased})} where \var{fsspec} is the resulting
|
||||
\pytype{FSSpec} object, \var{isfolder} is true if \var{fsspec} points
|
||||
\class{FSSpec} object, \var{isfolder} is true if \var{fsspec} points
|
||||
to a folder and \var{aliased} is true if the file was an alias in the
|
||||
first place (otherwise the \pytype{FSSpec} object for the file itself
|
||||
first place (otherwise the \class{FSSpec} object for the file itself
|
||||
is returned).
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{StandardGetFile}{\optional{type, \moreargs}}
|
||||
Present the user with a standard ``open input file''
|
||||
dialog. Optionally, you can pass up to four 4-character file types to limit
|
||||
the files the user can choose from. The function returns an \pytype{FSSpec}
|
||||
the files the user can choose from. The function returns an \class{FSSpec}
|
||||
object and a flag indicating that the user completed the dialog
|
||||
without cancelling.
|
||||
\end{funcdesc}
|
||||
|
@ -75,7 +76,7 @@ prompt which will be displayed at the top of the dialog.
|
|||
Present the user with a standard ``open output file''
|
||||
dialog. \var{prompt} is the prompt string, and the optional
|
||||
\var{default} argument initializes the output file name. The function
|
||||
returns an \pytype{FSSpec} object and a flag indicating that the user
|
||||
returns an \class{FSSpec} object and a flag indicating that the user
|
||||
completed the dialog without cancelling.
|
||||
\end{funcdesc}
|
||||
|
||||
|
@ -83,7 +84,7 @@ completed the dialog without cancelling.
|
|||
Present the user with a non-standard ``select a directory'' dialog. You
|
||||
have to first open the directory before clicking on the ``select current
|
||||
directory'' button. \var{prompt} is the prompt string which will be
|
||||
displayed at the top of the dialog. Return an \pytype{FSSpec} object and
|
||||
displayed at the top of the dialog. Return an \class{FSSpec} object and
|
||||
a success-indicator.
|
||||
\end{funcdesc}
|
||||
|
||||
|
@ -105,20 +106,21 @@ the trash or the Preferences folder. \var{where} is the disk to
|
|||
search, \var{which} is the 4-character string specifying which folder to
|
||||
locate. Setting \var{create} causes the folder to be created if it
|
||||
does not exist. Returns a \code{(\var{vrefnum}, \var{dirid})} tuple.
|
||||
|
||||
The constants for \var{where} and \var{which} can be obtained from the
|
||||
standard module \var{Carbon.Folders}.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{NewAliasMinimalFromFullPath}{pathname}
|
||||
Return a minimal \pytype{alias} object that points to the given file, which
|
||||
Return a minimal \class{alias} object that points to the given file, which
|
||||
must be specified as a full pathname. This is the only way to create an
|
||||
\pytype{Alias} pointing to a non-existing file.
|
||||
\class{Alias} pointing to a non-existing file.
|
||||
|
||||
The constants for \var{where} and \var{which} can be obtained from the
|
||||
standard module \var{MACFS}.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{FindApplication}{creator}
|
||||
Locate the application with 4-character creator code \var{creator}. The
|
||||
function returns an \pytype{FSSpec} object pointing to the application.
|
||||
function returns an \class{FSSpec} object pointing to the application.
|
||||
\end{funcdesc}
|
||||
|
||||
|
||||
|
@ -130,13 +132,13 @@ to other applications, for instance.
|
|||
\end{memberdesc}
|
||||
|
||||
\begin{methoddesc}[FSSpec]{as_pathname}{}
|
||||
Return the full pathname of the file described by the \pytype{FSSpec}
|
||||
Return the full pathname of the file described by the \class{FSSpec}
|
||||
object.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[FSSpec]{as_tuple}{}
|
||||
Return the \code{(\var{wdRefNum}, \var{parID}, \var{name})} tuple of
|
||||
the file described by the \pytype{FSSpec} object.
|
||||
the file described by the \class{FSSpec} object.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[FSSpec]{NewAlias}{\optional{file}}
|
||||
|
@ -158,12 +160,12 @@ Set the 4-character creator and type of the file.
|
|||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[FSSpec]{GetFInfo}{}
|
||||
Return a \pytype{FInfo} object describing the finder info for the file.
|
||||
Return a \class{FInfo} object describing the finder info for the file.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[FSSpec]{SetFInfo}{finfo}
|
||||
Set the finder info for the file to the values given as \var{finfo}
|
||||
(an \pytype{FInfo} object).
|
||||
(an \class{FInfo} object).
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[FSSpec]{GetDates}{}
|
||||
|
@ -188,7 +190,7 @@ or transmitting to other programs.
|
|||
\begin{methoddesc}[Alias]{Resolve}{\optional{file}}
|
||||
Resolve the alias. If the alias was created as a relative alias you
|
||||
should pass the file relative to which it is. Return the FSSpec for
|
||||
the file pointed to and a flag indicating whether the \pytype{Alias} object
|
||||
the file pointed to and a flag indicating whether the \class{Alias} object
|
||||
itself was modified during the search process. If the file does
|
||||
not exist but the path leading up to it does exist a valid fsspec
|
||||
is returned.
|
||||
|
@ -204,10 +206,10 @@ present a relative alias will be created.
|
|||
\end{methoddesc}
|
||||
|
||||
Note that it is currently not possible to directly manipulate a
|
||||
resource as an \pytype{Alias} object. Hence, after calling
|
||||
resource as an \class{Alias} object. Hence, after calling
|
||||
\method{Update()} or after \method{Resolve()} indicates that the alias
|
||||
has changed the Python program is responsible for getting the
|
||||
\member{data} value from the \pytype{Alias} object and modifying the
|
||||
\member{data} value from the \class{Alias} object and modifying the
|
||||
resource.
|
||||
|
||||
|
||||
|
|
|
@ -40,6 +40,8 @@ continues (by passing the event to the console window package, for instance).
|
|||
Call \function{SetEventHandler()} without a parameter to clear the
|
||||
event handler. Setting an event handler while one is already set is an
|
||||
error.
|
||||
|
||||
Availability: MacPython-OS9.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{SchedParams}{\optional{doint\optional{, evtmask\optional{,
|
||||
|
@ -63,6 +65,8 @@ background.
|
|||
|
||||
The most common use case is to call \code{SchedParams(0, 0)} to completely disable
|
||||
event handling in the interpreter mainloop.
|
||||
|
||||
Availability: MacPython-OS9.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{HandleEvent}{ev}
|
||||
|
@ -74,6 +78,8 @@ window-switching capability.
|
|||
|
||||
If you attempt to call this function from an event handler set through
|
||||
\function{SetEventHandler()} you will get an exception.
|
||||
|
||||
Availability: MacPython-OS9.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{GetErrorString}{errno}
|
||||
|
@ -87,12 +93,15 @@ on-screen, with the contents of the DLOG resource specified by
|
|||
screen. This function is useful if you want an applet to post a splash screen
|
||||
early in initialization without first having to load numerous
|
||||
extension modules.
|
||||
|
||||
Availability: MacPython-OS9.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{DebugStr}{message \optional{, object}}
|
||||
Drop to the low-level debugger with message \var{message}. The
|
||||
On Mac OS 9, drop to the low-level debugger with message \var{message}. The
|
||||
optional \var{object} argument is not used, but can easily be
|
||||
inspected from the debugger.
|
||||
inspected from the debugger. On Mac OS X the string is simply printed
|
||||
to stderr.
|
||||
|
||||
Note that you should use this function with extreme care: if no
|
||||
low-level debugger like MacsBug is installed this call will crash your
|
||||
|
@ -100,6 +109,27 @@ system. It is intended mainly for developers of Python extension
|
|||
modules.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{SysBeep}{}
|
||||
Ring the bell.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{GetTicks}{}
|
||||
Get the number of clock ticks (1/60th of a second) since system boot.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{GetCreatorAndType}{file}
|
||||
Return the file creator and file type as two four-character strings.
|
||||
The \var{file} parameter can be a pathname or an \code{FSSpec} or
|
||||
\code{FSRef} object.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{SetCreatorAndType}{file, creator, type}
|
||||
Set the file creator and file type.
|
||||
The \var{file} parameter can be a pathname or an \code{FSSpec} or
|
||||
\code{FSRef} object. \var{creator} and \var{type} must be four character
|
||||
strings.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{openrf}{name \optional{, mode}}
|
||||
Open the resource fork of a file. Arguments are the same as for the
|
||||
built-in function \function{open()}. The object returned has file-like
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
|
||||
|
||||
This module contains some convenience routines for file-manipulation
|
||||
on the Macintosh.
|
||||
on the Macintosh. All file parameters can be specified as
|
||||
pathnames, \class{FSRef} or \class{FSSpec} objects.
|
||||
|
||||
The \module{macostools} module defines the following functions:
|
||||
|
||||
|
||||
\begin{funcdesc}{copy}{src, dst\optional{, createpath\optional{, copytimes}}}
|
||||
Copy file \var{src} to \var{dst}. The files can be specified as
|
||||
pathnames or \pytype{FSSpec} objects. If \var{createpath} is non-zero
|
||||
Copy file \var{src} to \var{dst}. If \var{createpath} is non-zero
|
||||
the folders leading to \var{dst} are created if necessary.
|
||||
The method copies data and
|
||||
resource fork and some finder information (creator, type, flags) and
|
||||
|
@ -29,8 +29,7 @@ pathnames.
|
|||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{mkalias}{src, dst}
|
||||
Create a finder alias \var{dst} pointing to \var{src}. Both may be
|
||||
specified as pathnames or \pytype{FSSpec} objects.
|
||||
Create a finder alias \var{dst} pointing to \var{src}.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{touched}{dst}
|
||||
|
@ -62,7 +61,7 @@ functionality provided by the finder. They are implemented as wrappers
|
|||
around the AppleEvent\index{AppleEvents} interface to the finder.
|
||||
|
||||
All file and folder parameters can be specified either as full
|
||||
pathnames or as \pytype{FSSpec} objects.
|
||||
pathnames, or as \class{FSRef} or \class{FSSpec} objects.
|
||||
|
||||
The \module{findertools} module defines the following functions:
|
||||
|
||||
|
@ -74,20 +73,19 @@ in the correct application.
|
|||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{Print}{file}
|
||||
Tell the finder to print a file (again specified by full pathname or
|
||||
\pytype{FSSpec}). The behaviour is identical to selecting the file and using
|
||||
Tell the finder to print a file. The behaviour is identical to selecting the file and using
|
||||
the print command in the finder's file menu.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{copy}{file, destdir}
|
||||
Tell the finder to copy a file or folder \var{file} to folder
|
||||
\var{destdir}. The function returns an \pytype{Alias} object pointing to
|
||||
\var{destdir}. The function returns an \class{Alias} object pointing to
|
||||
the new file.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{move}{file, destdir}
|
||||
Tell the finder to move a file or folder \var{file} to folder
|
||||
\var{destdir}. The function returns an \pytype{Alias} object pointing to
|
||||
\var{destdir}. The function returns an \class{Alias} object pointing to
|
||||
the new file.
|
||||
\end{funcdesc}
|
||||
|
||||
|
|
|
@ -1,98 +0,0 @@
|
|||
\section{\module{macspeech} ---
|
||||
Interface to the Macintosh Speech Manager}
|
||||
|
||||
\declaremodule{builtin}{macspeech}
|
||||
\platform{Mac}
|
||||
\modulesynopsis{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
|
||||
the Speech Manager extension (version 1 and 2 have been tested) in
|
||||
your \file{Extensions} folder for this to work. The module does not
|
||||
provide full access to all features of the Speech Manager.
|
||||
|
||||
This module is only available on MacOS9 and earlier in classic PPC
|
||||
MacPython.
|
||||
|
||||
\begin{funcdesc}{Available}{}
|
||||
Test availability of the Speech Manager extension (and, on the
|
||||
PowerPC, the Speech Manager shared library). Return \code{0} or
|
||||
\code{1}.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{Version}{}
|
||||
Return the (integer) version number of the Speech Manager.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{SpeakString}{str}
|
||||
Utter the string \var{str} using the default voice,
|
||||
asynchronously. This aborts any speech that may still be active from
|
||||
prior \function{SpeakString()} invocations.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{Busy}{}
|
||||
Return the number of speech channels busy, system-wide.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{CountVoices}{}
|
||||
Return the number of different voices available.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{GetIndVoice}{num}
|
||||
Return a \pytype{Voice} object for voice number \var{num}.
|
||||
\end{funcdesc}
|
||||
|
||||
\subsection{Voice Objects}
|
||||
\label{voice-objects}
|
||||
|
||||
Voice objects contain the description of a voice. It is currently not
|
||||
yet possible to access the parameters of a voice.
|
||||
|
||||
\setindexsubitem{(voice object method)}
|
||||
|
||||
\begin{methoddesc}[Voice]{GetGender}{}
|
||||
Return the gender of the voice: \code{0} for male, \code{1} for female
|
||||
and \code{-1} for neuter.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[Voice]{NewChannel}{}
|
||||
Return a new Speech Channel object using this voice.
|
||||
\end{methoddesc}
|
||||
|
||||
\subsection{Speech Channel Objects}
|
||||
\label{speech-channel-objects}
|
||||
|
||||
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
|
||||
interrelated in some way, so that to make your Macintosh sing you will
|
||||
have to adjust both.
|
||||
|
||||
\begin{methoddesc}[Speech Channel]{SpeakText}{str}
|
||||
Start uttering the given string.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[Speech Channel]{Stop}{}
|
||||
Stop babbling.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[Speech Channel]{GetPitch}{}
|
||||
Return the current pitch of the channel, as a floating-point number.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[Speech Channel]{SetPitch}{pitch}
|
||||
Set the pitch of the channel.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[Speech Channel]{GetRate}{}
|
||||
Get the speech rate (utterances per minute) of the channel as a
|
||||
floating point number.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[Speech Channel]{SetRate}{rate}
|
||||
Set the speech rate of the channel.
|
||||
\end{methoddesc}
|
||||
|
|
@ -110,7 +110,85 @@ off.
|
|||
\versionadded{2.0}
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{AskFileForOpen}{
|
||||
\optional{message}
|
||||
\optional{, typeList}
|
||||
\optional{, defaultLocation}
|
||||
\optional{, defaultOptionFlags}
|
||||
\optional{, location}
|
||||
\optional{, clientName}
|
||||
\optional{, windowTitle}
|
||||
\optional{, actionButtonLabel}
|
||||
\optional{, cancelButtonLabel}
|
||||
\optional{, preferenceKey}
|
||||
\optional{, popupExtension}
|
||||
\optional{, eventProc}
|
||||
\optional{, previewProc}
|
||||
\optional{, filterProc}
|
||||
\optional{, wanted}
|
||||
}
|
||||
Post a dialog asking the user for a file to open, and return the file
|
||||
selected or \var{None} if the user cancelled.
|
||||
\var{message} is a text message to display,
|
||||
\var{typeList} is a list of 4-char filetypes allowable,
|
||||
\var{defaultLocation} is the pathname, FSSpec or FSRef of the folder
|
||||
to show initially,
|
||||
\var{location} is the \code{(x, y)} position on the screen where the
|
||||
dialog is shown,
|
||||
\var{actionButtonLabel} is a string to show in stead of ``Open'' in the
|
||||
OK button,
|
||||
\var{cancelButtonLabel} is a string to show in stead of ``Cancel'' in the
|
||||
cancel button,
|
||||
\var{wanted} is the type of value wanted as a return: \class{string},
|
||||
\class{unicode}, \class{FSSpec}, \class{FSRef} and subtypes thereof are
|
||||
acceptable.
|
||||
|
||||
For a description of the other arguments please see the Apple Navigation
|
||||
Services documentation and the EasyDialogs sourcecode.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{AskFileForSave}{
|
||||
\optional{message}
|
||||
\optional{, savedFileName}
|
||||
\optional{, defaultLocation}
|
||||
\optional{, defaultOptionFlags}
|
||||
\optional{, location}
|
||||
\optional{, clientName}
|
||||
\optional{, windowTitle}
|
||||
\optional{, actionButtonLabel}
|
||||
\optional{, cancelButtonLabel}
|
||||
\optional{, preferenceKey}
|
||||
\optional{, popupExtension}
|
||||
\optional{, fileType}
|
||||
\optional{, fileCreator}
|
||||
\optional{, eventProc}
|
||||
\optional{, wanted}
|
||||
}
|
||||
Post a dialog asking the user for a file to save to, and return the file
|
||||
selected or \var{None} if the user cancelled. \var{savedFileName} is the
|
||||
default for the file name to save to (the return value). See AskFileForOpen
|
||||
for a description of the other arguments.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{AskFolder}{
|
||||
\optional{message}
|
||||
\optional{, defaultLocation}
|
||||
\optional{, defaultOptionFlags}
|
||||
\optional{, location}
|
||||
\optional{, clientName}
|
||||
\optional{, windowTitle}
|
||||
\optional{, actionButtonLabel}
|
||||
\optional{, cancelButtonLabel}
|
||||
\optional{, preferenceKey}
|
||||
\optional{, popupExtension}
|
||||
\optional{, eventProc}
|
||||
\optional{, filterProc}
|
||||
\optional{, wanted}
|
||||
}
|
||||
Post a dialog asking the user to select a folder, and return the folder
|
||||
selected or \var{None} if the user cancelled. See AskFileForOpen
|
||||
for a description of the arguments.
|
||||
\end{funcdesc}
|
||||
|
||||
\subsection{ProgressBar Objects \label{progressbar-objects}}
|
||||
|
||||
|
|
|
@ -51,12 +51,10 @@ documented here:
|
|||
\localmoduletable
|
||||
|
||||
\input{libmac}
|
||||
\input{libctb}
|
||||
\input{libmacfs}
|
||||
\input{libmacic}
|
||||
\input{libmacos}
|
||||
\input{libmacostools}
|
||||
\input{libmacspeech}
|
||||
\input{libmacui}
|
||||
\input{libframework}
|
||||
\input{libminiae}
|
||||
|
|
|
@ -13,8 +13,9 @@ and return values, and for additional description you are referred to
|
|||
\citetitle[http://developer.apple.com/techpubs/macos8/mac8.html]{Inside
|
||||
Macintosh} or similar works.
|
||||
|
||||
These modules all live in a package called \module{Carbon}. Despite the
|
||||
name Carbon they are also available under classic PPC MacPython.
|
||||
These modules all live in a package called \module{Carbon}. Despite that name
|
||||
they are not all part of the Carbon framework: CF is really in the CoreFoundation
|
||||
framework and Qt is in the QuickTime framework.
|
||||
The normal use pattern is
|
||||
|
||||
\begin{verbatim}
|
||||
|
@ -36,6 +37,11 @@ in touch with \email{python-docs@python.org}.
|
|||
\platform{Mac}
|
||||
\modulesynopsis{Interface to the Apple Events toolbox.}
|
||||
|
||||
\section{\module{Carbon.AH} --- Apple Help}
|
||||
\declaremodule{standard}{Carbon.AH}
|
||||
\platform{Mac}
|
||||
\modulesynopsis{Interface to the Apple Help manager.}
|
||||
|
||||
|
||||
\section{\module{Carbon.App} --- Appearance Manager}
|
||||
\declaremodule{standard}{Carbon.App}
|
||||
|
@ -48,11 +54,21 @@ in touch with \email{python-docs@python.org}.
|
|||
\platform{Mac}
|
||||
\modulesynopsis{Interface to the Core Foundation.}
|
||||
|
||||
This module is only available under Carbon MacPython. The
|
||||
The
|
||||
\code{CFBase}, \code{CFArray}, \code{CFData}, \code{CFDictionary},
|
||||
\code{CFString} and \code{CFURL} objects are supported, some
|
||||
only partially.
|
||||
|
||||
\section{\module{Carbon.CG} --- Core Graphics}
|
||||
\declaremodule{standard}{Carbon.CG}
|
||||
\platform{Mac}
|
||||
\modulesynopsis{Interface to the Component Manager.}
|
||||
|
||||
\section{\module{Carbon.CarbonEvt} --- Carbon Event Manager}
|
||||
\declaremodule{standard}{Carbon.CaronEvt}
|
||||
\platform{Mac}
|
||||
\modulesynopsis{Interface to the Carbon Event Manager.}
|
||||
|
||||
\section{\module{Carbon.Cm} --- Component Manager}
|
||||
\declaremodule{standard}{Carbon.Cm}
|
||||
\platform{Mac}
|
||||
|
@ -74,7 +90,7 @@ only partially.
|
|||
\section{\module{Carbon.Evt} --- Event Manager}
|
||||
\declaremodule{standard}{Carbon.Evt}
|
||||
\platform{Mac}
|
||||
\modulesynopsis{Interface to the Event Manager.}
|
||||
\modulesynopsis{Interface to the classic Event Manager.}
|
||||
|
||||
|
||||
\section{\module{Carbon.Fm} --- Font Manager}
|
||||
|
@ -82,14 +98,16 @@ only partially.
|
|||
\platform{Mac}
|
||||
\modulesynopsis{Interface to the Font Manager.}
|
||||
|
||||
\section{\module{Carbon.Folder} --- Folder Manager}
|
||||
\declaremodule{standard}{Carbon.Folder}
|
||||
\platform{Mac}
|
||||
\modulesynopsis{Interface to the Folder Manager.}
|
||||
|
||||
|
||||
\section{\module{Carbon.Help} --- Help Manager}
|
||||
\declaremodule{standard}{Carbon.Help}
|
||||
\platform{Mac}
|
||||
\modulesynopsis{Interface to the Balloon Help Manager.}
|
||||
|
||||
This module is only available under MacOS9 and earlier in
|
||||
classic PPC MacPython.
|
||||
\modulesynopsis{Interface to the Carbon Help Manager.}
|
||||
|
||||
\section{\module{Carbon.List} --- List Manager}
|
||||
\declaremodule{standard}{Carbon.List}
|
||||
|
@ -132,9 +150,10 @@ classic PPC MacPython.
|
|||
\platform{Mac}
|
||||
\modulesynopsis{Interface to the Resource Manager and Handles.}
|
||||
|
||||
|
||||
\input{libscrap}
|
||||
|
||||
\section{\module{Carbon.Scrap} --- Scrap Manager}
|
||||
\declaremodule{standard}{Carbon.Scrap}
|
||||
\platform{Mac}
|
||||
\modulesynopsis{Interface to the Carbon Scrap Manager.}
|
||||
|
||||
\section{\module{Carbon.Snd} --- Sound Manager}
|
||||
\declaremodule{standard}{Carbon.Snd}
|
||||
|
|
|
@ -63,20 +63,6 @@ for new files.
|
|||
codes.
|
||||
|
||||
|
||||
\section{\module{macfsn} --- NavServices calls}
|
||||
\declaremodule{standard}{macfsn}
|
||||
\platform{Mac}
|
||||
\modulesynopsis{NavServices versions of StandardFile calls.}
|
||||
|
||||
|
||||
\module{macfsn} contains wrapper functions that have the same API as
|
||||
the \refmodule{macfs} StandardFile calls, but are implemented with
|
||||
Navigation Services through the
|
||||
\refmodule{Nav}\refbimodindex{Nav} module. Importing it will replace
|
||||
the methods in \refmodule{macfs}\refbimodindex{macfs} with these, if
|
||||
Navigation Services is available on your machine.
|
||||
|
||||
|
||||
\section{\module{macresource} --- Locate script resources}
|
||||
\declaremodule{standard}{macresource}
|
||||
\platform{Mac}
|
||||
|
@ -93,15 +79,6 @@ script is run under MacPython, as a MacPython applet or under OSX Python.
|
|||
|
||||
A low-level interface to Navigation Services.
|
||||
|
||||
|
||||
\section{\module{mactty} --- Serial line connections}
|
||||
\declaremodule{standard}{mactty}
|
||||
\platform{Mac}
|
||||
\modulesynopsis{Easy access serial to line connections.}
|
||||
|
||||
This module is only available under Mac OS 9 or earlier in classic PPC
|
||||
MacPython.
|
||||
|
||||
\section{\module{mkcwproject} --- Create CodeWarrior projects}
|
||||
\declaremodule{standard}{mkcwproject}
|
||||
\platform{Mac}
|
||||
|
|
|
@ -1,15 +1,21 @@
|
|||
\chapter{Using Python on the Macintosh \label{using}}
|
||||
\chapter{Using Python on a Mac OS 9 Macintosh \label{using}}
|
||||
\sectionauthor{Bob Savage}{bobsavage@mac.com}
|
||||
|
||||
Using Python on the Macintosh can seem like something completely
|
||||
Using Python on a Mac OS 9 Macintosh can seem like something completely
|
||||
different than using it on a \UNIX-like or Windows system. Most of the
|
||||
Python documentation, both the ``official'' documentation and
|
||||
published books, describe only how Python is used on these systems,
|
||||
causing confusion for the new user of MacPython. This chapter gives a
|
||||
causing confusion for the new user of MacPython-OS9. This chapter gives a
|
||||
brief introduction to the specifics of using Python on a Macintosh.
|
||||
|
||||
Note that this chapter is mainly relevant to Mac OS 9: MacPython-OSX
|
||||
is a superset of a normal unix Python. While MacPython-OS9 runs fine
|
||||
on Mac OS X it is a better choice to use MacPython-OSX there.
|
||||
|
||||
\section{Getting and Installing MacPython \label{getting}}
|
||||
The section on the IDE (see Section \ref{IDE}) is relevant to MacPython-OSX
|
||||
too.
|
||||
|
||||
\section{Getting and Installing MacPython-OS9 \label{getting}}
|
||||
|
||||
The most recent release version as well as possible newer experimental
|
||||
versions are best found at the MacPython page maintained by Jack
|
||||
|
@ -59,16 +65,6 @@ immediately upon completion, but your script assumes that if it prints
|
|||
something that text will stick around for a while. To fix this, see
|
||||
section \ref{defaults}.
|
||||
|
||||
\item
|
||||
After dropping the script onto the \program{PythonInterpreter}, a
|
||||
window appeared which said: ``File contains \code{\e r} characters
|
||||
(incorrect line endings?)''. That script probably originated on a
|
||||
\UNIX{} or Windows machine. You will need to change the line endings
|
||||
to the standard Mac usage. One way to do this is to open the file in
|
||||
\program{BBedit}
|
||||
(\url{http://www.barebones.com/products/bbedit_lite.html}) which can
|
||||
easily change the line endings between Mac, DOS, and \UNIX\ styles.
|
||||
|
||||
\item
|
||||
When you waved the script icon over the \program{PythonInterpreter},
|
||||
the \program{PythonInterpreter} icon did not hilight. Most likely the
|
||||
|
@ -118,7 +114,7 @@ Navigate into the folder of files you want to fix, and press the
|
|||
\section{Simulating command line arguments
|
||||
\label{argv}}
|
||||
|
||||
There are two ways to simulate command-line arguments with MacPython.
|
||||
There are two ways to simulate command-line arguments with MacPython-OS9.
|
||||
|
||||
\begin{enumerate}
|
||||
\item via Interpreter options
|
||||
|
@ -362,13 +358,3 @@ want to examine the objects that were created during your script.
|
|||
|
||||
%\section{CGI on the Mac with Python \label{CGI}}
|
||||
%**NEED INFO HERE**
|
||||
|
||||
\section{Mac OS X}
|
||||
|
||||
At the time of this writing Mac OS X had just been released as a
|
||||
Public Beta. Efforts are under way to bring MacPython to Mac OS X. The
|
||||
MacPython release \version{1.5.2c1} runs quite well within the
|
||||
``Classic'' environment. A ``Carbon'' port of the MacPython code is
|
||||
being prepared for release, and several people have made a command
|
||||
line version available to the ``Darwin'' layer (which is accessible
|
||||
via Terminal.app).
|
||||
|
|
Loading…
Reference in New Issue