_make_boundary(): Fix for SF bug #745478, broken boundary calculation
[python/dscho.git] / Lib / plat-mac / lib-scriptpackages / StdSuites / Standard_Suite.py
blob0c1fd7489136dee46d4f306cd34102e9a55ea15c
1 """Suite Standard Suite: Common terms for most applications
2 Level 1, version 1
4 Generated from /Volumes/Moes/Systeemmap/Extensies/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 _argmap_make = {
218 'new' : 'kocl',
219 'at' : 'insh',
220 'with_data' : 'data',
221 'with_properties' : 'prdt',
224 def make(self, _no_object=None, _attributes={}, **_arguments):
225 """make: Make a new element
226 Keyword argument new: the class of the new element
227 Keyword argument at: the location at which to insert the element
228 Keyword argument with_data: the initial data for the element
229 Keyword argument with_properties: the initial values for the properties of the element
230 Keyword argument _attributes: AppleEvent attribute dictionary
231 Returns: to the new object(s)
233 _code = 'core'
234 _subcode = 'crel'
236 aetools.keysubst(_arguments, self._argmap_make)
237 if _no_object != None: raise TypeError, 'No direct arg expected'
240 _reply, _arguments, _attributes = self.send(_code, _subcode,
241 _arguments, _attributes)
242 if _arguments.get('errn', 0):
243 raise aetools.Error, aetools.decodeerror(_arguments)
244 # XXXX Optionally decode result
245 if _arguments.has_key('----'):
246 return _arguments['----']
248 _argmap_move = {
249 'to' : 'insh',
252 def move(self, _object, _attributes={}, **_arguments):
253 """move: Move object(s) to a new location
254 Required argument: the object(s) to move
255 Keyword argument to: the new location for the object(s)
256 Keyword argument _attributes: AppleEvent attribute dictionary
257 Returns: to the object(s) after they have been moved
259 _code = 'core'
260 _subcode = 'move'
262 aetools.keysubst(_arguments, self._argmap_move)
263 _arguments['----'] = _object
266 _reply, _arguments, _attributes = self.send(_code, _subcode,
267 _arguments, _attributes)
268 if _arguments.get('errn', 0):
269 raise aetools.Error, aetools.decodeerror(_arguments)
270 # XXXX Optionally decode result
271 if _arguments.has_key('----'):
272 return _arguments['----']
274 def open(self, _object, _attributes={}, **_arguments):
275 """open: Open the specified object(s)
276 Required argument: list of objects to open
277 Keyword argument _attributes: AppleEvent attribute dictionary
279 _code = 'aevt'
280 _subcode = 'odoc'
282 if _arguments: raise TypeError, 'No optional args expected'
283 _arguments['----'] = _object
286 _reply, _arguments, _attributes = self.send(_code, _subcode,
287 _arguments, _attributes)
288 if _arguments.get('errn', 0):
289 raise aetools.Error, aetools.decodeerror(_arguments)
290 # XXXX Optionally decode result
291 if _arguments.has_key('----'):
292 return _arguments['----']
294 def print_(self, _object, _attributes={}, **_arguments):
295 """print: Print the specified object(s)
296 Required argument: list of objects to print
297 Keyword argument _attributes: AppleEvent attribute dictionary
299 _code = 'aevt'
300 _subcode = 'pdoc'
302 if _arguments: raise TypeError, 'No optional args expected'
303 _arguments['----'] = _object
306 _reply, _arguments, _attributes = self.send(_code, _subcode,
307 _arguments, _attributes)
308 if _arguments.get('errn', 0):
309 raise aetools.Error, aetools.decodeerror(_arguments)
310 # XXXX Optionally decode result
311 if _arguments.has_key('----'):
312 return _arguments['----']
314 _argmap_quit = {
315 'saving' : 'savo',
318 def quit(self, _no_object=None, _attributes={}, **_arguments):
319 """quit: Quit an application
320 Keyword argument saving: specifies whether to save currently open documents
321 Keyword argument _attributes: AppleEvent attribute dictionary
323 _code = 'aevt'
324 _subcode = 'quit'
326 aetools.keysubst(_arguments, self._argmap_quit)
327 if _no_object != None: raise TypeError, 'No direct arg expected'
329 aetools.enumsubst(_arguments, 'savo', _Enum_savo)
331 _reply, _arguments, _attributes = self.send(_code, _subcode,
332 _arguments, _attributes)
333 if _arguments.get('errn', 0):
334 raise aetools.Error, aetools.decodeerror(_arguments)
335 # XXXX Optionally decode result
336 if _arguments.has_key('----'):
337 return _arguments['----']
339 def reopen(self, _no_object=None, _attributes={}, **_arguments):
340 """reopen: Reactivate a running application. Some applications will open a new untitled window if no window is open.
341 Keyword argument _attributes: AppleEvent attribute dictionary
343 _code = 'aevt'
344 _subcode = 'rapp'
346 if _arguments: raise TypeError, 'No optional args expected'
347 if _no_object != None: raise TypeError, 'No direct arg expected'
350 _reply, _arguments, _attributes = self.send(_code, _subcode,
351 _arguments, _attributes)
352 if _arguments.get('errn', 0):
353 raise aetools.Error, aetools.decodeerror(_arguments)
354 # XXXX Optionally decode result
355 if _arguments.has_key('----'):
356 return _arguments['----']
358 def run(self, _no_object=None, _attributes={}, **_arguments):
359 """run: Run an application. Most applications will open an empty, untitled window.
360 Keyword argument _attributes: AppleEvent attribute dictionary
362 _code = 'aevt'
363 _subcode = 'oapp'
365 if _arguments: raise TypeError, 'No optional args expected'
366 if _no_object != None: raise TypeError, 'No direct arg expected'
369 _reply, _arguments, _attributes = self.send(_code, _subcode,
370 _arguments, _attributes)
371 if _arguments.get('errn', 0):
372 raise aetools.Error, aetools.decodeerror(_arguments)
373 # XXXX Optionally decode result
374 if _arguments.has_key('----'):
375 return _arguments['----']
377 _argmap_save = {
378 'in_' : 'kfil',
379 'as' : 'fltp',
382 def save(self, _object, _attributes={}, **_arguments):
383 """save: Save an object
384 Required argument: the object to save, usually a document or window
385 Keyword argument in_: the file or alias in which to save the object
386 Keyword argument as: the file type of the document in which to save the data
387 Keyword argument _attributes: AppleEvent attribute dictionary
389 _code = 'core'
390 _subcode = 'save'
392 aetools.keysubst(_arguments, self._argmap_save)
393 _arguments['----'] = _object
396 _reply, _arguments, _attributes = self.send(_code, _subcode,
397 _arguments, _attributes)
398 if _arguments.get('errn', 0):
399 raise aetools.Error, aetools.decodeerror(_arguments)
400 # XXXX Optionally decode result
401 if _arguments.has_key('----'):
402 return _arguments['----']
404 def select(self, _object, _attributes={}, **_arguments):
405 """select: Make a selection
406 Required argument: the object to select
407 Keyword argument _attributes: AppleEvent attribute dictionary
409 _code = 'misc'
410 _subcode = 'slct'
412 if _arguments: raise TypeError, 'No optional args expected'
413 _arguments['----'] = _object
416 _reply, _arguments, _attributes = self.send(_code, _subcode,
417 _arguments, _attributes)
418 if _arguments.get('errn', 0):
419 raise aetools.Error, aetools.decodeerror(_arguments)
420 # XXXX Optionally decode result
421 if _arguments.has_key('----'):
422 return _arguments['----']
424 _argmap_suite_info = {
425 'in_' : 'wrcd',
428 def suite_info(self, _object, _attributes={}, **_arguments):
429 """suite info: (optional) Get information about event suite(s)
430 Required argument: the suite for which to return information
431 Keyword argument in_: the human language and script system in which to return information
432 Keyword argument _attributes: AppleEvent attribute dictionary
433 Returns: a record containing the suites and their versions
435 _code = 'core'
436 _subcode = 'gtsi'
438 aetools.keysubst(_arguments, self._argmap_suite_info)
439 _arguments['----'] = _object
442 _reply, _arguments, _attributes = self.send(_code, _subcode,
443 _arguments, _attributes)
444 if _arguments.get('errn', 0):
445 raise aetools.Error, aetools.decodeerror(_arguments)
446 # XXXX Optionally decode result
447 if _arguments.has_key('----'):
448 return _arguments['----']
451 class aliases(aetools.ComponentItem):
452 """aliases - """
453 want = 'alis'
455 alias = aliases
457 class application(aetools.ComponentItem):
458 """application - An application program """
459 want = 'capp'
460 class _Prop_clipboard(aetools.NProperty):
461 """clipboard - the contents of the clipboard for this application """
462 which = 'pcli'
463 want = '****'
464 class _Prop_frontmost(aetools.NProperty):
465 """frontmost - Is this the frontmost application? """
466 which = 'pisf'
467 want = 'bool'
468 class _Prop_name(aetools.NProperty):
469 """name - the name of the application """
470 which = 'pnam'
471 want = 'itxt'
472 class _Prop_selection(aetools.NProperty):
473 """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. """
474 which = 'sele'
475 want = 'csel'
476 class _Prop_version(aetools.NProperty):
477 """version - the version of the application """
478 which = 'vers'
479 want = 'vers'
481 applications = application
483 class insertion_points(aetools.ComponentItem):
484 """insertion points - """
485 want = 'cins'
487 insertion_point = insertion_points
489 class selection_2d_object(aetools.ComponentItem):
490 """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. """
491 want = 'csel'
492 class _Prop_contents(aetools.NProperty):
493 """contents - the information currently selected. Use \xd4contents of selection\xd5 to get or change information in a document. """
494 which = 'pcnt'
495 want = '****'
497 class window(aetools.ComponentItem):
498 """window - A window """
499 want = 'cwin'
500 class _Prop_bounds(aetools.NProperty):
501 """bounds - the boundary rectangle for the window """
502 which = 'pbnd'
503 want = 'qdrt'
504 class _Prop_closeable(aetools.NProperty):
505 """closeable - Does the window have a close box? """
506 which = 'hclb'
507 want = 'bool'
508 class _Prop_floating(aetools.NProperty):
509 """floating - Does the window float? """
510 which = 'isfl'
511 want = 'bool'
512 class _Prop_index(aetools.NProperty):
513 """index - the number of the window """
514 which = 'pidx'
515 want = 'long'
516 class _Prop_modal(aetools.NProperty):
517 """modal - Is the window modal? """
518 which = 'pmod'
519 want = 'bool'
520 class _Prop_resizable(aetools.NProperty):
521 """resizable - Is the window resizable? """
522 which = 'prsz'
523 want = 'bool'
524 class _Prop_titled(aetools.NProperty):
525 """titled - Does the window have a title bar? """
526 which = 'ptit'
527 want = 'bool'
528 class _Prop_visible(aetools.NProperty):
529 """visible - Is the window visible? """
530 which = 'pvis'
531 want = 'bool'
532 class _Prop_zoomable(aetools.NProperty):
533 """zoomable - Is the window zoomable? """
534 which = 'iszm'
535 want = 'bool'
536 class _Prop_zoomed(aetools.NProperty):
537 """zoomed - Is the window zoomed? """
538 which = 'pzum'
539 want = 'bool'
541 windows = window
543 class document(aetools.ComponentItem):
544 """document - A document of a scriptable application """
545 want = 'docu'
546 class _Prop_modified(aetools.NProperty):
547 """modified - Has the document been modified since the last save? """
548 which = 'imod'
549 want = 'bool'
551 documents = document
553 class file(aetools.ComponentItem):
554 """file - a file on a disk or server """
555 want = 'file'
556 class _Prop_stationery(aetools.NProperty):
557 """stationery - Is the file a stationery file? """
558 which = 'pspd'
559 want = 'bool'
561 files = file
562 aliases._superclassnames = []
563 aliases._privpropdict = {
565 aliases._privelemdict = {
567 application._superclassnames = []
568 application._privpropdict = {
569 'clipboard' : _Prop_clipboard,
570 'frontmost' : _Prop_frontmost,
571 'name' : _Prop_name,
572 'selection' : _Prop_selection,
573 'version' : _Prop_version,
575 application._privelemdict = {
577 insertion_points._superclassnames = []
578 insertion_points._privpropdict = {
580 insertion_points._privelemdict = {
582 selection_2d_object._superclassnames = []
583 selection_2d_object._privpropdict = {
584 'contents' : _Prop_contents,
586 selection_2d_object._privelemdict = {
588 window._superclassnames = []
589 window._privpropdict = {
590 'bounds' : _Prop_bounds,
591 'closeable' : _Prop_closeable,
592 'floating' : _Prop_floating,
593 'index' : _Prop_index,
594 'modal' : _Prop_modal,
595 'resizable' : _Prop_resizable,
596 'titled' : _Prop_titled,
597 'visible' : _Prop_visible,
598 'zoomable' : _Prop_zoomable,
599 'zoomed' : _Prop_zoomed,
601 window._privelemdict = {
603 document._superclassnames = []
604 document._privpropdict = {
605 'modified' : _Prop_modified,
607 document._privelemdict = {
609 file._superclassnames = []
610 file._privpropdict = {
611 'stationery' : _Prop_stationery,
613 file._privelemdict = {
615 class _3c_(aetools.NComparison):
616 """< - Less than """
617 class _3d_(aetools.NComparison):
618 """= - Equal """
619 class _3e_(aetools.NComparison):
620 """> - Greater than """
621 class contains(aetools.NComparison):
622 """contains - Contains """
623 class ends_with(aetools.NComparison):
624 """ends with - Ends with """
625 class starts_with(aetools.NComparison):
626 """starts with - Starts with """
627 class _b2_(aetools.NComparison):
628 """\xb2 - Less than or equal to """
629 class _b3_(aetools.NComparison):
630 """\xb3 - Greater than or equal to """
631 _Enum_kfrm = {
632 'index' : 'indx', # keyform designating indexed access
633 'named' : 'name', # keyform designating named access
634 'id' : 'ID ', # keyform designating access by unique identifier
637 _Enum_savo = {
638 'yes' : 'yes ', # Save objects now
639 'no' : 'no ', # Do not save objects
640 'ask' : 'ask ', # Ask the user whether to save
643 _Enum_styl = {
644 'plain' : 'plan', # Plain
645 'bold' : 'bold', # Bold
646 'italic' : 'ital', # Italic
647 'outline' : 'outl', # Outline
648 'shadow' : 'shad', # Shadow
649 'underline' : 'undl', # Underline
650 'superscript' : 'spsc', # Superscript
651 'subscript' : 'sbsc', # Subscript
652 'strikethrough' : 'strk', # Strikethrough
653 'small_caps' : 'smcp', # Small caps
654 'all_caps' : 'alcp', # All capital letters
655 'all_lowercase' : 'lowc', # Lowercase
656 'condensed' : 'cond', # Condensed
657 'expanded' : 'pexp', # Expanded
658 'hidden' : 'hidn', # Hidden
663 # Indices of types declared in this module
665 _classdeclarations = {
666 'alis' : aliases,
667 'capp' : application,
668 'cins' : insertion_points,
669 'csel' : selection_2d_object,
670 'cwin' : window,
671 'docu' : document,
672 'file' : file,
675 _propdeclarations = {
676 'hclb' : _Prop_closeable,
677 'imod' : _Prop_modified,
678 'isfl' : _Prop_floating,
679 'iszm' : _Prop_zoomable,
680 'pbnd' : _Prop_bounds,
681 'pcli' : _Prop_clipboard,
682 'pcnt' : _Prop_contents,
683 'pidx' : _Prop_index,
684 'pisf' : _Prop_frontmost,
685 'pmod' : _Prop_modal,
686 'pnam' : _Prop_name,
687 'prsz' : _Prop_resizable,
688 'pspd' : _Prop_stationery,
689 'ptit' : _Prop_titled,
690 'pvis' : _Prop_visible,
691 'pzum' : _Prop_zoomed,
692 'sele' : _Prop_selection,
693 'vers' : _Prop_version,
696 _compdeclarations = {
697 '< ' : _3c_,
698 '<= ' : _b2_,
699 '= ' : _3d_,
700 '> ' : _3e_,
701 '>= ' : _b3_,
702 'bgwt' : starts_with,
703 'cont' : contains,
704 'ends' : ends_with,
707 _enumdeclarations = {
708 'kfrm' : _Enum_kfrm,
709 'savo' : _Enum_savo,
710 'styl' : _Enum_styl,