Bump version to 0.9.1.
[python/dscho.git] / Mac / Lib / lib-scripting / Standard_Suite.py
blob36eaed8aa8ae5371698c8ddf9db40a8e09a0ab3e
1 """Suite Standard Suite: Common terms for most applications
2 Level 1, version 1
4 Generated from flap: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 class Standard_Suite:
15 _argmap_class_info = {
16 '_in' : 'wrcd',
19 def class_info(self, _object=None, _attributes={}, **_arguments):
20 """class info: Get information about an object class
21 Required argument: the object class about which information is requested
22 Keyword argument _in: the human language and script system in which to return information
23 Keyword argument _attributes: AppleEvent attribute dictionary
24 Returns: a record containing the object¹s properties and elements
25 """
26 _code = 'core'
27 _subcode = 'qobj'
29 aetools.keysubst(_arguments, self._argmap_class_info)
30 _arguments['----'] = _object
33 _reply, _arguments, _attributes = self.send(_code, _subcode,
34 _arguments, _attributes)
35 if _arguments.has_key('errn'):
36 raise aetools.Error, aetools.decodeerror(_arguments)
37 # XXXX Optionally decode result
38 if _arguments.has_key('----'):
39 return _arguments['----']
41 _argmap_close = {
42 'saving' : 'savo',
43 'saving_in' : 'kfil',
46 def close(self, _object, _attributes={}, **_arguments):
47 """close: Close an object
48 Required argument: the object to close
49 Keyword argument saving: specifies whether changes should be saved before closing
50 Keyword argument saving_in: the file in which to save the object
51 Keyword argument _attributes: AppleEvent attribute dictionary
52 """
53 _code = 'core'
54 _subcode = 'clos'
56 aetools.keysubst(_arguments, self._argmap_close)
57 _arguments['----'] = _object
59 aetools.enumsubst(_arguments, 'savo', _Enum_savo)
61 _reply, _arguments, _attributes = self.send(_code, _subcode,
62 _arguments, _attributes)
63 if _arguments.has_key('errn'):
64 raise aetools.Error, aetools.decodeerror(_arguments)
65 # XXXX Optionally decode result
66 if _arguments.has_key('----'):
67 return _arguments['----']
69 _argmap_count = {
70 'each' : 'kocl',
73 def count(self, _object, _attributes={}, **_arguments):
74 """count: Return the number of elements of a particular class within an object
75 Required argument: the object whose elements are to be counted
76 Keyword argument each: the class of the elements to be counted.
77 Keyword argument _attributes: AppleEvent attribute dictionary
78 Returns: the number of elements
79 """
80 _code = 'core'
81 _subcode = 'cnte'
83 aetools.keysubst(_arguments, self._argmap_count)
84 _arguments['----'] = _object
87 _reply, _arguments, _attributes = self.send(_code, _subcode,
88 _arguments, _attributes)
89 if _arguments.has_key('errn'):
90 raise aetools.Error, aetools.decodeerror(_arguments)
91 # XXXX Optionally decode result
92 if _arguments.has_key('----'):
93 return _arguments['----']
95 _argmap_data_size = {
96 'as' : 'rtyp',
99 def data_size(self, _object, _attributes={}, **_arguments):
100 """data size: Return the size in bytes of an object
101 Required argument: the object whose data size is to be returned
102 Keyword argument as: the data type for which the size is calculated
103 Keyword argument _attributes: AppleEvent attribute dictionary
104 Returns: the size of the object in bytes
106 _code = 'core'
107 _subcode = 'dsiz'
109 aetools.keysubst(_arguments, self._argmap_data_size)
110 _arguments['----'] = _object
113 _reply, _arguments, _attributes = self.send(_code, _subcode,
114 _arguments, _attributes)
115 if _arguments.has_key('errn'):
116 raise aetools.Error, aetools.decodeerror(_arguments)
117 # XXXX Optionally decode result
118 if _arguments.has_key('----'):
119 return _arguments['----']
121 def delete(self, _object, _attributes={}, **_arguments):
122 """delete: Delete an element from an object
123 Required argument: the element to delete
124 Keyword argument _attributes: AppleEvent attribute dictionary
126 _code = 'core'
127 _subcode = 'delo'
129 if _arguments: raise TypeError, 'No optional args expected'
130 _arguments['----'] = _object
133 _reply, _arguments, _attributes = self.send(_code, _subcode,
134 _arguments, _attributes)
135 if _arguments.has_key('errn'):
136 raise aetools.Error, aetools.decodeerror(_arguments)
137 # XXXX Optionally decode result
138 if _arguments.has_key('----'):
139 return _arguments['----']
141 _argmap_duplicate = {
142 'to' : 'insh',
145 def duplicate(self, _object, _attributes={}, **_arguments):
146 """duplicate: Duplicate object(s)
147 Required argument: the object(s) to duplicate
148 Keyword argument to: the new location for the object(s)
149 Keyword argument _attributes: AppleEvent attribute dictionary
150 Returns: to the duplicated object(s)
152 _code = 'core'
153 _subcode = 'clon'
155 aetools.keysubst(_arguments, self._argmap_duplicate)
156 _arguments['----'] = _object
159 _reply, _arguments, _attributes = self.send(_code, _subcode,
160 _arguments, _attributes)
161 if _arguments.has_key('errn'):
162 raise aetools.Error, aetools.decodeerror(_arguments)
163 # XXXX Optionally decode result
164 if _arguments.has_key('----'):
165 return _arguments['----']
167 _argmap_event_info = {
168 '_in' : 'wrcd',
171 def event_info(self, _object, _attributes={}, **_arguments):
172 """event info: Get information about the Apple events in a suite
173 Required argument: the event class of the Apple events for which to return information
174 Keyword argument _in: the human language and script system in which to return information
175 Keyword argument _attributes: AppleEvent attribute dictionary
176 Returns: a record containing the events and their parameters
178 _code = 'core'
179 _subcode = 'gtei'
181 aetools.keysubst(_arguments, self._argmap_event_info)
182 _arguments['----'] = _object
185 _reply, _arguments, _attributes = self.send(_code, _subcode,
186 _arguments, _attributes)
187 if _arguments.has_key('errn'):
188 raise aetools.Error, aetools.decodeerror(_arguments)
189 # XXXX Optionally decode result
190 if _arguments.has_key('----'):
191 return _arguments['----']
193 def exists(self, _object, _attributes={}, **_arguments):
194 """exists: Verify if an object exists
195 Required argument: the object in question
196 Keyword argument _attributes: AppleEvent attribute dictionary
197 Returns: true if it exists, false if not
199 _code = 'core'
200 _subcode = 'doex'
202 if _arguments: raise TypeError, 'No optional args expected'
203 _arguments['----'] = _object
206 _reply, _arguments, _attributes = self.send(_code, _subcode,
207 _arguments, _attributes)
208 if _arguments.has_key('errn'):
209 raise aetools.Error, aetools.decodeerror(_arguments)
210 # XXXX Optionally decode result
211 if _arguments.has_key('----'):
212 return _arguments['----']
214 _argmap_make = {
215 'new' : 'kocl',
216 'at' : 'insh',
217 'with_data' : 'data',
218 'with_properties' : 'prdt',
221 def make(self, _no_object=None, _attributes={}, **_arguments):
222 """make: Make a new element
223 Keyword argument new: the class of the new element.
224 Keyword argument at: the location at which to insert the element
225 Keyword argument with_data: the initial data for the element
226 Keyword argument with_properties: the initial values for the properties of the element
227 Keyword argument _attributes: AppleEvent attribute dictionary
228 Returns: to the new object(s)
230 _code = 'core'
231 _subcode = 'crel'
233 aetools.keysubst(_arguments, self._argmap_make)
234 if _no_object != None: raise TypeError, 'No direct arg expected'
237 _reply, _arguments, _attributes = self.send(_code, _subcode,
238 _arguments, _attributes)
239 if _arguments.has_key('errn'):
240 raise aetools.Error, aetools.decodeerror(_arguments)
241 # XXXX Optionally decode result
242 if _arguments.has_key('----'):
243 return _arguments['----']
245 _argmap_move = {
246 'to' : 'insh',
249 def move(self, _object, _attributes={}, **_arguments):
250 """move: Move object(s) to a new location
251 Required argument: the object(s) to move
252 Keyword argument to: the new location for the object(s)
253 Keyword argument _attributes: AppleEvent attribute dictionary
254 Returns: to the object(s) after they have been moved
256 _code = 'core'
257 _subcode = 'move'
259 aetools.keysubst(_arguments, self._argmap_move)
260 _arguments['----'] = _object
263 _reply, _arguments, _attributes = self.send(_code, _subcode,
264 _arguments, _attributes)
265 if _arguments.has_key('errn'):
266 raise aetools.Error, aetools.decodeerror(_arguments)
267 # XXXX Optionally decode result
268 if _arguments.has_key('----'):
269 return _arguments['----']
271 def open(self, _object, _attributes={}, **_arguments):
272 """open: Open the specified object(s)
273 Required argument: list of objects to open
274 Keyword argument _attributes: AppleEvent attribute dictionary
276 _code = 'aevt'
277 _subcode = 'odoc'
279 if _arguments: raise TypeError, 'No optional args expected'
280 _arguments['----'] = _object
283 _reply, _arguments, _attributes = self.send(_code, _subcode,
284 _arguments, _attributes)
285 if _arguments.has_key('errn'):
286 raise aetools.Error, aetools.decodeerror(_arguments)
287 # XXXX Optionally decode result
288 if _arguments.has_key('----'):
289 return _arguments['----']
291 def _print(self, _object, _attributes={}, **_arguments):
292 """print: Print the specified object(s)
293 Required argument: list of objects to print
294 Keyword argument _attributes: AppleEvent attribute dictionary
296 _code = 'aevt'
297 _subcode = 'pdoc'
299 if _arguments: raise TypeError, 'No optional args expected'
300 _arguments['----'] = _object
303 _reply, _arguments, _attributes = self.send(_code, _subcode,
304 _arguments, _attributes)
305 if _arguments.has_key('errn'):
306 raise aetools.Error, aetools.decodeerror(_arguments)
307 # XXXX Optionally decode result
308 if _arguments.has_key('----'):
309 return _arguments['----']
311 _argmap_quit = {
312 'saving' : 'savo',
315 def quit(self, _no_object=None, _attributes={}, **_arguments):
316 """quit: Quit an application program
317 Keyword argument saving: specifies whether to save currently open documents
318 Keyword argument _attributes: AppleEvent attribute dictionary
320 _code = 'aevt'
321 _subcode = 'quit'
323 aetools.keysubst(_arguments, self._argmap_quit)
324 if _no_object != None: raise TypeError, 'No direct arg expected'
326 aetools.enumsubst(_arguments, 'savo', _Enum_savo)
328 _reply, _arguments, _attributes = self.send(_code, _subcode,
329 _arguments, _attributes)
330 if _arguments.has_key('errn'):
331 raise aetools.Error, aetools.decodeerror(_arguments)
332 # XXXX Optionally decode result
333 if _arguments.has_key('----'):
334 return _arguments['----']
336 _argmap_save = {
337 '_in' : 'kfil',
338 'as' : 'fltp',
341 def save(self, _object, _attributes={}, **_arguments):
342 """save: Save an object
343 Required argument: the object to save
344 Keyword argument _in: the file in which to save the object
345 Keyword argument as: the file type of the document in which to save the data
346 Keyword argument _attributes: AppleEvent attribute dictionary
348 _code = 'core'
349 _subcode = 'save'
351 aetools.keysubst(_arguments, self._argmap_save)
352 _arguments['----'] = _object
355 _reply, _arguments, _attributes = self.send(_code, _subcode,
356 _arguments, _attributes)
357 if _arguments.has_key('errn'):
358 raise aetools.Error, aetools.decodeerror(_arguments)
359 # XXXX Optionally decode result
360 if _arguments.has_key('----'):
361 return _arguments['----']
363 _argmap_suite_info = {
364 '_in' : 'wrcd',
367 def suite_info(self, _object, _attributes={}, **_arguments):
368 """suite info: Get information about event suite(s)
369 Required argument: the suite for which to return information
370 Keyword argument _in: the human language and script system in which to return information
371 Keyword argument _attributes: AppleEvent attribute dictionary
372 Returns: a record containing the suites and their versions
374 _code = 'core'
375 _subcode = 'gtsi'
377 aetools.keysubst(_arguments, self._argmap_suite_info)
378 _arguments['----'] = _object
381 _reply, _arguments, _attributes = self.send(_code, _subcode,
382 _arguments, _attributes)
383 if _arguments.has_key('errn'):
384 raise aetools.Error, aetools.decodeerror(_arguments)
385 # XXXX Optionally decode result
386 if _arguments.has_key('----'):
387 return _arguments['----']
390 class application(aetools.ComponentItem):
391 """application - An application program"""
392 want = 'capp'
393 class clipboard(aetools.NProperty):
394 """clipboard - the clipboard"""
395 which = 'pcli'
396 want = '****'
397 class frontmost(aetools.NProperty):
398 """frontmost - Is this the frontmost application?"""
399 which = 'pisf'
400 want = 'bool'
401 class name(aetools.NProperty):
402 """name - the name"""
403 which = 'pnam'
404 want = 'itxt'
405 class selection(aetools.NProperty):
406 """selection - the selection visible to the user"""
407 which = 'sele'
408 want = 'csel'
409 class version(aetools.NProperty):
410 """version - the version of the application"""
411 which = 'vers'
412 want = 'vers'
414 applications = application
416 class character(aetools.ComponentItem):
417 """character - A character"""
418 want = 'cha '
419 class color(aetools.NProperty):
420 """color - the color"""
421 which = 'colr'
422 want = 'cRGB'
423 class font(aetools.NProperty):
424 """font - the name of the font"""
425 which = 'font'
426 want = 'ctxt'
427 class size(aetools.NProperty):
428 """size - the size in points"""
429 which = 'ptsz'
430 want = 'fixd'
431 class writing_code(aetools.NProperty):
432 """writing code - the script system and language"""
433 which = 'psct'
434 want = 'intl'
435 class style(aetools.NProperty):
436 """style - the text style"""
437 which = 'txst'
438 want = 'tsty'
439 class uniform_styles(aetools.NProperty):
440 """uniform styles - the text style"""
441 which = 'ustl'
442 want = 'tsty'
444 characters = character
446 class document(aetools.ComponentItem):
447 """document - A document"""
448 want = 'docu'
449 class modified(aetools.NProperty):
450 """modified - Has the document been modified since the last save?"""
451 which = 'imod'
452 want = 'bool'
454 documents = document
456 class file(aetools.ComponentItem):
457 """file - A file"""
458 want = 'file'
459 class stationery(aetools.NProperty):
460 """stationery - Is the file a stationery file?"""
461 which = 'pspd'
462 want = 'bool'
464 files = file
466 class selection_2d_object(aetools.ComponentItem):
467 """selection-object - the selection visible to the user"""
468 want = 'csel'
469 class contents(aetools.NProperty):
470 """contents - the contents of the selection"""
471 which = 'pcnt'
472 want = 'type'
474 class text(aetools.ComponentItem):
475 """text - Text"""
476 want = 'ctxt'
477 # repeated property font the name of the font of the first character
479 class text_style_info(aetools.ComponentItem):
480 """text style info - On and Off styles of text run"""
481 want = 'tsty'
482 class on_styles(aetools.NProperty):
483 """on styles - the styles that are on for the text"""
484 which = 'onst'
485 want = 'styl'
486 class off_styles(aetools.NProperty):
487 """off styles - the styles that are off for the text"""
488 which = 'ofst'
489 want = 'styl'
491 text_style_infos = text_style_info
493 class window(aetools.ComponentItem):
494 """window - A window"""
495 want = 'cwin'
496 class bounds(aetools.NProperty):
497 """bounds - the boundary rectangle for the window"""
498 which = 'pbnd'
499 want = 'qdrt'
500 class closeable(aetools.NProperty):
501 """closeable - Does the window have a close box?"""
502 which = 'hclb'
503 want = 'bool'
504 class titled(aetools.NProperty):
505 """titled - Does the window have a title bar?"""
506 which = 'ptit'
507 want = 'bool'
508 class index(aetools.NProperty):
509 """index - the number of the window"""
510 which = 'pidx'
511 want = 'long'
512 class floating(aetools.NProperty):
513 """floating - Does the window float?"""
514 which = 'isfl'
515 want = 'bool'
516 class modal(aetools.NProperty):
517 """modal - Is the window modal?"""
518 which = 'pmod'
519 want = 'bool'
520 class resizable(aetools.NProperty):
521 """resizable - Is the window resizable?"""
522 which = 'prsz'
523 want = 'bool'
524 class zoomable(aetools.NProperty):
525 """zoomable - Is the window zoomable?"""
526 which = 'iszm'
527 want = 'bool'
528 class zoomed(aetools.NProperty):
529 """zoomed - Is the window zoomed?"""
530 which = 'pzum'
531 want = 'bool'
532 class visible(aetools.NProperty):
533 """visible - Is the window visible?"""
534 which = 'pvis'
535 want = 'bool'
537 windows = window
539 class insertion_point(aetools.ComponentItem):
540 """insertion point - An insertion location between two objects"""
541 want = 'cins'
543 insertion_points = insertion_point
544 application._propdict = {
545 'clipboard' : clipboard,
546 'frontmost' : frontmost,
547 'name' : name,
548 'selection' : selection,
549 'version' : version,
551 application._elemdict = {
553 character._propdict = {
554 'color' : color,
555 'font' : font,
556 'size' : size,
557 'writing_code' : writing_code,
558 'style' : style,
559 'uniform_styles' : uniform_styles,
561 character._elemdict = {
563 document._propdict = {
564 'modified' : modified,
566 document._elemdict = {
568 file._propdict = {
569 'stationery' : stationery,
571 file._elemdict = {
573 selection_2d_object._propdict = {
574 'contents' : contents,
576 selection_2d_object._elemdict = {
578 text._propdict = {
579 'font' : font,
581 text._elemdict = {
583 text_style_info._propdict = {
584 'on_styles' : on_styles,
585 'off_styles' : off_styles,
587 text_style_info._elemdict = {
589 window._propdict = {
590 'bounds' : bounds,
591 'closeable' : closeable,
592 'titled' : titled,
593 'index' : index,
594 'floating' : floating,
595 'modal' : modal,
596 'resizable' : resizable,
597 'zoomable' : zoomable,
598 'zoomed' : zoomed,
599 'visible' : visible,
601 window._elemdict = {
603 insertion_point._propdict = {
605 insertion_point._elemdict = {
607 class starts_with(aetools.NComparison):
608 """starts with - Starts with"""
609 class contains(aetools.NComparison):
610 """contains - Contains"""
611 class ends_with(aetools.NComparison):
612 """ends with - Ends with"""
613 class _3d_(aetools.NComparison):
614 """= - Equal"""
615 class _3e_(aetools.NComparison):
616 """> - Greater than"""
617 class _b3_(aetools.NComparison):
618 """„ - Greater than or equal to"""
619 class _3c_(aetools.NComparison):
620 """< - Less than"""
621 class _b2_(aetools.NComparison):
622 """¾ - Less than or equal to"""
623 _Enum_savo = {
624 'yes' : 'yes ', # Save objects now
625 'no' : 'no ', # Do not save objects
626 'ask' : 'ask ', # Ask the user whether to save
629 _Enum_kfrm = {
630 'index' : 'indx', # keyform designating indexed access
631 'named' : 'name', # keyform designating named access
632 'id' : 'ID ', # keyform designating access by unique identifier
635 _Enum_styl = {
636 'plain' : 'plan', # Plain
637 'bold' : 'bold', # Bold
638 'italic' : 'ital', # Italic
639 'outline' : 'outl', # Outline
640 'shadow' : 'shad', # Shadow
641 'underline' : 'undl', # Underline
642 'superscript' : 'spsc', # Superscript
643 'subscript' : 'sbsc', # Subscript
644 'strikethrough' : 'strk', # Strikethrough
645 'small_caps' : 'smcp', # Small caps
646 'all_caps' : 'alcp', # All capital letters
647 'all_lowercase' : 'lowc', # Lowercase
648 'condensed' : 'cond', # Condensed
649 'expanded' : 'pexp', # Expanded
650 'hidden' : 'hidn', # Hidden
655 # Indices of types declared in this module
657 _classdeclarations = {
658 'docu' : document,
659 'tsty' : text_style_info,
660 'ctxt' : text,
661 'capp' : application,
662 'csel' : selection_2d_object,
663 'file' : file,
664 'cwin' : window,
665 'cha ' : character,
666 'cins' : insertion_point,
669 _propdeclarations = {
670 'ptit' : titled,
671 'onst' : on_styles,
672 'pnam' : name,
673 'pcli' : clipboard,
674 'ustl' : uniform_styles,
675 'psct' : writing_code,
676 'txst' : style,
677 'pvis' : visible,
678 'pspd' : stationery,
679 'pisf' : frontmost,
680 'sele' : selection,
681 'pmod' : modal,
682 'imod' : modified,
683 'ofst' : off_styles,
684 'ptsz' : size,
685 'pzum' : zoomed,
686 'hclb' : closeable,
687 'font' : font,
688 'pcnt' : contents,
689 'isfl' : floating,
690 'pidx' : index,
691 'iszm' : zoomable,
692 'colr' : color,
693 'pbnd' : bounds,
694 'vers' : version,
695 'prsz' : resizable,
698 _compdeclarations = {
699 '> ' : _3e_,
700 'bgwt' : starts_with,
701 '>= ' : _b3_,
702 '= ' : _3d_,
703 '<= ' : _b2_,
704 'cont' : contains,
705 'ends' : ends_with,
706 '< ' : _3c_,
709 _enumdeclarations = {
710 'styl' : _Enum_styl,
711 'savo' : _Enum_savo,
712 'kfrm' : _Enum_kfrm,