• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"""Suite Standard Suite: Common terms for most applications
2Level 1, version 1
3
4Generated from /Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.5
5AETE/AEUT resource version 1/0, language 0, script 0
6"""
7
8import aetools
9import MacOS
10
11_code = 'CoRe'
12
13from StdSuites.Standard_Suite import *
14class Standard_Suite_Events(Standard_Suite_Events):
15
16    _argmap_close = {
17        'saving' : 'savo',
18        'saving_in' : 'kfil',
19    }
20
21    def close(self, _object, _attributes={}, **_arguments):
22        """close: close an object
23        Required argument: the object to close
24        Keyword argument saving: specifies whether or not changes should be saved before closing
25        Keyword argument saving_in: the file in which to save the object
26        Keyword argument _attributes: AppleEvent attribute dictionary
27        """
28        _code = 'core'
29        _subcode = 'clos'
30
31        aetools.keysubst(_arguments, self._argmap_close)
32        _arguments['----'] = _object
33
34        aetools.enumsubst(_arguments, 'savo', _Enum_savo)
35
36        _reply, _arguments, _attributes = self.send(_code, _subcode,
37                _arguments, _attributes)
38        if _arguments.get('errn', 0):
39            raise aetools.Error, aetools.decodeerror(_arguments)
40        # XXXX Optionally decode result
41        if _arguments.has_key('----'):
42            return _arguments['----']
43
44    _argmap_count = {
45        'each' : 'kocl',
46    }
47
48    def count(self, _object, _attributes={}, **_arguments):
49        """count: return the number of elements of a particular class within an object
50        Required argument: the object whose elements are to be counted
51        Keyword argument each: the class of the elements to be counted. Keyword 'each' is optional in AppleScript
52        Keyword argument _attributes: AppleEvent attribute dictionary
53        Returns: the number of elements
54        """
55        _code = 'core'
56        _subcode = 'cnte'
57
58        aetools.keysubst(_arguments, self._argmap_count)
59        _arguments['----'] = _object
60
61
62        _reply, _arguments, _attributes = self.send(_code, _subcode,
63                _arguments, _attributes)
64        if _arguments.get('errn', 0):
65            raise aetools.Error, aetools.decodeerror(_arguments)
66        # XXXX Optionally decode result
67        if _arguments.has_key('----'):
68            return _arguments['----']
69
70    _argmap_get = {
71        'as' : 'rtyp',
72    }
73
74    def get(self, _object, _attributes={}, **_arguments):
75        """get: get the data for an object
76        Required argument: the object whose data is to be returned
77        Keyword argument as: the desired types for the data, in order of preference
78        Keyword argument _attributes: AppleEvent attribute dictionary
79        Returns: The data from the object
80        """
81        _code = 'core'
82        _subcode = 'getd'
83
84        aetools.keysubst(_arguments, self._argmap_get)
85        _arguments['----'] = _object
86
87
88        _reply, _arguments, _attributes = self.send(_code, _subcode,
89                _arguments, _attributes)
90        if _arguments.get('errn', 0):
91            raise aetools.Error, aetools.decodeerror(_arguments)
92        # XXXX Optionally decode result
93        if _arguments.has_key('----'):
94            return _arguments['----']
95
96    _argmap_make = {
97        'new' : 'kocl',
98        'as' : 'rtyp',
99        'at' : 'insh',
100        'with_data' : 'data',
101        'with_properties' : 'prdt',
102    }
103
104    def make(self, _no_object=None, _attributes={}, **_arguments):
105        """make: make a new element
106        Keyword argument new: the class of the new element\xd1keyword 'new' is optional in AppleScript
107        Keyword argument as: the desired types for the data, in order of preference
108        Keyword argument at: the location at which to insert the element
109        Keyword argument with_data: the initial data for the element
110        Keyword argument with_properties: the initial values for the properties of the element
111        Keyword argument _attributes: AppleEvent attribute dictionary
112        Returns: to the new object(s)
113        """
114        _code = 'core'
115        _subcode = 'crel'
116
117        aetools.keysubst(_arguments, self._argmap_make)
118        if _no_object is not None: raise TypeError, 'No direct arg expected'
119
120
121        _reply, _arguments, _attributes = self.send(_code, _subcode,
122                _arguments, _attributes)
123        if _arguments.get('errn', 0):
124            raise aetools.Error, aetools.decodeerror(_arguments)
125        # XXXX Optionally decode result
126        if _arguments.has_key('----'):
127            return _arguments['----']
128
129    def select(self, _object=None, _attributes={}, **_arguments):
130        """select: select the specified object
131        Required argument: the object to select
132        Keyword argument _attributes: AppleEvent attribute dictionary
133        """
134        _code = 'misc'
135        _subcode = 'slct'
136
137        if _arguments: raise TypeError, 'No optional args expected'
138        _arguments['----'] = _object
139
140
141        _reply, _arguments, _attributes = self.send(_code, _subcode,
142                _arguments, _attributes)
143        if _arguments.get('errn', 0):
144            raise aetools.Error, aetools.decodeerror(_arguments)
145        # XXXX Optionally decode result
146        if _arguments.has_key('----'):
147            return _arguments['----']
148
149    _argmap_set = {
150        'to' : 'data',
151    }
152
153    def set(self, _object, _attributes={}, **_arguments):
154        """set: set an object's data
155        Required argument: the object to change
156        Keyword argument to: the new value
157        Keyword argument _attributes: AppleEvent attribute dictionary
158        """
159        _code = 'core'
160        _subcode = 'setd'
161
162        aetools.keysubst(_arguments, self._argmap_set)
163        _arguments['----'] = _object
164
165
166        _reply, _arguments, _attributes = self.send(_code, _subcode,
167                _arguments, _attributes)
168        if _arguments.get('errn', 0):
169            raise aetools.Error, aetools.decodeerror(_arguments)
170        # XXXX Optionally decode result
171        if _arguments.has_key('----'):
172            return _arguments['----']
173
174
175class application(aetools.ComponentItem):
176    """application - an application program """
177    want = 'capp'
178class _Prop_user_interaction(aetools.NProperty):
179    """user interaction - user interaction level """
180    which = 'inte'
181    want = 'Inte'
182user_interaction = _Prop_user_interaction()
183#        element 'cwin' as ['indx', 'name', 'rang']
184#        element 'docu' as ['indx', 'name', 'rang']
185
186class character(aetools.ComponentItem):
187    """character - a character """
188    want = 'cha '
189class _Prop_length(aetools.NProperty):
190    """length - length in characters of this object """
191    which = 'pLen'
192    want = 'long'
193class _Prop_offset(aetools.NProperty):
194    """offset - offset of a text object from the beginning of the document (first char has offset 1) """
195    which = 'pOff'
196    want = 'long'
197
198class insertion_point(aetools.ComponentItem):
199    """insertion point - An insertion location between two objects """
200    want = 'cins'
201
202class line(aetools.ComponentItem):
203    """line - lines of text """
204    want = 'clin'
205class _Prop_index(aetools.NProperty):
206    """index - index of a line object from the beginning of the document (first line has index 1) """
207    which = 'pidx'
208    want = 'long'
209#        element 'cha ' as ['indx', 'rang', 'rele']
210
211lines = line
212
213class selection_2d_object(aetools.ComponentItem):
214    """selection-object - the selection visible to the user """
215    want = 'csel'
216class _Prop_contents(aetools.NProperty):
217    """contents - the contents of the selection """
218    which = 'pcnt'
219    want = 'type'
220#        element 'cha ' as ['indx', 'rele', 'rang', 'test']
221#        element 'clin' as ['indx', 'rang', 'rele']
222#        element 'ctxt' as ['rang']
223
224class text(aetools.ComponentItem):
225    """text - Text """
226    want = 'ctxt'
227#        element 'cha ' as ['indx', 'rele', 'rang']
228#        element 'cins' as ['rele']
229#        element 'clin' as ['indx', 'rang', 'rele']
230#        element 'ctxt' as ['rang']
231
232class window(aetools.ComponentItem):
233    """window - A window """
234    want = 'cwin'
235class _Prop_bounds(aetools.NProperty):
236    """bounds - the boundary rectangle for the window """
237    which = 'pbnd'
238    want = 'qdrt'
239class _Prop_document(aetools.NProperty):
240    """document - the document that owns this window """
241    which = 'docu'
242    want = 'docu'
243class _Prop_name(aetools.NProperty):
244    """name - the title of the window """
245    which = 'pnam'
246    want = 'itxt'
247class _Prop_position(aetools.NProperty):
248    """position - upper left coordinates of window """
249    which = 'ppos'
250    want = 'QDpt'
251class _Prop_visible(aetools.NProperty):
252    """visible - is the window visible? """
253    which = 'pvis'
254    want = 'bool'
255class _Prop_zoomed(aetools.NProperty):
256    """zoomed - Is the window zoomed? """
257    which = 'pzum'
258    want = 'bool'
259
260windows = window
261
262class document(aetools.ComponentItem):
263    """document - a document """
264    want = 'docu'
265class _Prop_file_permissions(aetools.NProperty):
266    """file permissions - the file permissions for the document """
267    which = 'PERM'
268    want = 'PERM'
269class _Prop_kind(aetools.NProperty):
270    """kind - the kind of document """
271    which = 'DKND'
272    want = 'DKND'
273class _Prop_location(aetools.NProperty):
274    """location - the file of the document """
275    which = 'FILE'
276    want = 'fss '
277class _Prop_window(aetools.NProperty):
278    """window - the window of the document. """
279    which = 'cwin'
280    want = 'cwin'
281
282documents = document
283
284class files(aetools.ComponentItem):
285    """files - Every file """
286    want = 'file'
287
288file = files
289application._superclassnames = []
290application._privpropdict = {
291    'user_interaction' : _Prop_user_interaction,
292}
293application._privelemdict = {
294    'document' : document,
295    'window' : window,
296}
297character._superclassnames = []
298character._privpropdict = {
299    'length' : _Prop_length,
300    'offset' : _Prop_offset,
301}
302character._privelemdict = {
303}
304insertion_point._superclassnames = []
305insertion_point._privpropdict = {
306    'length' : _Prop_length,
307    'offset' : _Prop_offset,
308}
309insertion_point._privelemdict = {
310}
311line._superclassnames = []
312line._privpropdict = {
313    'index' : _Prop_index,
314    'length' : _Prop_length,
315    'offset' : _Prop_offset,
316}
317line._privelemdict = {
318    'character' : character,
319}
320selection_2d_object._superclassnames = []
321selection_2d_object._privpropdict = {
322    'contents' : _Prop_contents,
323    'length' : _Prop_length,
324    'offset' : _Prop_offset,
325}
326selection_2d_object._privelemdict = {
327    'character' : character,
328    'line' : line,
329    'text' : text,
330}
331text._superclassnames = []
332text._privpropdict = {
333    'length' : _Prop_length,
334    'offset' : _Prop_offset,
335}
336text._privelemdict = {
337    'character' : character,
338    'insertion_point' : insertion_point,
339    'line' : line,
340    'text' : text,
341}
342window._superclassnames = []
343window._privpropdict = {
344    'bounds' : _Prop_bounds,
345    'document' : _Prop_document,
346    'index' : _Prop_index,
347    'name' : _Prop_name,
348    'position' : _Prop_position,
349    'visible' : _Prop_visible,
350    'zoomed' : _Prop_zoomed,
351}
352window._privelemdict = {
353}
354document._superclassnames = []
355document._privpropdict = {
356    'file_permissions' : _Prop_file_permissions,
357    'index' : _Prop_index,
358    'kind' : _Prop_kind,
359    'location' : _Prop_location,
360    'name' : _Prop_name,
361    'window' : _Prop_window,
362}
363document._privelemdict = {
364}
365files._superclassnames = []
366files._privpropdict = {
367}
368files._privelemdict = {
369}
370
371#
372# Indices of types declared in this module
373#
374_classdeclarations = {
375    'capp' : application,
376    'cha ' : character,
377    'cins' : insertion_point,
378    'clin' : line,
379    'csel' : selection_2d_object,
380    'ctxt' : text,
381    'cwin' : window,
382    'docu' : document,
383    'file' : files,
384}
385
386_propdeclarations = {
387    'DKND' : _Prop_kind,
388    'FILE' : _Prop_location,
389    'PERM' : _Prop_file_permissions,
390    'cwin' : _Prop_window,
391    'docu' : _Prop_document,
392    'inte' : _Prop_user_interaction,
393    'pLen' : _Prop_length,
394    'pOff' : _Prop_offset,
395    'pbnd' : _Prop_bounds,
396    'pcnt' : _Prop_contents,
397    'pidx' : _Prop_index,
398    'pnam' : _Prop_name,
399    'ppos' : _Prop_position,
400    'pvis' : _Prop_visible,
401    'pzum' : _Prop_zoomed,
402}
403
404_compdeclarations = {
405}
406
407_enumdeclarations = {
408}
409