Whitespace normalization.
[python/dscho.git] / Lib / plat-mac / lib-scriptpackages / StdSuites / Standard_Suite.py
blobde6d5e5c3120c7b5691dbb6fa256f3a47371ced5
1 """Suite Standard Suite: Common terms for most applications
2 Level 1, version 1
4 Generated from /Volumes/Sap/System Folder/Extensions/AppleScript
5 AETE/AEUT resource version 1/0, language 0, script 0
6 """
8 import aetools
9 import MacOS
11 _code = 'core'
13 from _builtinSuites.builtin_Suite import *
14 class Standard_Suite_Events(builtin_Suite_Events):
16 _argmap_class_info = {
17 'in_' : 'wrcd',
20 def class_info(self, _object=None, _attributes={}, **_arguments):
21 """class info: (optional) Get information about an object class
22 Required argument: the object class about which information is requested
23 Keyword argument in_: the human language and script system in which to return information
24 Keyword argument _attributes: AppleEvent attribute dictionary
25 Returns: a record containing the object\xd5s properties and elements
26 """
27 _code = 'core'
28 _subcode = 'qobj'
30 aetools.keysubst(_arguments, self._argmap_class_info)
31 _arguments['----'] = _object
34 _reply, _arguments, _attributes = self.send(_code, _subcode,
35 _arguments, _attributes)
36 if _arguments.get('errn', 0):
37 raise aetools.Error, aetools.decodeerror(_arguments)
38 # XXXX Optionally decode result
39 if _arguments.has_key('----'):
40 return _arguments['----']
42 _argmap_close = {
43 'saving' : 'savo',
44 'saving_in' : 'kfil',
47 def close(self, _object, _attributes={}, **_arguments):
48 """close: Close an object
49 Required argument: the object to close
50 Keyword argument saving: specifies whether changes should be saved before closing
51 Keyword argument saving_in: the file or alias in which to save the object
52 Keyword argument _attributes: AppleEvent attribute dictionary
53 """
54 _code = 'core'
55 _subcode = 'clos'
57 aetools.keysubst(_arguments, self._argmap_close)
58 _arguments['----'] = _object
60 aetools.enumsubst(_arguments, 'savo', _Enum_savo)
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['----']
70 _argmap_count = {
71 'each' : 'kocl',
74 def count(self, _object, _attributes={}, **_arguments):
75 """count: Return the number of elements of an object
76 Required argument: the object whose elements are to be counted
77 Keyword argument each: if specified, restricts counting to objects of this class
78 Keyword argument _attributes: AppleEvent attribute dictionary
79 Returns: the number of elements
80 """
81 _code = 'core'
82 _subcode = 'cnte'
84 aetools.keysubst(_arguments, self._argmap_count)
85 _arguments['----'] = _object
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['----']
96 _argmap_data_size = {
97 'as' : 'rtyp',
100 def data_size(self, _object, _attributes={}, **_arguments):
101 """data size: (optional) Return the size in bytes of an object
102 Required argument: the object whose data size is to be returned
103 Keyword argument as: the data type for which the size is calculated
104 Keyword argument _attributes: AppleEvent attribute dictionary
105 Returns: the size of the object in bytes
107 _code = 'core'
108 _subcode = 'dsiz'
110 aetools.keysubst(_arguments, self._argmap_data_size)
111 _arguments['----'] = _object
114 _reply, _arguments, _attributes = self.send(_code, _subcode,
115 _arguments, _attributes)
116 if _arguments.get('errn', 0):
117 raise aetools.Error, aetools.decodeerror(_arguments)
118 # XXXX Optionally decode result
119 if _arguments.has_key('----'):
120 return _arguments['----']
122 def delete(self, _object, _attributes={}, **_arguments):
123 """delete: Delete an object from its container. Note this does not work on script variables, only on elements of application classes.
124 Required argument: the element to delete
125 Keyword argument _attributes: AppleEvent attribute dictionary
127 _code = 'core'
128 _subcode = 'delo'
130 if _arguments: raise TypeError, 'No optional args expected'
131 _arguments['----'] = _object
134 _reply, _arguments, _attributes = self.send(_code, _subcode,
135 _arguments, _attributes)
136 if _arguments.get('errn', 0):
137 raise aetools.Error, aetools.decodeerror(_arguments)
138 # XXXX Optionally decode result
139 if _arguments.has_key('----'):
140 return _arguments['----']
142 _argmap_duplicate = {
143 'to' : 'insh',
144 'with_properties' : 'prdt',
147 def duplicate(self, _object, _attributes={}, **_arguments):
148 """duplicate: Duplicate one or more objects
149 Required argument: the object(s) to duplicate
150 Keyword argument to: the new location for the object(s)
151 Keyword argument with_properties: the initial values for properties of the new object that are to be different from the original
152 Keyword argument _attributes: AppleEvent attribute dictionary
153 Returns: to the duplicated object(s)
155 _code = 'core'
156 _subcode = 'clon'
158 aetools.keysubst(_arguments, self._argmap_duplicate)
159 _arguments['----'] = _object
162 _reply, _arguments, _attributes = self.send(_code, _subcode,
163 _arguments, _attributes)
164 if _arguments.get('errn', 0):
165 raise aetools.Error, aetools.decodeerror(_arguments)
166 # XXXX Optionally decode result
167 if _arguments.has_key('----'):
168 return _arguments['----']
170 _argmap_event_info = {
171 'in_' : 'wrcd',
174 def event_info(self, _object, _attributes={}, **_arguments):
175 """event info: (optional) Get information about the Apple events in a suite
176 Required argument: the event class of the Apple events for which to return information
177 Keyword argument in_: the human language and script system in which to return information
178 Keyword argument _attributes: AppleEvent attribute dictionary
179 Returns: a record containing the events and their parameters
181 _code = 'core'
182 _subcode = 'gtei'
184 aetools.keysubst(_arguments, self._argmap_event_info)
185 _arguments['----'] = _object
188 _reply, _arguments, _attributes = self.send(_code, _subcode,
189 _arguments, _attributes)
190 if _arguments.get('errn', 0):
191 raise aetools.Error, aetools.decodeerror(_arguments)
192 # XXXX Optionally decode result
193 if _arguments.has_key('----'):
194 return _arguments['----']
196 def exists(self, _object, _attributes={}, **_arguments):
197 """exists: Verify if an object exists
198 Required argument: the object in question
199 Keyword argument _attributes: AppleEvent attribute dictionary
200 Returns: true if it exists, false if not
202 _code = 'core'
203 _subcode = 'doex'
205 if _arguments: raise TypeError, 'No optional args expected'
206 _arguments['----'] = _object
209 _reply, _arguments, _attributes = self.send(_code, _subcode,
210 _arguments, _attributes)
211 if _arguments.get('errn', 0):
212 raise aetools.Error, aetools.decodeerror(_arguments)
213 # XXXX Optionally decode result
214 if _arguments.has_key('----'):
215 return _arguments['----']
217 def handleBreakpoint(self, _object, _attributes={}, **_arguments):
218 """handleBreakpoint: return true to stop at a breakpoint
219 Required argument: the call frame of the breakpoint
220 Keyword argument _attributes: AppleEvent attribute dictionary
221 Returns: true to stop, false if not
223 _code = 'core'
224 _subcode = 'brak'
226 if _arguments: raise TypeError, 'No optional args expected'
227 _arguments['----'] = _object
230 _reply, _arguments, _attributes = self.send(_code, _subcode,
231 _arguments, _attributes)
232 if _arguments.get('errn', 0):
233 raise aetools.Error, aetools.decodeerror(_arguments)
234 # XXXX Optionally decode result
235 if _arguments.has_key('----'):
236 return _arguments['----']
238 _argmap_make = {
239 'new' : 'kocl',
240 'at' : 'insh',
241 'with_data' : 'data',
242 'with_properties' : 'prdt',
245 def make(self, _no_object=None, _attributes={}, **_arguments):
246 """make: Make a new element
247 Keyword argument new: the class of the new element
248 Keyword argument at: the location at which to insert the element
249 Keyword argument with_data: the initial data for the element
250 Keyword argument with_properties: the initial values for the properties of the element
251 Keyword argument _attributes: AppleEvent attribute dictionary
252 Returns: to the new object(s)
254 _code = 'core'
255 _subcode = 'crel'
257 aetools.keysubst(_arguments, self._argmap_make)
258 if _no_object != None: raise TypeError, 'No direct arg expected'
261 _reply, _arguments, _attributes = self.send(_code, _subcode,
262 _arguments, _attributes)
263 if _arguments.get('errn', 0):
264 raise aetools.Error, aetools.decodeerror(_arguments)
265 # XXXX Optionally decode result
266 if _arguments.has_key('----'):
267 return _arguments['----']
269 _argmap_move = {
270 'to' : 'insh',
273 def move(self, _object, _attributes={}, **_arguments):
274 """move: Move object(s) to a new location
275 Required argument: the object(s) to move
276 Keyword argument to: the new location for the object(s)
277 Keyword argument _attributes: AppleEvent attribute dictionary
278 Returns: to the object(s) after they have been moved
280 _code = 'core'
281 _subcode = 'move'
283 aetools.keysubst(_arguments, self._argmap_move)
284 _arguments['----'] = _object
287 _reply, _arguments, _attributes = self.send(_code, _subcode,
288 _arguments, _attributes)
289 if _arguments.get('errn', 0):
290 raise aetools.Error, aetools.decodeerror(_arguments)
291 # XXXX Optionally decode result
292 if _arguments.has_key('----'):
293 return _arguments['----']
295 def open(self, _object, _attributes={}, **_arguments):
296 """open: Open the specified object(s)
297 Required argument: list of objects to open
298 Keyword argument _attributes: AppleEvent attribute dictionary
300 _code = 'aevt'
301 _subcode = 'odoc'
303 if _arguments: raise TypeError, 'No optional args expected'
304 _arguments['----'] = _object
307 _reply, _arguments, _attributes = self.send(_code, _subcode,
308 _arguments, _attributes)
309 if _arguments.get('errn', 0):
310 raise aetools.Error, aetools.decodeerror(_arguments)
311 # XXXX Optionally decode result
312 if _arguments.has_key('----'):
313 return _arguments['----']
315 def print_(self, _object, _attributes={}, **_arguments):
316 """print: Print the specified object(s)
317 Required argument: list of objects to print
318 Keyword argument _attributes: AppleEvent attribute dictionary
320 _code = 'aevt'
321 _subcode = 'pdoc'
323 if _arguments: raise TypeError, 'No optional args expected'
324 _arguments['----'] = _object
327 _reply, _arguments, _attributes = self.send(_code, _subcode,
328 _arguments, _attributes)
329 if _arguments.get('errn', 0):
330 raise aetools.Error, aetools.decodeerror(_arguments)
331 # XXXX Optionally decode result
332 if _arguments.has_key('----'):
333 return _arguments['----']
335 _argmap_quit = {
336 'saving' : 'savo',
339 def quit(self, _no_object=None, _attributes={}, **_arguments):
340 """quit: Quit an application
341 Keyword argument saving: specifies whether to save currently open documents
342 Keyword argument _attributes: AppleEvent attribute dictionary
344 _code = 'aevt'
345 _subcode = 'quit'
347 aetools.keysubst(_arguments, self._argmap_quit)
348 if _no_object != None: raise TypeError, 'No direct arg expected'
350 aetools.enumsubst(_arguments, 'savo', _Enum_savo)
352 _reply, _arguments, _attributes = self.send(_code, _subcode,
353 _arguments, _attributes)
354 if _arguments.get('errn', 0):
355 raise aetools.Error, aetools.decodeerror(_arguments)
356 # XXXX Optionally decode result
357 if _arguments.has_key('----'):
358 return _arguments['----']
360 def reopen(self, _no_object=None, _attributes={}, **_arguments):
361 """reopen: Reactivate a running application. Some applications will open a new untitled window if no window is open.
362 Keyword argument _attributes: AppleEvent attribute dictionary
364 _code = 'aevt'
365 _subcode = 'rapp'
367 if _arguments: raise TypeError, 'No optional args expected'
368 if _no_object != None: raise TypeError, 'No direct arg expected'
371 _reply, _arguments, _attributes = self.send(_code, _subcode,
372 _arguments, _attributes)
373 if _arguments.get('errn', 0):
374 raise aetools.Error, aetools.decodeerror(_arguments)
375 # XXXX Optionally decode result
376 if _arguments.has_key('----'):
377 return _arguments['----']
379 def run(self, _no_object=None, _attributes={}, **_arguments):
380 """run: Run an application. Most applications will open an empty, untitled window.
381 Keyword argument _attributes: AppleEvent attribute dictionary
383 _code = 'aevt'
384 _subcode = 'oapp'
386 if _arguments: raise TypeError, 'No optional args expected'
387 if _no_object != None: raise TypeError, 'No direct arg expected'
390 _reply, _arguments, _attributes = self.send(_code, _subcode,
391 _arguments, _attributes)
392 if _arguments.get('errn', 0):
393 raise aetools.Error, aetools.decodeerror(_arguments)
394 # XXXX Optionally decode result
395 if _arguments.has_key('----'):
396 return _arguments['----']
398 _argmap_save = {
399 'in_' : 'kfil',
400 'as' : 'fltp',
403 def save(self, _object, _attributes={}, **_arguments):
404 """save: Save an object
405 Required argument: the object to save, usually a document or window
406 Keyword argument in_: the file or alias in which to save the object
407 Keyword argument as: the file type of the document in which to save the data
408 Keyword argument _attributes: AppleEvent attribute dictionary
410 _code = 'core'
411 _subcode = 'save'
413 aetools.keysubst(_arguments, self._argmap_save)
414 _arguments['----'] = _object
417 _reply, _arguments, _attributes = self.send(_code, _subcode,
418 _arguments, _attributes)
419 if _arguments.get('errn', 0):
420 raise aetools.Error, aetools.decodeerror(_arguments)
421 # XXXX Optionally decode result
422 if _arguments.has_key('----'):
423 return _arguments['----']
425 def select(self, _object, _attributes={}, **_arguments):
426 """select: Make a selection
427 Required argument: the object to select
428 Keyword argument _attributes: AppleEvent attribute dictionary
430 _code = 'misc'
431 _subcode = 'slct'
433 if _arguments: raise TypeError, 'No optional args expected'
434 _arguments['----'] = _object
437 _reply, _arguments, _attributes = self.send(_code, _subcode,
438 _arguments, _attributes)
439 if _arguments.get('errn', 0):
440 raise aetools.Error, aetools.decodeerror(_arguments)
441 # XXXX Optionally decode result
442 if _arguments.has_key('----'):
443 return _arguments['----']
445 _argmap_suite_info = {
446 'in_' : 'wrcd',
449 def suite_info(self, _object, _attributes={}, **_arguments):
450 """suite info: (optional) Get information about event suite(s)
451 Required argument: the suite for which to return information
452 Keyword argument in_: the human language and script system in which to return information
453 Keyword argument _attributes: AppleEvent attribute dictionary
454 Returns: a record containing the suites and their versions
456 _code = 'core'
457 _subcode = 'gtsi'
459 aetools.keysubst(_arguments, self._argmap_suite_info)
460 _arguments['----'] = _object
463 _reply, _arguments, _attributes = self.send(_code, _subcode,
464 _arguments, _attributes)
465 if _arguments.get('errn', 0):
466 raise aetools.Error, aetools.decodeerror(_arguments)
467 # XXXX Optionally decode result
468 if _arguments.has_key('----'):
469 return _arguments['----']
472 class alias(aetools.ComponentItem):
473 """alias - a file on a disk or server. The file must exist when you check the syntax of your script. """
474 want = 'alis'
475 class _Prop_POSIX_path(aetools.NProperty):
476 """POSIX path - the POSIX path of the file """
477 which = 'psxp'
478 want = 'TEXT'
480 aliases = alias
482 class application(aetools.ComponentItem):
483 """application - An application program """
484 want = 'capp'
485 class _Prop_clipboard(aetools.NProperty):
486 """clipboard - the contents of the clipboard for this application """
487 which = 'pcli'
488 want = '****'
489 clipboard = _Prop_clipboard()
490 class _Prop_frontmost(aetools.NProperty):
491 """frontmost - Is this the frontmost application? """
492 which = 'pisf'
493 want = 'bool'
494 frontmost = _Prop_frontmost()
495 class _Prop_name(aetools.NProperty):
496 """name - the name of the application """
497 which = 'pnam'
498 want = 'itxt'
499 name = _Prop_name()
500 class _Prop_selection(aetools.NProperty):
501 """selection - the selection visible to the user. Use the \xd4select\xd5 command to set a new selection; use \xd4contents of selection\xd5 to get or change information in the document. """
502 which = 'sele'
503 want = 'csel'
504 selection = _Prop_selection()
505 class _Prop_version(aetools.NProperty):
506 """version - the version of the application """
507 which = 'vers'
508 want = 'vers'
509 version = _Prop_version()
511 applications = application
513 class insertion_points(aetools.ComponentItem):
514 """insertion points - """
515 want = 'cins'
517 insertion_point = insertion_points
519 class selection_2d_object(aetools.ComponentItem):
520 """selection-object - A way to refer to the state of the current of the selection. Use the \xd4select\xd5 command to make a new selection. """
521 want = 'csel'
522 class _Prop_contents(aetools.NProperty):
523 """contents - the information currently selected. Use \xd4contents of selection\xd5 to get or change information in a document. """
524 which = 'pcnt'
525 want = '****'
527 class window(aetools.ComponentItem):
528 """window - A window """
529 want = 'cwin'
530 class _Prop_bounds(aetools.NProperty):
531 """bounds - the boundary rectangle for the window """
532 which = 'pbnd'
533 want = 'qdrt'
534 class _Prop_closeable(aetools.NProperty):
535 """closeable - Does the window have a close box? """
536 which = 'hclb'
537 want = 'bool'
538 class _Prop_floating(aetools.NProperty):
539 """floating - Does the window float? """
540 which = 'isfl'
541 want = 'bool'
542 class _Prop_index(aetools.NProperty):
543 """index - the number of the window """
544 which = 'pidx'
545 want = 'long'
546 class _Prop_modal(aetools.NProperty):
547 """modal - Is the window modal? """
548 which = 'pmod'
549 want = 'bool'
550 class _Prop_resizable(aetools.NProperty):
551 """resizable - Is the window resizable? """
552 which = 'prsz'
553 want = 'bool'
554 class _Prop_titled(aetools.NProperty):
555 """titled - Does the window have a title bar? """
556 which = 'ptit'
557 want = 'bool'
558 class _Prop_visible(aetools.NProperty):
559 """visible - Is the window visible? """
560 which = 'pvis'
561 want = 'bool'
562 class _Prop_zoomable(aetools.NProperty):
563 """zoomable - Is the window zoomable? """
564 which = 'iszm'
565 want = 'bool'
566 class _Prop_zoomed(aetools.NProperty):
567 """zoomed - Is the window zoomed? """
568 which = 'pzum'
569 want = 'bool'
571 windows = window
573 class document(aetools.ComponentItem):
574 """document - A document of a scriptable application """
575 want = 'docu'
576 class _Prop_modified(aetools.NProperty):
577 """modified - Has the document been modified since the last save? """
578 which = 'imod'
579 want = 'bool'
581 documents = document
583 class file(aetools.ComponentItem):
584 """file - a file on a disk or server """
585 want = 'file'
587 files = file
588 alias._superclassnames = []
589 alias._privpropdict = {
590 'POSIX_path' : _Prop_POSIX_path,
592 alias._privelemdict = {
594 application._superclassnames = []
595 application._privpropdict = {
596 'clipboard' : _Prop_clipboard,
597 'frontmost' : _Prop_frontmost,
598 'name' : _Prop_name,
599 'selection' : _Prop_selection,
600 'version' : _Prop_version,
602 application._privelemdict = {
604 insertion_points._superclassnames = []
605 insertion_points._privpropdict = {
607 insertion_points._privelemdict = {
609 selection_2d_object._superclassnames = []
610 selection_2d_object._privpropdict = {
611 'contents' : _Prop_contents,
613 selection_2d_object._privelemdict = {
615 window._superclassnames = []
616 window._privpropdict = {
617 'bounds' : _Prop_bounds,
618 'closeable' : _Prop_closeable,
619 'floating' : _Prop_floating,
620 'index' : _Prop_index,
621 'modal' : _Prop_modal,
622 'resizable' : _Prop_resizable,
623 'titled' : _Prop_titled,
624 'visible' : _Prop_visible,
625 'zoomable' : _Prop_zoomable,
626 'zoomed' : _Prop_zoomed,
628 window._privelemdict = {
630 document._superclassnames = []
631 document._privpropdict = {
632 'modified' : _Prop_modified,
634 document._privelemdict = {
636 file._superclassnames = []
637 file._privpropdict = {
638 'POSIX_path' : _Prop_POSIX_path,
640 file._privelemdict = {
642 class _3c_(aetools.NComparison):
643 """< - Less than """
644 class _3d_(aetools.NComparison):
645 """= - Equal """
646 class _3e_(aetools.NComparison):
647 """> - Greater than """
648 class contains(aetools.NComparison):
649 """contains - Contains """
650 class ends_with(aetools.NComparison):
651 """ends with - Ends with """
652 class starts_with(aetools.NComparison):
653 """starts with - Starts with """
654 class _b2_(aetools.NComparison):
655 """\xb2 - Less than or equal to """
656 class _b3_(aetools.NComparison):
657 """\xb3 - Greater than or equal to """
658 _Enum_kfrm = {
659 'index' : 'indx', # keyform designating indexed access
660 'named' : 'name', # keyform designating named access
661 'id' : 'ID ', # keyform designating access by unique identifier
664 _Enum_savo = {
665 'yes' : 'yes ', # Save objects now
666 'no' : 'no ', # Do not save objects
667 'ask' : 'ask ', # Ask the user whether to save
670 _Enum_styl = {
671 'plain' : 'plan', # Plain
672 'bold' : 'bold', # Bold
673 'italic' : 'ital', # Italic
674 'outline' : 'outl', # Outline
675 'shadow' : 'shad', # Shadow
676 'underline' : 'undl', # Underline
677 'superscript' : 'spsc', # Superscript
678 'subscript' : 'sbsc', # Subscript
679 'strikethrough' : 'strk', # Strikethrough
680 'small_caps' : 'smcp', # Small caps
681 'all_caps' : 'alcp', # All capital letters
682 'all_lowercase' : 'lowc', # Lowercase
683 'condensed' : 'cond', # Condensed
684 'expanded' : 'pexp', # Expanded
685 'hidden' : 'hidn', # Hidden
690 # Indices of types declared in this module
692 _classdeclarations = {
693 'alis' : alias,
694 'capp' : application,
695 'cins' : insertion_points,
696 'csel' : selection_2d_object,
697 'cwin' : window,
698 'docu' : document,
699 'file' : file,
702 _propdeclarations = {
703 'hclb' : _Prop_closeable,
704 'imod' : _Prop_modified,
705 'isfl' : _Prop_floating,
706 'iszm' : _Prop_zoomable,
707 'pbnd' : _Prop_bounds,
708 'pcli' : _Prop_clipboard,
709 'pcnt' : _Prop_contents,
710 'pidx' : _Prop_index,
711 'pisf' : _Prop_frontmost,
712 'pmod' : _Prop_modal,
713 'pnam' : _Prop_name,
714 'prsz' : _Prop_resizable,
715 'psxp' : _Prop_POSIX_path,
716 'ptit' : _Prop_titled,
717 'pvis' : _Prop_visible,
718 'pzum' : _Prop_zoomed,
719 'sele' : _Prop_selection,
720 'vers' : _Prop_version,
723 _compdeclarations = {
724 '< ' : _3c_,
725 '<= ' : _b2_,
726 '= ' : _3d_,
727 '> ' : _3e_,
728 '>= ' : _b3_,
729 'bgwt' : starts_with,
730 'cont' : contains,
731 'ends' : ends_with,
734 _enumdeclarations = {
735 'kfrm' : _Enum_kfrm,
736 'savo' : _Enum_savo,
737 'styl' : _Enum_styl,