Another batch of updates...
[python/dscho.git] / Mac / Lib / toolbox / Standard_Suite.py
blob0fdd7b26716823a61deb9462df26425d4b504cb8
1 """Suite Standard Suite: Common terms for most applications
2 Level 1, version 1
4 Generated from Moes:System folder:Extensions:Scripting Additions:Dialects:English Dialect
5 AETE/AEUT resource version 1/0, language 0, script 0
6 """
8 import aetools
9 import MacOS
11 _code = 'core'
13 _Enum_savo = {
14 'yes' : 'yes ', # Save objects now
15 'no' : 'no ', # Do not save objects
16 'ask' : 'ask ', # Ask the user whether to save
19 _Enum_kfrm = {
20 'index' : 'indx', # keyform designating indexed access
21 'named' : 'name', # keyform designating named access
22 'id' : 'ID ', # keyform designating access by unique identifier
25 _Enum_styl = {
26 'plain' : 'plan', # Plain
27 'bold' : 'bold', # Bold
28 'italic' : 'ital', # Italic
29 'outline' : 'outl', # Outline
30 'shadow' : 'shad', # Shadow
31 'underline' : 'undl', # Underline
32 'superscript' : 'spsc', # Superscript
33 'subscript' : 'sbsc', # Subscript
34 'strikethrough' : 'strk', # Strikethrough
35 'small_caps' : 'smcp', # Small caps
36 'all_caps' : 'alcp', # All capital letters
37 'all_lowercase' : 'lowc', # Lowercase
38 'condensed' : 'cond', # Condensed
39 'expanded' : 'pexp', # Expanded
40 'hidden' : 'hidn', # Hidden
43 class Standard_Suite:
45 _argmap_class_info = {
46 '_in' : 'wrcd',
49 def class_info(self, _object=None, _attributes={}, **_arguments):
50 """class info: Get information about an object class
51 Required argument: the object class about which information is requested
52 Keyword argument _in: the human language and script system in which to return information
53 Keyword argument _attributes: AppleEvent attribute dictionary
54 Returns: a record containing the objectÕs properties and elements
55 """
56 _code = 'core'
57 _subcode = 'qobj'
59 aetools.keysubst(_arguments, self._argmap_class_info)
60 _arguments['----'] = _object
63 _reply, _arguments, _attributes = self.send(_code, _subcode,
64 _arguments, _attributes)
65 if _arguments.has_key('errn'):
66 raise MacOS.Error, aetools.decodeerror(_arguments)
67 # XXXX Optionally decode result
68 if _arguments.has_key('----'):
69 return _arguments['----']
71 _argmap_close = {
72 'saving' : 'savo',
73 'saving_in' : 'kfil',
76 def close(self, _object, _attributes={}, **_arguments):
77 """close: Close an object
78 Required argument: the object to close
79 Keyword argument saving: specifies whether changes should be saved before closing
80 Keyword argument saving_in: the file in which to save the object
81 Keyword argument _attributes: AppleEvent attribute dictionary
82 """
83 _code = 'core'
84 _subcode = 'clos'
86 aetools.keysubst(_arguments, self._argmap_close)
87 _arguments['----'] = _object
89 aetools.enumsubst(_arguments, 'savo', _Enum_savo)
91 _reply, _arguments, _attributes = self.send(_code, _subcode,
92 _arguments, _attributes)
93 if _arguments.has_key('errn'):
94 raise MacOS.Error, aetools.decodeerror(_arguments)
95 # XXXX Optionally decode result
96 if _arguments.has_key('----'):
97 return _arguments['----']
99 _argmap_count = {
100 'each' : 'kocl',
103 def count(self, _object, _attributes={}, **_arguments):
104 """count: Return the number of elements of a particular class within an object
105 Required argument: the object whose elements are to be counted
106 Keyword argument each: the class of the elements to be counted.
107 Keyword argument _attributes: AppleEvent attribute dictionary
108 Returns: the number of elements
110 _code = 'core'
111 _subcode = 'cnte'
113 aetools.keysubst(_arguments, self._argmap_count)
114 _arguments['----'] = _object
117 _reply, _arguments, _attributes = self.send(_code, _subcode,
118 _arguments, _attributes)
119 if _arguments.has_key('errn'):
120 raise MacOS.Error, aetools.decodeerror(_arguments)
121 # XXXX Optionally decode result
122 if _arguments.has_key('----'):
123 return _arguments['----']
125 _argmap_data_size = {
126 'as' : 'rtyp',
129 def data_size(self, _object, _attributes={}, **_arguments):
130 """data size: Return the size in bytes of an object
131 Required argument: the object whose data size is to be returned
132 Keyword argument as: the data type for which the size is calculated
133 Keyword argument _attributes: AppleEvent attribute dictionary
134 Returns: the size of the object in bytes
136 _code = 'core'
137 _subcode = 'dsiz'
139 aetools.keysubst(_arguments, self._argmap_data_size)
140 _arguments['----'] = _object
143 _reply, _arguments, _attributes = self.send(_code, _subcode,
144 _arguments, _attributes)
145 if _arguments.has_key('errn'):
146 raise MacOS.Error, aetools.decodeerror(_arguments)
147 # XXXX Optionally decode result
148 if _arguments.has_key('----'):
149 return _arguments['----']
151 def delete(self, _object, _attributes={}, **_arguments):
152 """delete: Delete an element from an object
153 Required argument: the element to delete
154 Keyword argument _attributes: AppleEvent attribute dictionary
156 _code = 'core'
157 _subcode = 'delo'
159 if _arguments: raise TypeError, 'No optional args expected'
160 _arguments['----'] = _object
163 _reply, _arguments, _attributes = self.send(_code, _subcode,
164 _arguments, _attributes)
165 if _arguments.has_key('errn'):
166 raise MacOS.Error, aetools.decodeerror(_arguments)
167 # XXXX Optionally decode result
168 if _arguments.has_key('----'):
169 return _arguments['----']
171 _argmap_duplicate = {
172 'to' : 'insh',
175 def duplicate(self, _object, _attributes={}, **_arguments):
176 """duplicate: Duplicate object(s)
177 Required argument: the object(s) to duplicate
178 Keyword argument to: the new location for the object(s)
179 Keyword argument _attributes: AppleEvent attribute dictionary
180 Returns: to the duplicated object(s)
182 _code = 'core'
183 _subcode = 'clon'
185 aetools.keysubst(_arguments, self._argmap_duplicate)
186 _arguments['----'] = _object
189 _reply, _arguments, _attributes = self.send(_code, _subcode,
190 _arguments, _attributes)
191 if _arguments.has_key('errn'):
192 raise MacOS.Error, aetools.decodeerror(_arguments)
193 # XXXX Optionally decode result
194 if _arguments.has_key('----'):
195 return _arguments['----']
197 _argmap_event_info = {
198 '_in' : 'wrcd',
201 def event_info(self, _object, _attributes={}, **_arguments):
202 """event info: Get information about the Apple events in a suite
203 Required argument: the event class of the Apple events for which to return information
204 Keyword argument _in: the human language and script system in which to return information
205 Keyword argument _attributes: AppleEvent attribute dictionary
206 Returns: a record containing the events and their parameters
208 _code = 'core'
209 _subcode = 'gtei'
211 aetools.keysubst(_arguments, self._argmap_event_info)
212 _arguments['----'] = _object
215 _reply, _arguments, _attributes = self.send(_code, _subcode,
216 _arguments, _attributes)
217 if _arguments.has_key('errn'):
218 raise MacOS.Error, aetools.decodeerror(_arguments)
219 # XXXX Optionally decode result
220 if _arguments.has_key('----'):
221 return _arguments['----']
223 def exists(self, _object, _attributes={}, **_arguments):
224 """exists: Verify if an object exists
225 Required argument: the object in question
226 Keyword argument _attributes: AppleEvent attribute dictionary
227 Returns: true if it exists, false if not
229 _code = 'core'
230 _subcode = 'doex'
232 if _arguments: raise TypeError, 'No optional args expected'
233 _arguments['----'] = _object
236 _reply, _arguments, _attributes = self.send(_code, _subcode,
237 _arguments, _attributes)
238 if _arguments.has_key('errn'):
239 raise MacOS.Error, aetools.decodeerror(_arguments)
240 # XXXX Optionally decode result
241 if _arguments.has_key('----'):
242 return _arguments['----']
244 _argmap_make = {
245 'new' : 'kocl',
246 'at' : 'insh',
247 'with_data' : 'data',
248 'with_properties' : 'prdt',
251 def make(self, _no_object=None, _attributes={}, **_arguments):
252 """make: Make a new element
253 Keyword argument new: the class of the new element.
254 Keyword argument at: the location at which to insert the element
255 Keyword argument with_data: the initial data for the element
256 Keyword argument with_properties: the initial values for the properties of the element
257 Keyword argument _attributes: AppleEvent attribute dictionary
258 Returns: to the new object(s)
260 _code = 'core'
261 _subcode = 'crel'
263 aetools.keysubst(_arguments, self._argmap_make)
264 if _no_object != None: raise TypeError, 'No direct arg expected'
267 _reply, _arguments, _attributes = self.send(_code, _subcode,
268 _arguments, _attributes)
269 if _arguments.has_key('errn'):
270 raise MacOS.Error, aetools.decodeerror(_arguments)
271 # XXXX Optionally decode result
272 if _arguments.has_key('----'):
273 return _arguments['----']
275 _argmap_move = {
276 'to' : 'insh',
279 def move(self, _object, _attributes={}, **_arguments):
280 """move: Move object(s) to a new location
281 Required argument: the object(s) to move
282 Keyword argument to: the new location for the object(s)
283 Keyword argument _attributes: AppleEvent attribute dictionary
284 Returns: to the object(s) after they have been moved
286 _code = 'core'
287 _subcode = 'move'
289 aetools.keysubst(_arguments, self._argmap_move)
290 _arguments['----'] = _object
293 _reply, _arguments, _attributes = self.send(_code, _subcode,
294 _arguments, _attributes)
295 if _arguments.has_key('errn'):
296 raise MacOS.Error, aetools.decodeerror(_arguments)
297 # XXXX Optionally decode result
298 if _arguments.has_key('----'):
299 return _arguments['----']
301 def open(self, _object, _attributes={}, **_arguments):
302 """open: Open the specified object(s)
303 Required argument: list of objects to open
304 Keyword argument _attributes: AppleEvent attribute dictionary
306 _code = 'aevt'
307 _subcode = 'odoc'
309 if _arguments: raise TypeError, 'No optional args expected'
310 _arguments['----'] = _object
313 _reply, _arguments, _attributes = self.send(_code, _subcode,
314 _arguments, _attributes)
315 if _arguments.has_key('errn'):
316 raise MacOS.Error, aetools.decodeerror(_arguments)
317 # XXXX Optionally decode result
318 if _arguments.has_key('----'):
319 return _arguments['----']
321 def _print(self, _object, _attributes={}, **_arguments):
322 """print: Print the specified object(s)
323 Required argument: list of objects to print
324 Keyword argument _attributes: AppleEvent attribute dictionary
326 _code = 'aevt'
327 _subcode = 'pdoc'
329 if _arguments: raise TypeError, 'No optional args expected'
330 _arguments['----'] = _object
333 _reply, _arguments, _attributes = self.send(_code, _subcode,
334 _arguments, _attributes)
335 if _arguments.has_key('errn'):
336 raise MacOS.Error, aetools.decodeerror(_arguments)
337 # XXXX Optionally decode result
338 if _arguments.has_key('----'):
339 return _arguments['----']
341 _argmap_quit = {
342 'saving' : 'savo',
345 def quit(self, _no_object=None, _attributes={}, **_arguments):
346 """quit: Quit an application program
347 Keyword argument saving: specifies whether to save currently open documents
348 Keyword argument _attributes: AppleEvent attribute dictionary
350 _code = 'aevt'
351 _subcode = 'quit'
353 aetools.keysubst(_arguments, self._argmap_quit)
354 if _no_object != None: raise TypeError, 'No direct arg expected'
356 aetools.enumsubst(_arguments, 'savo', _Enum_savo)
358 _reply, _arguments, _attributes = self.send(_code, _subcode,
359 _arguments, _attributes)
360 if _arguments.has_key('errn'):
361 raise MacOS.Error, aetools.decodeerror(_arguments)
362 # XXXX Optionally decode result
363 if _arguments.has_key('----'):
364 return _arguments['----']
366 _argmap_save = {
367 '_in' : 'kfil',
368 'as' : 'fltp',
371 def save(self, _object, _attributes={}, **_arguments):
372 """save: Save an object
373 Required argument: the object to save
374 Keyword argument _in: the file in which to save the object
375 Keyword argument as: the file type of the document in which to save the data
376 Keyword argument _attributes: AppleEvent attribute dictionary
378 _code = 'core'
379 _subcode = 'save'
381 aetools.keysubst(_arguments, self._argmap_save)
382 _arguments['----'] = _object
385 _reply, _arguments, _attributes = self.send(_code, _subcode,
386 _arguments, _attributes)
387 if _arguments.has_key('errn'):
388 raise MacOS.Error, aetools.decodeerror(_arguments)
389 # XXXX Optionally decode result
390 if _arguments.has_key('----'):
391 return _arguments['----']
393 _argmap_suite_info = {
394 '_in' : 'wrcd',
397 def suite_info(self, _object, _attributes={}, **_arguments):
398 """suite info: Get information about event suite(s)
399 Required argument: the suite for which to return information
400 Keyword argument _in: the human language and script system in which to return information
401 Keyword argument _attributes: AppleEvent attribute dictionary
402 Returns: a record containing the suites and their versions
404 _code = 'core'
405 _subcode = 'gtsi'
407 aetools.keysubst(_arguments, self._argmap_suite_info)
408 _arguments['----'] = _object
411 _reply, _arguments, _attributes = self.send(_code, _subcode,
412 _arguments, _attributes)
413 if _arguments.has_key('errn'):
414 raise MacOS.Error, aetools.decodeerror(_arguments)
415 # XXXX Optionally decode result
416 if _arguments.has_key('----'):
417 return _arguments['----']
420 # Class 'application' ('capp') -- 'An application program'
421 # property 'clipboard' ('pcli') '****' -- 'the clipboard' [mutable list]
422 # property 'frontmost' ('pisf') 'bool' -- 'Is this the frontmost application?' []
423 # property 'name' ('pnam') 'itxt' -- 'the name' []
424 # property 'selection' ('sele') 'csel' -- 'the selection visible to the user' [mutable]
425 # property 'version' ('vers') 'vers' -- 'the version of the application' []
427 # Class 'applications' ('capp') -- 'Every application'
428 # property '' ('c@#!') 'type' -- '' [0]
430 # Class 'character' ('cha ') -- 'A character'
431 # property 'color' ('colr') 'cRGB' -- 'the color' [mutable]
432 # property 'font' ('font') 'ctxt' -- 'the name of the font' [mutable]
433 # property 'size' ('ptsz') 'fixd' -- 'the size in points' [mutable]
434 # property 'writing code' ('psct') 'intl' -- 'the script system and language' []
435 # property 'style' ('txst') 'tsty' -- 'the text style' [mutable]
436 # property 'uniform styles' ('ustl') 'tsty' -- 'the text style' []
438 # Class 'characters' ('cha ') -- 'Every character'
439 # property '' ('c@#!') 'type' -- '' [0]
441 # Class 'document' ('docu') -- 'A document'
442 # property 'modified' ('imod') 'bool' -- 'Has the document been modified since the last save?' []
444 # Class 'documents' ('docu') -- 'Every document'
445 # property '' ('c@#!') 'type' -- '' [0]
447 # Class 'file' ('file') -- 'A file'
448 # property 'stationery' ('pspd') 'bool' -- 'Is the file a stationery file?' [mutable]
450 # Class 'files' ('file') -- 'Every file'
451 # property '' ('c@#!') 'type' -- '' [0]
453 # Class 'selection-object' ('csel') -- 'the selection visible to the user'
454 # property 'contents' ('pcnt') 'type' -- 'the contents of the selection' []
456 # Class 'text' ('ctxt') -- 'Text'
457 # property '' ('c@#!') 'type' -- '' [0]
458 # property 'font' ('font') 'ctxt' -- 'the name of the font of the first character' [mutable]
460 # Class 'text style info' ('tsty') -- 'On and Off styles of text run'
461 # property 'on styles' ('onst') 'styl' -- 'the styles that are on for the text' [enum list]
462 # property 'off styles' ('ofst') 'styl' -- 'the styles that are off for the text' [enum list]
464 # Class 'text style infos' ('tsty') -- 'every text style info'
465 # property '' ('c@#!') 'type' -- '' [0]
467 # Class 'window' ('cwin') -- 'A window'
468 # property 'bounds' ('pbnd') 'qdrt' -- 'the boundary rectangle for the window' [mutable]
469 # property 'closeable' ('hclb') 'bool' -- 'Does the window have a close box?' []
470 # property 'titled' ('ptit') 'bool' -- 'Does the window have a title bar?' []
471 # property 'index' ('pidx') 'long' -- 'the number of the window' [mutable]
472 # property 'floating' ('isfl') 'bool' -- 'Does the window float?' []
473 # property 'modal' ('pmod') 'bool' -- 'Is the window modal?' []
474 # property 'resizable' ('prsz') 'bool' -- 'Is the window resizable?' []
475 # property 'zoomable' ('iszm') 'bool' -- 'Is the window zoomable?' []
476 # property 'zoomed' ('pzum') 'bool' -- 'Is the window zoomed?' [mutable]
477 # property 'visible' ('pvis') 'bool' -- 'Is the window visible?' [mutable]
479 # Class 'windows' ('cwin') -- 'Every window'
480 # property '' ('c@#!') 'type' -- '' [0]
482 # Class 'insertion point' ('cins') -- 'An insertion location between two objects'
484 # Class 'insertion points' ('cins') -- 'Every insertion location'
485 # property '' ('c@#!') 'type' -- '' [0]
486 # comparison 'starts with' ('bgwt') -- Starts with
487 # comparison 'contains' ('cont') -- Contains
488 # comparison 'ends with' ('ends') -- Ends with
489 # comparison '=' ('= ') -- Equal
490 # comparison '>' ('> ') -- Greater than
491 # comparison '\263' ('>= ') -- Greater than or equal to
492 # comparison '<' ('< ') -- Less than
493 # comparison '\262' ('<= ') -- Less than or equal to