Commit f75595c3 authored by Benjamin Peterson's avatar Benjamin Peterson

Remove the Mac modules

parent d30df1d8
:mod:`aepack` --- Conversion between Python variables and AppleEvent data containers
====================================================================================
.. module:: aepack
:platform: Mac
:synopsis: Conversion between Python variables and AppleEvent data containers.
.. sectionauthor:: Vincent Marchetti <vincem@en.com>
.. moduleauthor:: Jack Jansen
The :mod:`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
:class:`AEDesc`, defined in module :mod:`Carbon.AE`.
The :mod:`aepack` module defines the following functions:
.. function:: pack(x[, forcetype])
Returns an :class:`AEDesc` object containing a conversion of Python value x. If
*forcetype* is provided it specifies the descriptor type of the result.
Otherwise, a default mapping of Python types to Apple Event descriptor types is
used, as follows:
+-----------------+-----------------------------------+
| Python type | descriptor type |
+=================+===================================+
| :class:`FSSpec` | typeFSS |
+-----------------+-----------------------------------+
| :class:`FSRef` | typeFSRef |
+-----------------+-----------------------------------+
| :class:`Alias` | typeAlias |
+-----------------+-----------------------------------+
| integer | typeLong (32 bit integer) |
+-----------------+-----------------------------------+
| float | typeFloat (64 bit floating point) |
+-----------------+-----------------------------------+
| string | typeText |
+-----------------+-----------------------------------+
| unicode | typeUnicodeText |
+-----------------+-----------------------------------+
| list | typeAEList |
+-----------------+-----------------------------------+
| dictionary | typeAERecord |
+-----------------+-----------------------------------+
| instance | *see below* |
+-----------------+-----------------------------------+
If *x* is a Python instance then this function attempts to call an
:meth:`__aepack__` method. This method should return an :class:`AEDesc` object.
If the conversion *x* is not defined above, this function returns the Python
string representation of a value (the repr() function) encoded as a text
descriptor.
.. function:: unpack(x[, formodulename])
*x* must be an object of type :class:`AEDesc`. This function returns a Python
object representation of the data in the Apple Event descriptor *x*. Simple
AppleEvent data types (integer, text, float) are returned as their obvious
Python counterparts. Apple Event lists are returned as Python lists, and the
list elements are recursively unpacked. Object references (ex. ``line 3 of
document 1``) are returned as instances of :class:`aetypes.ObjectSpecifier`,
unless ``formodulename`` is specified. AppleEvent descriptors with descriptor
type typeFSS are returned as :class:`FSSpec` objects. AppleEvent record
descriptors are returned as Python dictionaries, with 4-character string keys
and elements recursively unpacked.
The optional ``formodulename`` argument is used by the stub packages generated
by :mod:`gensuitemodule`, and ensures that the OSA classes for object specifiers
are looked up in the correct module. This ensures that if, say, the Finder
returns an object specifier for a window you get an instance of
``Finder.Window`` and not a generic ``aetypes.Window``. The former knows about
all the properties and elements a window has in the Finder, while the latter
knows no such things.
.. seealso::
Module :mod:`Carbon.AE`
Built-in access to Apple Event Manager routines.
Module :mod:`aetypes`
Python definitions of codes for Apple Event descriptor types.
:mod:`aetools` --- OSA client support
=====================================
.. module:: aetools
:platform: Mac
:synopsis: Basic support for sending Apple Events
.. sectionauthor:: Jack Jansen <Jack.Jansen@cwi.nl>
.. moduleauthor:: Jack Jansen
The :mod:`aetools` module contains the basic functionality on which Python
AppleScript client support is built. It also imports and re-exports the core
functionality of the :mod:`aetypes` and :mod:`aepack` modules. The stub packages
generated by :mod:`gensuitemodule` import the relevant portions of
:mod:`aetools`, so usually you do not need to import it yourself. The exception
to this is when you cannot use a generated suite package and need lower-level
access to scripting.
The :mod:`aetools` module itself uses the AppleEvent support provided by the
:mod:`Carbon.AE` module. This has one drawback: you need access to the window
manager, see section :ref:`osx-gui-scripts` for details. This restriction may be
lifted in future releases.
The :mod:`aetools` module defines the following functions:
.. function:: packevent(ae, parameters, attributes)
Stores parameters and attributes in a pre-created ``Carbon.AE.AEDesc`` object.
``parameters`` and ``attributes`` are dictionaries mapping 4-character OSA
parameter keys to Python objects. The objects are packed using
``aepack.pack()``.
.. function:: unpackevent(ae[, formodulename])
Recursively unpacks a ``Carbon.AE.AEDesc`` event to Python objects. The function
returns the parameter dictionary and the attribute dictionary. The
``formodulename`` argument is used by generated stub packages to control where
AppleScript classes are looked up.
.. function:: keysubst(arguments, keydict)
Converts a Python keyword argument dictionary ``arguments`` to the format
required by ``packevent`` by replacing the keys, which are Python identifiers,
by the four-character OSA keys according to the mapping specified in
``keydict``. Used by the generated suite packages.
.. function:: enumsubst(arguments, key, edict)
If the ``arguments`` dictionary contains an entry for ``key`` convert the value
for that entry according to dictionary ``edict``. This converts human-readable
Python enumeration names to the OSA 4-character codes. Used by the generated
suite packages.
The :mod:`aetools` module defines the following class:
.. class:: TalkTo([signature=None, start=0, timeout=0])
Base class for the proxy used to talk to an application. ``signature`` overrides
the class attribute ``_signature`` (which is usually set by subclasses) and is
the 4-char creator code defining the application to talk to. ``start`` can be
set to true to enable running the application on class instantiation.
``timeout`` can be specified to change the default timeout used while waiting
for an AppleEvent reply.
.. method:: TalkTo._start()
Test whether the application is running, and attempt to start it if not.
.. method:: TalkTo.send(code, subcode[, parameters, attributes])
Create the AppleEvent ``Carbon.AE.AEDesc`` for the verb with the OSA designation
``code, subcode`` (which are the usual 4-character strings), pack the
``parameters`` and ``attributes`` into it, send it to the target application,
wait for the reply, unpack the reply with ``unpackevent`` and return the reply
appleevent, the unpacked return values as a dictionary and the return
attributes.
:mod:`aetypes` --- AppleEvent objects
=====================================
.. module:: aetypes
:platform: Mac
:synopsis: Python representation of the Apple Event Object Model.
.. sectionauthor:: Vincent Marchetti <vincem@en.com>
.. moduleauthor:: Jack Jansen
The :mod:`aetypes` defines classes used to represent Apple Event data
descriptors and Apple Event object specifiers.
Apple Event data is contained in descriptors, and these descriptors are typed.
For many descriptors the Python representation is simply the corresponding
Python type: ``typeText`` in OSA is a Python string, ``typeFloat`` is a float,
etc. For OSA types that have no direct Python counterpart this module declares
classes. Packing and unpacking instances of these classes is handled
automatically by :mod:`aepack`.
An object specifier is essentially an address of an object implemented in a
Apple Event server. An Apple Event specifier is used as the direct object for an
Apple Event or as the argument of an optional parameter. The :mod:`aetypes`
module contains the base classes for OSA classes and properties, which are used
by the packages generated by :mod:`gensuitemodule` to populate the classes and
properties in a given suite.
For reasons of backward compatibility, and for cases where you need to script an
application for which you have not generated the stub package this module also
contains object specifiers for a number of common OSA classes such as
``Document``, ``Window``, ``Character``, etc.
The :mod:`AEObjects` module defines the following classes to represent Apple
Event descriptor data:
.. class:: Unknown(type, data)
The representation of OSA descriptor data for which the :mod:`aepack` and
:mod:`aetypes` modules have no support, i.e. anything that is not represented by
the other classes here and that is not equivalent to a simple Python value.
.. class:: Enum(enum)
An enumeration value with the given 4-character string value.
.. class:: InsertionLoc(of, pos)
Position ``pos`` in object ``of``.
.. class:: Boolean(bool)
A boolean.
.. class:: StyledText(style, text)
Text with style information (font, face, etc) included.
.. class:: AEText(script, style, text)
Text with script system and style information included.
.. class:: IntlText(script, language, text)
Text with script system and language information included.
.. class:: IntlWritingCode(script, language)
Script system and language information.
.. class:: QDPoint(v, h)
A quickdraw point.
.. class:: QDRectangle(v0, h0, v1, h1)
A quickdraw rectangle.
.. class:: RGBColor(r, g, b)
A color.
.. class:: Type(type)
An OSA type value with the given 4-character name.
.. class:: Keyword(name)
An OSA keyword with the given 4-character name.
.. class:: Range(start, stop)
A range.
.. class:: Ordinal(abso)
Non-numeric absolute positions, such as ``"firs"``, first, or ``"midd"``,
middle.
.. class:: Logical(logc, term)
The logical expression of applying operator ``logc`` to ``term``.
.. class:: Comparison(obj1, relo, obj2)
The comparison ``relo`` of ``obj1`` to ``obj2``.
The following classes are used as base classes by the generated stub packages to
represent AppleScript classes and properties in Python:
.. class:: ComponentItem(which[, fr])
Abstract baseclass for an OSA class. The subclass should set the class attribute
``want`` to the 4-character OSA class code. Instances of subclasses of this
class are equivalent to AppleScript Object Specifiers. Upon instantiation you
should pass a selector in ``which``, and optionally a parent object in ``fr``.
.. class:: NProperty(fr)
Abstract baseclass for an OSA property. The subclass should set the class
attributes ``want`` and ``which`` to designate which property we are talking
about. Instances of subclasses of this class are Object Specifiers.
.. class:: ObjectSpecifier(want, form, seld[, fr])
Base class of ``ComponentItem`` and ``NProperty``, a general OSA Object
Specifier. See the Apple Open Scripting Architecture documentation for the
parameters. Note that this class is not abstract.
:mod:`autoGIL` --- Global Interpreter Lock handling in event loops
==================================================================
.. module:: autoGIL
:platform: Mac
:synopsis: Global Interpreter Lock handling in event loops.
.. moduleauthor:: Just van Rossum <just@letterror.com>
The :mod:`autoGIL` module provides a function :func:`installAutoGIL` that
automatically locks and unlocks Python's :term:`Global Interpreter Lock` when
running an event loop.
.. exception:: AutoGILError
Raised if the observer callback cannot be installed, for example because the
current thread does not have a run loop.
.. function:: installAutoGIL()
Install an observer callback in the event loop (CFRunLoop) for the current
thread, that will lock and unlock the Global Interpreter Lock (GIL) at
appropriate times, allowing other Python threads to run while the event loop is
idle.
Availability: OSX 10.1 or later.
...@@ -7,9 +7,7 @@ ...@@ -7,9 +7,7 @@
This module encodes and decodes files in binhex4 format, a format allowing This module encodes and decodes files in binhex4 format, a format allowing
representation of Macintosh files in ASCII. On the Macintosh, both forks of a representation of Macintosh files in ASCII. Only the data fork is handled.
file and the finder information are encoded (or decoded), on other platforms
only the data fork is handled.
The :mod:`binhex` module defines the following functions: The :mod:`binhex` module defines the following functions:
......
.. _toolbox:
*********************
MacOS Toolbox Modules
*********************
There are a set of modules that provide interfaces to various MacOS toolboxes.
If applicable the module will define a number of Python objects for the various
structures declared by the toolbox, and operations will be implemented as
methods of the object. Other operations will be implemented as functions in the
module. Not all operations possible in C will also be possible in Python
(callbacks are often a problem), and parameters will occasionally be different
in Python (input and output buffers, especially). All methods and functions
have a :attr:`__doc__` string describing their arguments and return values, and
for additional description you are referred to `Inside Macintosh
<http://developer.apple.com/documentation/macos8/mac8.html>`_ or similar works.
These modules all live in a package called :mod:`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 ::
from Carbon import AE
**Warning!** These modules are not yet documented. If you wish to contribute
documentation of any of these modules, please get in touch with docs@python.org.
:mod:`Carbon.AE` --- Apple Events
=================================
.. module:: Carbon.AE
:platform: Mac
:synopsis: Interface to the Apple Events toolbox.
:mod:`Carbon.AH` --- Apple Help
===============================
.. module:: Carbon.AH
:platform: Mac
:synopsis: Interface to the Apple Help manager.
:mod:`Carbon.App` --- Appearance Manager
========================================
.. module:: Carbon.App
:platform: Mac
:synopsis: Interface to the Appearance Manager.
:mod:`Carbon.CF` --- Core Foundation
====================================
.. module:: Carbon.CF
:platform: Mac
:synopsis: Interface to the Core Foundation.
The ``CFBase``, ``CFArray``, ``CFData``, ``CFDictionary``, ``CFString`` and
``CFURL`` objects are supported, some only partially.
:mod:`Carbon.CG` --- Core Graphics
==================================
.. module:: Carbon.CG
:platform: Mac
:synopsis: Interface to Core Graphics.
:mod:`Carbon.CarbonEvt` --- Carbon Event Manager
================================================
.. module:: Carbon.CarbonEvt
:platform: Mac
:synopsis: Interface to the Carbon Event Manager.
:mod:`Carbon.Cm` --- Component Manager
======================================
.. module:: Carbon.Cm
:platform: Mac
:synopsis: Interface to the Component Manager.
:mod:`Carbon.Ctl` --- Control Manager
=====================================
.. module:: Carbon.Ctl
:platform: Mac
:synopsis: Interface to the Control Manager.
:mod:`Carbon.Dlg` --- Dialog Manager
====================================
.. module:: Carbon.Dlg
:platform: Mac
:synopsis: Interface to the Dialog Manager.
:mod:`Carbon.Evt` --- Event Manager
===================================
.. module:: Carbon.Evt
:platform: Mac
:synopsis: Interface to the classic Event Manager.
:mod:`Carbon.Fm` --- Font Manager
=================================
.. module:: Carbon.Fm
:platform: Mac
:synopsis: Interface to the Font Manager.
:mod:`Carbon.Folder` --- Folder Manager
=======================================
.. module:: Carbon.Folder
:platform: Mac
:synopsis: Interface to the Folder Manager.
:mod:`Carbon.Help` --- Help Manager
===================================
.. module:: Carbon.Help
:platform: Mac
:synopsis: Interface to the Carbon Help Manager.
:mod:`Carbon.List` --- List Manager
===================================
.. module:: Carbon.List
:platform: Mac
:synopsis: Interface to the List Manager.
:mod:`Carbon.Menu` --- Menu Manager
===================================
.. module:: Carbon.Menu
:platform: Mac
:synopsis: Interface to the Menu Manager.
:mod:`Carbon.Mlte` --- MultiLingual Text Editor
===============================================
.. module:: Carbon.Mlte
:platform: Mac
:synopsis: Interface to the MultiLingual Text Editor.
:mod:`Carbon.Qd` --- QuickDraw
==============================
.. module:: Carbon.Qd
:platform: Mac
:synopsis: Interface to the QuickDraw toolbox.
:mod:`Carbon.Qdoffs` --- QuickDraw Offscreen
============================================
.. module:: Carbon.Qdoffs
:platform: Mac
:synopsis: Interface to the QuickDraw Offscreen APIs.
:mod:`Carbon.Qt` --- QuickTime
==============================
.. module:: Carbon.Qt
:platform: Mac
:synopsis: Interface to the QuickTime toolbox.
:mod:`Carbon.Res` --- Resource Manager and Handles
==================================================
.. module:: Carbon.Res
:platform: Mac
:synopsis: Interface to the Resource Manager and Handles.
:mod:`Carbon.Scrap` --- Scrap Manager
=====================================
.. module:: Carbon.Scrap
:platform: Mac
:synopsis: The Scrap Manager provides basic services for implementing cut & paste and
clipboard operations.
This module is only fully available on MacOS9 and earlier under classic PPC
MacPython. Very limited functionality is available under Carbon MacPython.
.. index:: single: Scrap Manager
The Scrap Manager supports the simplest form of cut & paste operations on the
Macintosh. It can be use for both inter- and intra-application clipboard
operations.
The :mod:`Scrap` module provides low-level access to the functions of the Scrap
Manager. It contains the following functions:
.. function:: InfoScrap()
Return current information about the scrap. The information is encoded as a
tuple containing the fields ``(size, handle, count, state, path)``.
+----------+---------------------------------------------+
| Field | Meaning |
+==========+=============================================+
| *size* | Size of the scrap in bytes. |
+----------+---------------------------------------------+
| *handle* | Resource object representing the scrap. |
+----------+---------------------------------------------+
| *count* | Serial number of the scrap contents. |
+----------+---------------------------------------------+
| *state* | Integer; positive if in memory, ``0`` if on |
| | disk, negative if uninitialized. |
+----------+---------------------------------------------+
| *path* | Filename of the scrap when stored on disk. |
+----------+---------------------------------------------+
.. seealso::
`Scrap Manager <http://developer.apple.com/documentation/mac/MoreToolbox/MoreToolbox-109.html>`_
Apple's documentation for the Scrap Manager gives a lot of useful information
about using the Scrap Manager in applications.
:mod:`Carbon.Snd` --- Sound Manager
===================================
.. module:: Carbon.Snd
:platform: Mac
:synopsis: Interface to the Sound Manager.
:mod:`Carbon.TE` --- TextEdit
=============================
.. module:: Carbon.TE
:platform: Mac
:synopsis: Interface to TextEdit.
:mod:`Carbon.Win` --- Window Manager
====================================
.. module:: Carbon.Win
:platform: Mac
:synopsis: Interface to the Window Manager.
:mod:`ColorPicker` --- Color selection dialog
=============================================
.. module:: ColorPicker
:platform: Mac
:synopsis: Interface to the standard color selection dialog.
.. moduleauthor:: Just van Rossum <just@letterror.com>
.. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
The :mod:`ColorPicker` module provides access to the standard color picker
dialog.
.. function:: GetColor(prompt, rgb)
Show a standard color selection dialog and allow the user to select a color.
The user is given instruction by the *prompt* string, and the default color is
set to *rgb*. *rgb* must be a tuple giving the red, green, and blue components
of the color. :func:`GetColor` returns a tuple giving the user's selected color
and a flag indicating whether they accepted the selection of cancelled.
:mod:`EasyDialogs` --- Basic Macintosh dialogs
==============================================
.. module:: EasyDialogs
:platform: Mac
:synopsis: Basic Macintosh dialogs.
The :mod:`EasyDialogs` module contains some simple dialogs for the Macintosh.
All routines take an optional resource ID parameter *id* with which one can
override the :const:`DLOG` resource used for the dialog, provided that the
dialog items correspond (both type and item number) to those in the default
:const:`DLOG` resource. See source code for details.
The :mod:`EasyDialogs` module defines the following functions:
.. function:: Message(str[, id[, ok]])
Displays a modal dialog with the message text *str*, which should be at most 255
characters long. The button text defaults to "OK", but is set to the string
argument *ok* if the latter is supplied. Control is returned when the user
clicks the "OK" button.
.. function:: AskString(prompt[, default[, id[, ok[, cancel]]]])
Asks the user to input a string value via a modal dialog. *prompt* is the prompt
message, and the optional *default* supplies the initial value for the string
(otherwise ``""`` is used). The text of the "OK" and "Cancel" buttons can be
changed with the *ok* and *cancel* arguments. All strings can be at most 255
bytes long. :func:`AskString` returns the string entered or :const:`None` in
case the user cancelled.
.. function:: AskPassword(prompt[, default[, id[, ok[, cancel]]]])
Asks the user to input a string value via a modal dialog. Like
:func:`AskString`, but with the text shown as bullets. The arguments have the
same meaning as for :func:`AskString`.
.. function:: AskYesNoCancel(question[, default[, yes[, no[, cancel[, id]]]]])
Presents a dialog with prompt *question* and three buttons labelled "Yes", "No",
and "Cancel". Returns ``1`` for "Yes", ``0`` for "No" and ``-1`` for "Cancel".
The value of *default* (or ``0`` if *default* is not supplied) is returned when
the :kbd:`RETURN` key is pressed. The text of the buttons can be changed with
the *yes*, *no*, and *cancel* arguments; to prevent a button from appearing,
supply ``""`` for the corresponding argument.
.. function:: ProgressBar([title[, maxval[, label[, id]]]])
Displays a modeless progress-bar dialog. This is the constructor for the
:class:`ProgressBar` class described below. *title* is the text string displayed
(default "Working..."), *maxval* is the value at which progress is complete
(default ``0``, indicating that an indeterminate amount of work remains to be
done), and *label* is the text that is displayed above the progress bar itself.
.. function:: GetArgv([optionlist[ commandlist[, addoldfile[, addnewfile[, addfolder[, id]]]]]])
Displays a dialog which aids the user in constructing a command-line argument
list. Returns the list in ``sys.argv`` format, suitable for passing as an
argument to :func:`getopt.getopt`. *addoldfile*, *addnewfile*, and *addfolder*
are boolean arguments. When nonzero, they enable the user to insert into the
command line paths to an existing file, a (possibly) not-yet-existent file, and
a folder, respectively. (Note: Option arguments must appear in the command line
before file and folder arguments in order to be recognized by
:func:`getopt.getopt`.) Arguments containing spaces can be specified by
enclosing them within single or double quotes. A :exc:`SystemExit` exception is
raised if the user presses the "Cancel" button.
*optionlist* is a list that determines a popup menu from which the allowed
options are selected. Its items can take one of two forms: *optstr* or
``(optstr, descr)``. When present, *descr* is a short descriptive string that
is displayed in the dialog while this option is selected in the popup menu. The
correspondence between *optstr*\s and command-line arguments is:
+----------------------+------------------------------------------+
| *optstr* format | Command-line format |
+======================+==========================================+
| ``x`` | :option:`-x` (short option) |
+----------------------+------------------------------------------+
| ``x:`` or ``x=`` | :option:`-x` (short option with value) |
+----------------------+------------------------------------------+
| ``xyz`` | :option:`--xyz` (long option) |
+----------------------+------------------------------------------+
| ``xyz:`` or ``xyz=`` | :option:`--xyz` (long option with value) |
+----------------------+------------------------------------------+
*commandlist* is a list of items of the form *cmdstr* or ``(cmdstr, descr)``,
where *descr* is as above. The *cmdstr*s will appear in a popup menu. When
chosen, the text of *cmdstr* will be appended to the command line as is, except
that a trailing ``':'`` or ``'='`` (if present) will be trimmed off.
.. function:: AskFileForOpen( [message] [, typeList] [, defaultLocation] [, defaultOptionFlags] [, location] [, clientName] [, windowTitle] [, actionButtonLabel] [, cancelButtonLabel] [, preferenceKey] [, popupExtension] [, eventProc] [, previewProc] [, filterProc] [, wanted] )
Post a dialog asking the user for a file to open, and return the file selected
or :const:`None` if the user cancelled. *message* is a text message to display,
*typeList* is a list of 4-char filetypes allowable, *defaultLocation* is the
pathname, :class:`FSSpec` or :class:`FSRef` of the folder to show initially,
*location* is the ``(x, y)`` position on the screen where the dialog is shown,
*actionButtonLabel* is a string to show instead of "Open" in the OK button,
*cancelButtonLabel* is a string to show instead of "Cancel" in the cancel
button, *wanted* is the type of value wanted as a return: :class:`str`,
:class:`FSSpec`, :class:`FSRef` and subtypes thereof are
acceptable.
.. index:: single: Navigation Services
For a description of the other arguments please see the Apple Navigation
Services documentation and the :mod:`EasyDialogs` source code.
.. function:: AskFileForSave( [message] [, savedFileName] [, defaultLocation] [, defaultOptionFlags] [, location] [, clientName] [, windowTitle] [, actionButtonLabel] [, cancelButtonLabel] [, preferenceKey] [, popupExtension] [, fileType] [, fileCreator] [, eventProc] [, wanted] )
Post a dialog asking the user for a file to save to, and return the file
selected or :const:`None` if the user cancelled. *savedFileName* is the default
for the file name to save to (the return value). See :func:`AskFileForOpen` for
a description of the other arguments.
.. function:: AskFolder( [message] [, defaultLocation] [, defaultOptionFlags] [, location] [, clientName] [, windowTitle] [, actionButtonLabel] [, cancelButtonLabel] [, preferenceKey] [, popupExtension] [, eventProc] [, filterProc] [, wanted] )
Post a dialog asking the user to select a folder, and return the folder selected
or :const:`None` if the user cancelled. See :func:`AskFileForOpen` for a
description of the arguments.
.. seealso::
`Navigation Services Reference <http://developer.apple.com/documentation/Carbon/Reference/Navigation_Services_Ref/>`_
Programmer's reference documentation for the Navigation Services, a part of the
Carbon framework.
.. _progressbar-objects:
ProgressBar Objects
-------------------
:class:`ProgressBar` objects provide support for modeless progress-bar dialogs.
Both determinate (thermometer style) and indeterminate (barber-pole style)
progress bars are supported. The bar will be determinate if its maximum value
is greater than zero; otherwise it will be indeterminate.
The dialog is displayed immediately after creation. If the dialog's "Cancel"
button is pressed, or if :kbd:`Cmd-.` or :kbd:`ESC` is typed, the dialog window
is hidden and :exc:`KeyboardInterrupt` is raised (but note that this response
does not occur until the progress bar is next updated, typically via a call to
:meth:`inc` or :meth:`set`). Otherwise, the bar remains visible until the
:class:`ProgressBar` object is discarded.
:class:`ProgressBar` objects possess the following attributes and methods:
.. attribute:: ProgressBar.curval
The current value (of type integer) of the progress bar. The
normal access methods coerce :attr:`curval` between ``0`` and :attr:`maxval`.
This attribute should not be altered directly.
.. attribute:: ProgressBar.maxval
The maximum value (of type integer) of the progress bar; the
progress bar (thermometer style) is full when :attr:`curval` equals
:attr:`maxval`. If :attr:`maxval` is ``0``, the bar will be indeterminate
(barber-pole). This attribute should not be altered directly.
.. method:: ProgressBar.title([newstr])
Sets the text in the title bar of the progress dialog to *newstr*.
.. method:: ProgressBar.label([newstr])
Sets the text in the progress box of the progress dialog to *newstr*.
.. method:: ProgressBar.set(value[, max])
Sets the progress bar's :attr:`curval` to *value*, and also :attr:`maxval` to
*max* if the latter is provided. *value* is first coerced between 0 and
:attr:`maxval`. The thermometer bar is updated to reflect the changes,
including a change from indeterminate to determinate or vice versa.
.. method:: ProgressBar.inc([n])
Increments the progress bar's :attr:`curval` by *n*, or by ``1`` if *n* is not
provided. (Note that *n* may be negative, in which case the effect is a
decrement.) The progress bar is updated to reflect the change. If the bar is
indeterminate, this causes one "spin" of the barber pole. The resulting
:attr:`curval` is coerced between 0 and :attr:`maxval` if incrementing causes it
to fall outside this range.
This diff is collapsed.
:mod:`ic` --- Access to the Mac OS X Internet Config
====================================================
.. module:: ic
:platform: Mac
:synopsis: Access to the Mac OS X Internet Config.
This module provides access to various internet-related preferences set through
:program:`System Preferences` or the :program:`Finder`.
.. index:: module: icglue
There is a low-level companion module :mod:`icglue` which provides the basic
Internet Config access functionality. This low-level module is not documented,
but the docstrings of the routines document the parameters and the routine names
are the same as for the Pascal or C API to Internet Config, so the standard IC
programmers' documentation can be used if this module is needed.
The :mod:`ic` module defines the :exc:`error` exception and symbolic names for
all error codes Internet Config can produce; see the source for details.
.. exception:: error
Exception raised on errors in the :mod:`ic` module.
The :mod:`ic` module defines the following class and function:
.. class:: IC([signature[, ic]])
Create an Internet Config object. The signature is a 4-character creator code of
the current application (default ``'Pyth'``) which may influence some of ICs
settings. The optional *ic* argument is a low-level ``icglue.icinstance``
created beforehand, this may be useful if you want to get preferences from a
different config file, etc.
.. function:: launchurl(url[, hint])
parseurl(data[, start[, end[, hint]]])
mapfile(file)
maptypecreator(type, creator[, filename])
settypecreator(file)
These functions are "shortcuts" to the methods of the same name, described
below.
IC Objects
----------
:class:`IC` objects have a mapping interface, hence to obtain the mail address
you simply get ``ic['MailAddress']``. Assignment also works, and changes the
option in the configuration file.
The module knows about various datatypes, and converts the internal IC
representation to a "logical" Python data structure. Running the :mod:`ic`
module standalone will run a test program that lists all keys and values in your
IC database, this will have to serve as documentation.
If the module does not know how to represent the data it returns an instance of
the ``ICOpaqueData`` type, with the raw data in its :attr:`data` attribute.
Objects of this type are also acceptable values for assignment.
Besides the dictionary interface, :class:`IC` objects have the following
methods:
.. method:: IC.launchurl(url[, hint])
Parse the given URL, launch the correct application and pass it the URL. The
optional *hint* can be a scheme name such as ``'mailto:'``, in which case
incomplete URLs are completed with this scheme. If *hint* is not provided,
incomplete URLs are invalid.
.. method:: IC.parseurl(data[, start[, end[, hint]]])
Find an URL somewhere in *data* and return start position, end position and the
URL. The optional *start* and *end* can be used to limit the search, so for
instance if a user clicks in a long text field you can pass the whole text field
and the click-position in *start* and this routine will return the whole URL in
which the user clicked. As above, *hint* is an optional scheme used to complete
incomplete URLs.
.. method:: IC.mapfile(file)
Return the mapping entry for the given *file*, which can be passed as either a
filename or an :func:`FSSpec` result, and which need not exist.
The mapping entry is returned as a tuple ``(version, type, creator, postcreator,
flags, extension, appname, postappname, mimetype, entryname)``, where *version*
is the entry version number, *type* is the 4-character filetype, *creator* is
the 4-character creator type, *postcreator* is the 4-character creator code of
an optional application to post-process the file after downloading, *flags* are
various bits specifying whether to transfer in binary or ascii and such,
*extension* is the filename extension for this file type, *appname* is the
printable name of the application to which this file belongs, *postappname* is
the name of the postprocessing application, *mimetype* is the MIME type of this
file and *entryname* is the name of this entry.
.. method:: IC.maptypecreator(type, creator[, filename])
Return the mapping entry for files with given 4-character *type* and *creator*
codes. The optional *filename* may be specified to further help finding the
correct entry (if the creator code is ``'????'``, for instance).
The mapping entry is returned in the same format as for *mapfile*.
.. method:: IC.settypecreator(file)
Given an existing *file*, specified either as a filename or as an :func:`FSSpec`
result, set its creator and type correctly based on its extension. The finder
is told about the change, so the finder icon will be updated quickly.
...@@ -73,6 +73,4 @@ the `Python Package Index <http://pypi.python.org/pypi>`_. ...@@ -73,6 +73,4 @@ the `Python Package Index <http://pypi.python.org/pypi>`_.
misc.rst misc.rst
windows.rst windows.rst
unix.rst unix.rst
mac.rst
macosa.rst
undoc.rst undoc.rst
.. _mac-specific-services:
*************************
MacOS X specific services
*************************
This chapter describes modules that are only available on the Mac OS X platform.
See the chapters :ref:`mac-scripting` and :ref:`undoc-mac-modules` for more
modules, and the HOWTO :ref:`using-on-mac` for a general introduction to
Mac-specific Python programming.
.. toctree::
ic.rst
macos.rst
macostools.rst
easydialogs.rst
framework.rst
autogil.rst
carbon.rst
colorpicker.rst
:mod:`MacOS` --- Access to Mac OS interpreter features
======================================================
.. module:: MacOS
:platform: Mac
:synopsis: Access to Mac OS-specific interpreter features.
This module provides access to MacOS specific functionality in the Python
interpreter, such as how the interpreter eventloop functions and the like. Use
with care.
Note the capitalization of the module name; this is a historical artifact.
.. data:: runtimemodel
Always ``'macho'``.
.. data:: linkmodel
The way the interpreter has been linked. As extension modules may be
incompatible between linking models, packages could use this information to give
more decent error messages. The value is one of ``'static'`` for a statically
linked Python, ``'framework'`` for Python in a Mac OS X framework, ``'shared'``
for Python in a standard Unix shared library. Older Pythons could also have the
value ``'cfm'`` for Mac OS 9-compatible Python.
.. exception:: Error
.. index:: module: macerrors
This exception is raised on MacOS generated errors, either from functions in
this module or from other mac-specific modules like the toolbox interfaces. The
arguments are the integer error code (the :cdata:`OSErr` value) and a textual
description of the error code. Symbolic names for all known error codes are
defined in the standard module :mod:`macerrors`.
.. function:: GetErrorString(errno)
Return the textual description of MacOS error code *errno*.
.. function:: DebugStr(message [, object])
On Mac OS X the string is simply printed to stderr (on older Mac OS systems more
elaborate functionality was available), but it provides a convenient location to
attach a breakpoint in a low-level debugger like :program:`gdb`.
.. function:: SysBeep()
Ring the bell.
.. function:: GetTicks()
Get the number of clock ticks (1/60th of a second) since system boot.
.. function:: GetCreatorAndType(file)
Return the file creator and file type as two four-character strings. The *file*
parameter can be a pathname or an ``FSSpec`` or ``FSRef`` object.
.. function:: SetCreatorAndType(file, creator, type)
Set the file creator and file type. The *file* parameter can be a pathname or an
``FSSpec`` or ``FSRef`` object. *creator* and *type* must be four character
strings.
.. function:: openrf(name [, mode])
Open the resource fork of a file. Arguments are the same as for the built-in
function :func:`open`. The object returned has file-like semantics, but it is
not a Python file object, so there may be subtle differences.
.. function:: WMAvailable()
Checks whether the current process has access to the window manager. The method
will return ``False`` if the window manager is not available, for instance when
running on Mac OS X Server or when logged in via ssh, or when the current
interpreter is not running from a fullblown application bundle. A script runs
from an application bundle either when it has been started with
:program:`pythonw` instead of :program:`python` or when running as an applet.
.. _mac-scripting:
*********************
MacPython OSA Modules
*********************
This chapter describes the current implementation of the Open Scripting
Architecure (OSA, also commonly referred to as AppleScript) for Python, allowing
you to control scriptable applications from your Python program, and with a
fairly pythonic interface. Development on this set of modules has stopped, and a
replacement is expected for Python 2.5.
For a description of the various components of AppleScript and OSA, and to get
an understanding of the architecture and terminology, you should read Apple's
documentation. The "Applescript Language Guide" explains the conceptual model
and the terminology, and documents the standard suite. The "Open Scripting
Architecture" document explains how to use OSA from an application programmers
point of view. In the Apple Help Viewer these books are located in the Developer
Documentation, Core Technologies section.
As an example of scripting an application, the following piece of AppleScript
will get the name of the frontmost :program:`Finder` window and print it::
tell application "Finder"
get name of window 1
end tell
In Python, the following code fragment will do the same::
import Finder
f = Finder.Finder()
print(f.get(f.window(1).name))
As distributed the Python library includes packages that implement the standard
suites, plus packages that interface to a small number of common applications.
To send AppleEvents to an application you must first create the Python package
interfacing to the terminology of the application (what :program:`Script Editor`
calls the "Dictionary"). This can be done from within the :program:`PythonIDE`
or by running the :file:`gensuitemodule.py` module as a standalone program from
the command line.
The generated output is a package with a number of modules, one for every suite
used in the program plus an :mod:`__init__` module to glue it all together. The
Python inheritance graph follows the AppleScript inheritance graph, so if a
program's dictionary specifies that it includes support for the Standard Suite,
but extends one or two verbs with extra arguments then the output suite will
contain a module :mod:`Standard_Suite` that imports and re-exports everything
from :mod:`StdSuites.Standard_Suite` but overrides the methods that have extra
functionality. The output of :mod:`gensuitemodule` is pretty readable, and
contains the documentation that was in the original AppleScript dictionary in
Python docstrings, so reading it is a good source of documentation.
The output package implements a main class with the same name as the package
which contains all the AppleScript verbs as methods, with the direct object as
the first argument and all optional parameters as keyword arguments. AppleScript
classes are also implemented as Python classes, as are comparisons and all the
other thingies.
The main Python class implementing the verbs also allows access to the
properties and elements declared in the AppleScript class "application". In the
current release that is as far as the object orientation goes, so in the example
above we need to use ``f.get(f.window(1).name)`` instead of the more Pythonic
``f.window(1).name.get()``.
If an AppleScript identifier is not a Python identifier the name is mangled
according to a small number of rules:
* spaces are replaced with underscores
* other non-alphanumeric characters are replaced with ``_xx_`` where ``xx`` is
the hexadecimal character value
* any Python reserved word gets an underscore appended
Python also has support for creating scriptable applications in Python, but The
following modules are relevant to MacPython AppleScript support:
.. toctree::
gensuitemodule.rst
aetools.rst
aepack.rst
aetypes.rst
miniaeframe.rst
In addition, support modules have been pre-generated for :mod:`Finder`,
:mod:`Terminal`, :mod:`Explorer`, :mod:`Netscape`, :mod:`CodeWarrior`,
:mod:`SystemEvents` and :mod:`StdSuites`.
:mod:`macostools` --- Convenience routines for file manipulation
================================================================
.. module:: macostools
:platform: Mac
:synopsis: Convenience routines for file manipulation.
This module contains some convenience routines for file-manipulation on the
Macintosh. All file parameters can be specified as pathnames, :class:`FSRef` or
:class:`FSSpec` objects. This module expects a filesystem which supports forked
files, so it should not be used on UFS partitions.
The :mod:`macostools` module defines the following functions:
.. function:: copy(src, dst[, createpath[, copytimes]])
Copy file *src* to *dst*. If *createpath* is non-zero the folders leading to
*dst* are created if necessary. The method copies data and resource fork and
some finder information (creator, type, flags) and optionally the creation,
modification and backup times (default is to copy them). Custom icons, comments
and icon position are not copied.
.. function:: copytree(src, dst)
Recursively copy a file tree from *src* to *dst*, creating folders as needed.
*src* and *dst* should be specified as pathnames.
.. function:: mkalias(src, dst)
Create a finder alias *dst* pointing to *src*.
.. function:: touched(dst)
Tell the finder that some bits of finder-information such as creator or type for
file *dst* has changed. The file can be specified by pathname or fsspec. This
call should tell the finder to redraw the files icon.
.. deprecated:: 2.6
The function is a no-op on OS X.
.. data:: BUFSIZ
The buffer size for ``copy``, default 1 megabyte.
Note that the process of creating finder aliases is not specified in the Apple
documentation. Hence, aliases created with :func:`mkalias` could conceivably
have incompatible behaviour in some cases.
:mod:`findertools` --- The :program:`finder`'s Apple Events interface
=====================================================================
.. module:: findertools
:platform: Mac
:synopsis: Wrappers around the finder's Apple Events interface.
.. index:: single: AppleEvents
This module contains routines that give Python programs access to some
functionality provided by the finder. They are implemented as wrappers around
the AppleEvent interface to the finder.
All file and folder parameters can be specified either as full pathnames, or as
:class:`FSRef` or :class:`FSSpec` objects.
The :mod:`findertools` module defines the following functions:
.. function:: launch(file)
Tell the finder to launch *file*. What launching means depends on the file:
applications are started, folders are opened and documents are opened in the
correct application.
.. function:: Print(file)
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.
.. function:: copy(file, destdir)
Tell the finder to copy a file or folder *file* to folder *destdir*. The
function returns an :class:`Alias` object pointing to the new file.
.. function:: move(file, destdir)
Tell the finder to move a file or folder *file* to folder *destdir*. The
function returns an :class:`Alias` object pointing to the new file.
.. function:: sleep()
Tell the finder to put the Macintosh to sleep, if your machine supports it.
.. function:: restart()
Tell the finder to perform an orderly restart of the machine.
.. function:: shutdown()
Tell the finder to perform an orderly shutdown of the machine.
...@@ -65,19 +65,6 @@ This module defines the following functions: ...@@ -65,19 +65,6 @@ This module defines the following functions:
Return *rootObject* as a plist-formatted string. Return *rootObject* as a plist-formatted string.
.. function:: readPlistFromResource(path[, restype='plst'[, resid=0]])
Read a plist from the resource with type *restype* from the resource fork of
*path*. Availability: MacOS X.
.. function:: writePlistToResource(rootObject, path[, restype='plst'[, resid=0]])
Write *rootObject* as a resource with type *restype* to the resource fork of
*path*. Availability: MacOS X.
The following class is available: The following class is available:
.. class:: Data(data) .. class:: Data(data)
......
...@@ -37,104 +37,6 @@ Multimedia ...@@ -37,104 +37,6 @@ Multimedia
:mod:`sunaudio` :mod:`sunaudio`
--- Interpret Sun audio headers (may become obsolete or a tool/demo). --- Interpret Sun audio headers (may become obsolete or a tool/demo).
.. _undoc-mac-modules:
Undocumented Mac OS modules
===========================
:mod:`applesingle` --- AppleSingle decoder
------------------------------------------
.. module:: applesingle
:platform: Mac
:synopsis: Rudimentary decoder for AppleSingle format files.
:mod:`icopen` --- Internet Config replacement for :meth:`open`
--------------------------------------------------------------
.. module:: icopen
:platform: Mac
:synopsis: Internet Config replacement for open().
Importing :mod:`icopen` will replace the builtin :meth:`open` with a version
that uses Internet Config to set file type and creator for new files.
:mod:`macerrors` --- Mac OS Errors
----------------------------------
.. module:: macerrors
:platform: Mac
:synopsis: Constant definitions for many Mac OS error codes.
:mod:`macerrors` contains constant definitions for many Mac OS error codes.
:mod:`macresource` --- Locate script resources
----------------------------------------------
.. module:: macresource
:platform: Mac
:synopsis: Locate script resources.
:mod:`macresource` helps scripts finding their resources, such as dialogs and
menus, without requiring special case code for when the script is run under
MacPython, as a MacPython applet or under OSX Python.
:mod:`Nav` --- NavServices calls
--------------------------------
.. module:: Nav
:platform: Mac
:synopsis: Interface to Navigation Services.
A low-level interface to Navigation Services.
:mod:`PixMapWrapper` --- Wrapper for PixMap objects
---------------------------------------------------
.. module:: PixMapWrapper
:platform: Mac
:synopsis: Wrapper for PixMap objects.
:mod:`PixMapWrapper` wraps a PixMap object with a Python object that allows
access to the fields by name. It also has methods to convert to and from
:mod:`PIL` images.
:mod:`videoreader` --- Read QuickTime movies
--------------------------------------------
.. module:: videoreader
:platform: Mac
:synopsis: Read QuickTime movies frame by frame for further processing.
:mod:`videoreader` reads and decodes QuickTime movies and passes a stream of
images to your program. It also provides some support for audio tracks.
:mod:`W` --- Widgets built on :mod:`FrameWork`
----------------------------------------------
.. module:: W
:platform: Mac
:synopsis: Widgets for the Mac, built on top of FrameWork.
The :mod:`W` widgets are used extensively in the :program:`IDE`.
.. _obsolete-modules: .. _obsolete-modules:
Obsolete Obsolete
......
...@@ -12,9 +12,6 @@ Python on a Macintosh running Mac OS X is in principle very similar to Python on ...@@ -12,9 +12,6 @@ Python on a Macintosh running Mac OS X is in principle very similar to Python on
any other Unix platform, but there are a number of additional features such as any other Unix platform, but there are a number of additional features such as
the IDE and the Package Manager that are worth pointing out. the IDE and the Package Manager that are worth pointing out.
The Mac-specific modules are documented in :ref:`mac-specific-services`.
.. _getting-osx: .. _getting-osx:
Getting and Installing MacPython Getting and Installing MacPython
......
...@@ -43,68 +43,39 @@ RUNCHAR = b"\x90" ...@@ -43,68 +43,39 @@ RUNCHAR = b"\x90"
# #
# This code is no longer byte-order dependent # This code is no longer byte-order dependent
#
# Workarounds for non-mac machines. class FInfo:
try: def __init__(self):
from Carbon.File import FSSpec, FInfo self.Type = '????'
from MacOS import openrf self.Creator = '????'
self.Flags = 0
def getfileinfo(name):
finfo = FSSpec(name).FSpGetFInfo() def getfileinfo(name):
dir, file = os.path.split(name) finfo = FInfo()
# XXX Get resource/data sizes fp = io.open(name, 'rb')
fp = io.open(name, 'rb') # Quick check for textfile
fp.seek(0, 2) data = fp.read(512)
dlen = fp.tell() if 0 not in data:
fp = openrf(name, '*rb') finfo.Type = 'TEXT'
fp.seek(0, 2) fp.seek(0, 2)
rlen = fp.tell() dsize = fp.tell()
return file, finfo, dlen, rlen fp.close()
dir, file = os.path.split(name)
def openrsrc(name, *mode): file = file.replace(':', '-', 1)
if not mode: return file, finfo, dsize, 0
mode = '*rb'
else: class openrsrc:
mode = '*' + mode[0] def __init__(self, *args):
return openrf(name, mode) pass
except ImportError: def read(self, *args):
# return b''
# Glue code for non-macintosh usage
# def write(self, *args):
pass
class FInfo:
def __init__(self): def close(self):
self.Type = '????' pass
self.Creator = '????'
self.Flags = 0
def getfileinfo(name):
finfo = FInfo()
fp = io.open(name, 'rb')
# Quick check for textfile
data = fp.read(512)
if 0 not in data:
finfo.Type = 'TEXT'
fp.seek(0, 2)
dsize = fp.tell()
fp.close()
dir, file = os.path.split(name)
file = file.replace(':', '-', 1)
return file, finfo, dsize, 0
class openrsrc:
def __init__(self, *args):
pass
def read(self, *args):
return b''
def write(self, *args):
pass
def close(self):
pass
class _Hqxcoderengine: class _Hqxcoderengine:
"""Write data to the coder in 3-byte chunks""" """Write data to the coder in 3-byte chunks"""
......
QSIZE = 100000
error='Audio_mac.error'
class Play_Audio_mac:
def __init__(self, qsize=QSIZE):
self._chan = None
self._qsize = qsize
self._outrate = 22254
self._sampwidth = 1
self._nchannels = 1
self._gc = []
self._usercallback = None
def __del__(self):
self.stop()
self._usercallback = None
def wait(self):
import time
while self.getfilled():
time.sleep(0.1)
self._chan = None
self._gc = []
def stop(self, quietNow = 1):
##chan = self._chan
self._chan = None
##chan.SndDisposeChannel(1)
self._gc = []
def setoutrate(self, outrate):
self._outrate = outrate
def setsampwidth(self, sampwidth):
self._sampwidth = sampwidth
def setnchannels(self, nchannels):
self._nchannels = nchannels
def writeframes(self, data):
import time
from Carbon.Sound import bufferCmd, callBackCmd, extSH
import struct
import MacOS
if not self._chan:
from Carbon import Snd
self._chan = Snd.SndNewChannel(5, 0, self._callback)
nframes = len(data) / self._nchannels / self._sampwidth
if len(data) != nframes * self._nchannels * self._sampwidth:
raise error('data is not a whole number of frames')
while self._gc and \
self.getfilled() + nframes > \
self._qsize / self._nchannels / self._sampwidth:
time.sleep(0.1)
if self._sampwidth == 1:
import audioop
data = audioop.add(data, '\x80'*len(data), 1)
h1 = struct.pack('llHhllbbl',
id(data)+MacOS.string_id_to_buffer,
self._nchannels,
self._outrate, 0,
0,
0,
extSH,
60,
nframes)
h2 = 22*'\0'
h3 = struct.pack('hhlll',
self._sampwidth*8,
0,
0,
0,
0)
header = h1+h2+h3
self._gc.append((header, data))
self._chan.SndDoCommand((bufferCmd, 0, header), 0)
self._chan.SndDoCommand((callBackCmd, 0, 0), 0)
def _callback(self, *args):
del self._gc[0]
if self._usercallback:
self._usercallback()
def setcallback(self, callback):
self._usercallback = callback
def getfilled(self):
filled = 0
for header, data in self._gc:
filled = filled + len(data)
return filled / self._nchannels / self._sampwidth
def getfillable(self):
return (self._qsize / self._nchannels / self._sampwidth) - self.getfilled()
def ulaw2lin(self, data):
import audioop
return audioop.ulaw2lin(data, 2)
def test():
import aifc
import EasyDialogs
fn = EasyDialogs.AskFileForOpen(message="Select an AIFF soundfile", typeList=("AIFF",))
if not fn: return
af = aifc.open(fn, 'r')
print(af.getparams())
p = Play_Audio_mac()
p.setoutrate(af.getframerate())
p.setsampwidth(af.getsampwidth())
p.setnchannels(af.getnchannels())
BUFSIZ = 10000
while 1:
data = af.readframes(BUFSIZ)
if not data: break
p.writeframes(data)
print('wrote', len(data), 'space', p.getfillable())
p.wait()
if __name__ == '__main__':
test()
# Generated from 'Aliases.h'
def FOUR_CHAR_CODE(x): return x
true = True
false = False
rAliasType = FOUR_CHAR_CODE('alis')
kARMMountVol = 0x00000001
kARMNoUI = 0x00000002
kARMMultVols = 0x00000008
kARMSearch = 0x00000100
kARMSearchMore = 0x00000200
kARMSearchRelFirst = 0x00000400
asiZoneName = -3
asiServerName = -2
asiVolumeName = -1
asiAliasName = 0
asiParentName = 1
kResolveAliasFileNoUI = 0x00000001
This diff is collapsed.
This diff is collapsed.
# Generated from 'AppleHelp.h'
kAHInternalErr = -10790
kAHInternetConfigPrefErr = -10791
kAHTOCTypeUser = 0
kAHTOCTypeDeveloper = 1
This diff is collapsed.
# Generated from 'Components.h'
def FOUR_CHAR_CODE(x): return x
kAppleManufacturer = FOUR_CHAR_CODE('appl')
kComponentResourceType = FOUR_CHAR_CODE('thng')
kComponentAliasResourceType = FOUR_CHAR_CODE('thga')
kAnyComponentType = 0
kAnyComponentSubType = 0
kAnyComponentManufacturer = 0
kAnyComponentFlagsMask = 0
cmpIsMissing = 1 << 29
cmpWantsRegisterMessage = 1 << 31
kComponentOpenSelect = -1
kComponentCloseSelect = -2
kComponentCanDoSelect = -3
kComponentVersionSelect = -4
kComponentRegisterSelect = -5
kComponentTargetSelect = -6
kComponentUnregisterSelect = -7
kComponentGetMPWorkFunctionSelect = -8
kComponentExecuteWiredActionSelect = -9
kComponentGetPublicResourceSelect = -10
componentDoAutoVersion = (1 << 0)
componentWantsUnregister = (1 << 1)
componentAutoVersionIncludeFlags = (1 << 2)
componentHasMultiplePlatforms = (1 << 3)
componentLoadResident = (1 << 4)
defaultComponentIdentical = 0
defaultComponentAnyFlags = 1
defaultComponentAnyManufacturer = 2
defaultComponentAnySubType = 4
defaultComponentAnyFlagsAnyManufacturer = (defaultComponentAnyFlags + defaultComponentAnyManufacturer)
defaultComponentAnyFlagsAnyManufacturerAnySubType = (defaultComponentAnyFlags + defaultComponentAnyManufacturer + defaultComponentAnySubType)
registerComponentGlobal = 1
registerComponentNoDuplicates = 2
registerComponentAfterExisting = 4
registerComponentAliasesOnly = 8
platform68k = 1
platformPowerPC = 2
platformInterpreted = 3
platformWin32 = 4
platformPowerPCNativeEntryPoint = 5
mpWorkFlagDoWork = (1 << 0)
mpWorkFlagDoCompletion = (1 << 1)
mpWorkFlagCopyWorkBlock = (1 << 2)
mpWorkFlagDontBlock = (1 << 3)
mpWorkFlagGetProcessorCount = (1 << 4)
mpWorkFlagGetIsRunning = (1 << 6)
cmpAliasNoFlags = 0
cmpAliasOnlyThisFile = 1
uppComponentFunctionImplementedProcInfo = 0x000002F0
uppGetComponentVersionProcInfo = 0x000000F0
uppComponentSetTargetProcInfo = 0x000003F0
uppCallComponentOpenProcInfo = 0x000003F0
uppCallComponentCloseProcInfo = 0x000003F0
uppCallComponentCanDoProcInfo = 0x000002F0
uppCallComponentVersionProcInfo = 0x000000F0
uppCallComponentRegisterProcInfo = 0x000000F0
uppCallComponentTargetProcInfo = 0x000003F0
uppCallComponentUnregisterProcInfo = 0x000000F0
uppCallComponentGetMPWorkFunctionProcInfo = 0x00000FF0
uppCallComponentGetPublicResourceProcInfo = 0x00003BF0
# Accessor functions for control properties
from Carbon.Controls import *
import struct
# These needn't go through this module, but are here for completeness
def SetControlData_Handle(control, part, selector, data):
control.SetControlData_Handle(part, selector, data)
def GetControlData_Handle(control, part, selector):
return control.GetControlData_Handle(part, selector)
_accessdict = {
kControlPopupButtonMenuHandleTag: (SetControlData_Handle, GetControlData_Handle),
}
_codingdict = {
kControlPushButtonDefaultTag : ("b", None, None),
kControlEditTextTextTag: (None, None, None),
kControlEditTextPasswordTag: (None, None, None),
kControlPopupButtonMenuIDTag: ("h", None, None),
kControlListBoxDoubleClickTag: ("b", None, None),
}
def SetControlData(control, part, selector, data):
if _accessdict.has_key(selector):
setfunc, getfunc = _accessdict[selector]
setfunc(control, part, selector, data)
return
if not _codingdict.has_key(selector):
raise KeyError('Unknown control selector', selector)
structfmt, coder, decoder = _codingdict[selector]
if coder:
data = coder(data)
if structfmt:
data = struct.pack(structfmt, data)
control.SetControlData(part, selector, data)
def GetControlData(control, part, selector):
if _accessdict.has_key(selector):
setfunc, getfunc = _accessdict[selector]
return getfunc(control, part, selector, data)
if not _codingdict.has_key(selector):
raise KeyError('Unknown control selector', selector)
structfmt, coder, decoder = _codingdict[selector]
data = control.GetControlData(part, selector)
if structfmt:
data = struct.unpack(structfmt, data)
if decoder:
data = decoder(data)
if type(data) == type(()) and len(data) == 1:
data = data[0]
return data
This diff is collapsed.
# Generated from 'CFBase.h'
def FOUR_CHAR_CODE(x): return x
kCFCompareLessThan = -1
kCFCompareEqualTo = 0
kCFCompareGreaterThan = 1
kCFNotFound = -1
kCFPropertyListImmutable = 0
kCFPropertyListMutableContainers = 1
kCFPropertyListMutableContainersAndLeaves = 2
# kCFStringEncodingInvalidId = (long)0xFFFFFFFF
kCFStringEncodingMacRoman = 0
kCFStringEncodingWindowsLatin1 = 0x0500
kCFStringEncodingISOLatin1 = 0x0201
kCFStringEncodingNextStepLatin = 0x0B01
kCFStringEncodingASCII = 0x0600
kCFStringEncodingUnicode = 0x0100
kCFStringEncodingUTF8 = 0x08000100
kCFStringEncodingNonLossyASCII = 0x0BFF
kCFCompareCaseInsensitive = 1
kCFCompareBackwards = 4
kCFCompareAnchored = 8
kCFCompareNonliteral = 16
kCFCompareLocalized = 32
kCFCompareNumerically = 64
kCFURLPOSIXPathStyle = 0
kCFURLHFSPathStyle = 1
kCFURLWindowsPathStyle = 2
# Generated from 'CGContext.h'
def FOUR_CHAR_CODE(x): return x
kCGLineJoinMiter = 0
kCGLineJoinRound = 1
kCGLineJoinBevel = 2
kCGLineCapButt = 0
kCGLineCapRound = 1
kCGLineCapSquare = 2
kCGPathFill = 0
kCGPathEOFill = 1
kCGPathStroke = 2
kCGPathFillStroke = 3
kCGPathEOFillStroke = 4
kCGTextFill = 0
kCGTextStroke = 1
kCGTextFillStroke = 2
kCGTextInvisible = 3
kCGTextFillClip = 4
kCGTextStrokeClip = 5
kCGTextFillStrokeClip = 6
kCGTextClip = 7
kCGEncodingFontSpecific = 0
kCGEncodingMacRoman = 1
kCGInterpolationDefault = 0
kCGInterpolationNone = 1
kCGInterpolationLow = 2
kCGInterpolationHigh = 3
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
# Generated from 'IBCarbonRuntime.h'
kIBCarbonRuntimeCantFindNibFile = -10960
kIBCarbonRuntimeObjectNotOfRequestedType = -10961
kIBCarbonRuntimeCantFindObject = -10962
This diff is collapsed.
This diff is collapsed.
# Generated from 'Lists.h'
def FOUR_CHAR_CODE(x): return x
listNotifyNothing = FOUR_CHAR_CODE('nada')
listNotifyClick = FOUR_CHAR_CODE('clik')
listNotifyDoubleClick = FOUR_CHAR_CODE('dblc')
listNotifyPreClick = FOUR_CHAR_CODE('pclk')
lDrawingModeOffBit = 3
lDoVAutoscrollBit = 1
lDoHAutoscrollBit = 0
lDrawingModeOff = 8
lDoVAutoscroll = 2
lDoHAutoscroll = 1
lOnlyOneBit = 7
lExtendDragBit = 6
lNoDisjointBit = 5
lNoExtendBit = 4
lNoRectBit = 3
lUseSenseBit = 2
lNoNilHiliteBit = 1
lOnlyOne = -128
lExtendDrag = 64
lNoDisjoint = 32
lNoExtend = 16
lNoRect = 8
lUseSense = 4
lNoNilHilite = 2
lInitMsg = 0
lDrawMsg = 1
lHiliteMsg = 2
lCloseMsg = 3
kListDefProcPtr = 0
kListDefUserProcType = kListDefProcPtr
kListDefStandardTextType = 1
kListDefStandardIconType = 2
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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