blob: 0dd0a88c85a6db2f510042f4fe223cc8fbcc53c6 [file] [log] [blame]
Georg Brandl116aa622007-08-15 14:28:22 +00001
2:mod:`aetypes` --- AppleEvent objects
3=====================================
4
5.. module:: aetypes
6 :platform: Mac
7 :synopsis: Python representation of the Apple Event Object Model.
8.. sectionauthor:: Vincent Marchetti <vincem@en.com>
9
10
11.. % \moduleauthor{Jack Jansen?}{email}
12
13The :mod:`aetypes` defines classes used to represent Apple Event data
14descriptors and Apple Event object specifiers.
15
16Apple Event data is contained in descriptors, and these descriptors are typed.
17For many descriptors the Python representation is simply the corresponding
18Python type: ``typeText`` in OSA is a Python string, ``typeFloat`` is a float,
19etc. For OSA types that have no direct Python counterpart this module declares
20classes. Packing and unpacking instances of these classes is handled
21automatically by :mod:`aepack`.
22
23An object specifier is essentially an address of an object implemented in a
24Apple Event server. An Apple Event specifier is used as the direct object for an
25Apple Event or as the argument of an optional parameter. The :mod:`aetypes`
26module contains the base classes for OSA classes and properties, which are used
27by the packages generated by :mod:`gensuitemodule` to populate the classes and
28properties in a given suite.
29
30For reasons of backward compatibility, and for cases where you need to script an
31application for which you have not generated the stub package this module also
32contains object specifiers for a number of common OSA classes such as
33``Document``, ``Window``, ``Character``, etc.
34
35The :mod:`AEObjects` module defines the following classes to represent Apple
36Event descriptor data:
37
38
39.. class:: Unknown(type, data)
40
41 The representation of OSA descriptor data for which the :mod:`aepack` and
42 :mod:`aetypes` modules have no support, i.e. anything that is not represented by
43 the other classes here and that is not equivalent to a simple Python value.
44
45
46.. class:: Enum(enum)
47
48 An enumeration value with the given 4-character string value.
49
50
51.. class:: InsertionLoc(of, pos)
52
53 Position ``pos`` in object ``of``.
54
55
56.. class:: Boolean(bool)
57
58 A boolean.
59
60
61.. class:: StyledText(style, text)
62
63 Text with style information (font, face, etc) included.
64
65
66.. class:: AEText(script, style, text)
67
68 Text with script system and style information included.
69
70
71.. class:: IntlText(script, language, text)
72
73 Text with script system and language information included.
74
75
76.. class:: IntlWritingCode(script, language)
77
78 Script system and language information.
79
80
81.. class:: QDPoint(v, h)
82
83 A quickdraw point.
84
85
86.. class:: QDRectangle(v0, h0, v1, h1)
87
88 A quickdraw rectangle.
89
90
91.. class:: RGBColor(r, g, b)
92
93 A color.
94
95
96.. class:: Type(type)
97
98 An OSA type value with the given 4-character name.
99
100
101.. class:: Keyword(name)
102
103 An OSA keyword with the given 4-character name.
104
105
106.. class:: Range(start, stop)
107
108 A range.
109
110
111.. class:: Ordinal(abso)
112
113 Non-numeric absolute positions, such as ``"firs"``, first, or ``"midd"``,
114 middle.
115
116
117.. class:: Logical(logc, term)
118
119 The logical expression of applying operator ``logc`` to ``term``.
120
121
122.. class:: Comparison(obj1, relo, obj2)
123
124 The comparison ``relo`` of ``obj1`` to ``obj2``.
125
126The following classes are used as base classes by the generated stub packages to
127represent AppleScript classes and properties in Python:
128
129
130.. class:: ComponentItem(which[, fr])
131
132 Abstract baseclass for an OSA class. The subclass should set the class attribute
133 ``want`` to the 4-character OSA class code. Instances of subclasses of this
134 class are equivalent to AppleScript Object Specifiers. Upon instantiation you
135 should pass a selector in ``which``, and optionally a parent object in ``fr``.
136
137
138.. class:: NProperty(fr)
139
140 Abstract baseclass for an OSA property. The subclass should set the class
141 attributes ``want`` and ``which`` to designate which property we are talking
142 about. Instances of subclasses of this class are Object Specifiers.
143
144
145.. class:: ObjectSpecifier(want, form, seld[, fr])
146
147 Base class of ``ComponentItem`` and ``NProperty``, a general OSA Object
148 Specifier. See the Apple Open Scripting Architecture documentation for the
149 parameters. Note that this class is not abstract.
150