append(): Fixing the test for convertability after consultation with
[python/dscho.git] / Mac / Lib / lib-scriptpackages / _builtinSuites / builtin_Suite.py
blob117eeddbc98f77324f49368030d97f0c126b25f3
1 """Suite builtin_Suite: Every application supports open, reopen, print, run, and quit
2 Level 1, version 1
3 """
5 import aetools
6 import MacOS
8 _code = 'aevt'
10 class builtin_Suite_Events:
12 def open(self, _object, _attributes={}, **_arguments):
13 """open: Open the specified object(s)
14 Required argument: list of objects to open
15 Keyword argument _attributes: AppleEvent attribute dictionary
16 """
17 _code = 'aevt'
18 _subcode = 'odoc'
20 if _arguments: raise TypeError, 'No optional args expected'
21 _arguments['----'] = _object
24 _reply, _arguments, _attributes = self.send(_code, _subcode,
25 _arguments, _attributes)
26 if _arguments.get('errn', 0):
27 raise aetools.Error, aetools.decodeerror(_arguments)
28 # XXXX Optionally decode result
29 if _arguments.has_key('----'):
30 return _arguments['----']
32 def run(self, _no_object=None, _attributes={}, **_arguments):
33 """run: Run an application. Most applications will open an empty, untitled window.
34 Keyword argument _attributes: AppleEvent attribute dictionary
35 """
36 _code = 'aevt'
37 _subcode = 'oapp'
39 if _arguments: raise TypeError, 'No optional args expected'
40 if _no_object != None: raise TypeError, 'No direct arg expected'
43 _reply, _arguments, _attributes = self.send(_code, _subcode,
44 _arguments, _attributes)
45 if _arguments.get('errn', 0):
46 raise aetools.Error, aetools.decodeerror(_arguments)
47 # XXXX Optionally decode result
48 if _arguments.has_key('----'):
49 return _arguments['----']
51 def reopen(self, _no_object=None, _attributes={}, **_arguments):
52 """reopen: Reactivate a running application. Some applications will open a new untitled window if no window is open.
53 Keyword argument _attributes: AppleEvent attribute dictionary
54 """
55 _code = 'aevt'
56 _subcode = 'rapp'
58 if _arguments: raise TypeError, 'No optional args expected'
59 if _no_object != None: raise TypeError, 'No direct arg expected'
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 def _print(self, _object, _attributes={}, **_arguments):
71 """print: Print the specified object(s)
72 Required argument: list of objects to print
73 Keyword argument _attributes: AppleEvent attribute dictionary
74 """
75 _code = 'aevt'
76 _subcode = 'pdoc'
78 if _arguments: raise TypeError, 'No optional args expected'
79 _arguments['----'] = _object
82 _reply, _arguments, _attributes = self.send(_code, _subcode,
83 _arguments, _attributes)
84 if _arguments.get('errn', 0):
85 raise aetools.Error, aetools.decodeerror(_arguments)
86 # XXXX Optionally decode result
87 if _arguments.has_key('----'):
88 return _arguments['----']
90 _argmap_quit = {
91 'saving' : 'savo',
94 def quit(self, _no_object=None, _attributes={}, **_arguments):
95 """quit: Quit an application
96 Keyword argument saving: specifies whether to save currently open documents
97 Keyword argument _attributes: AppleEvent attribute dictionary
98 """
99 _code = 'aevt'
100 _subcode = 'quit'
102 aetools.keysubst(_arguments, self._argmap_quit)
103 if _no_object != None: raise TypeError, 'No direct arg expected'
105 aetools.enumsubst(_arguments, 'savo', _Enum_savo)
107 _reply, _arguments, _attributes = self.send(_code, _subcode,
108 _arguments, _attributes)
109 if _arguments.get('errn', 0):
110 raise aetools.Error, aetools.decodeerror(_arguments)
111 # XXXX Optionally decode result
112 if _arguments.has_key('----'):
113 return _arguments['----']
115 _argmap_close = {
116 'saving' : 'savo',
117 'saving_in' : 'kfil',
120 _Enum_savo = {
121 'yes' : 'yes ', # Save objects now
122 'no' : 'no ', # Do not save objects
123 'ask' : 'ask ', # Ask the user whether to save
127 # Indices of types declared in this module
129 _classdeclarations = {
132 _propdeclarations = {
135 _compdeclarations = {
138 _enumdeclarations = {
139 'savo' : _Enum_savo,