• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"""Suite builtin_Suite: Every application supports open, reopen, print, run, and quit
2Level 1, version 1
3"""
4
5import aetools
6import MacOS
7
8_code = 'aevt'
9
10class builtin_Suite_Events:
11
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'
19
20        if _arguments: raise TypeError, 'No optional args expected'
21        _arguments['----'] = _object
22
23
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['----']
31
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'
38
39        if _arguments: raise TypeError, 'No optional args expected'
40        if _no_object is not None: raise TypeError, 'No direct arg expected'
41
42
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['----']
50
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'
57
58        if _arguments: raise TypeError, 'No optional args expected'
59        if _no_object is not None: raise TypeError, 'No direct arg expected'
60
61
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['----']
69
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'
77
78        if _arguments: raise TypeError, 'No optional args expected'
79        _arguments['----'] = _object
80
81
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['----']
89
90    _argmap_quit = {
91            'saving' : 'savo',
92    }
93
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'
101
102        aetools.keysubst(_arguments, self._argmap_quit)
103        if _no_object is not None: raise TypeError, 'No direct arg expected'
104
105        aetools.enumsubst(_arguments, 'savo', _Enum_savo)
106
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['----']
114
115    _argmap_close = {
116            'saving' : 'savo',
117            'saving_in' : 'kfil',
118    }
119
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
124}
125
126#
127# Indices of types declared in this module
128#
129_classdeclarations = {
130}
131
132_propdeclarations = {
133}
134
135_compdeclarations = {
136}
137
138_enumdeclarations = {
139        'savo' : _Enum_savo,
140}
141