ยปCore Development>Code coverage>Lib/plat-mac/lib-scriptpackages/_builtinSuites/builtin_Suite.py

Python code coverage for Lib/plat-mac/lib-scriptpackages/_builtinSuites/builtin_Suite.py

#countcontent
1n/a"""Suite builtin_Suite: Every application supports open, reopen, print, run, and quit
2n/aLevel 1, version 1
3n/a"""
4n/a
5n/aimport aetools
6n/aimport MacOS
7n/a
8n/a_code = 'aevt'
9n/a
10n/aclass builtin_Suite_Events:
11n/a
12n/a def open(self, _object, _attributes={}, **_arguments):
13n/a """open: Open the specified object(s)
14n/a Required argument: list of objects to open
15n/a Keyword argument _attributes: AppleEvent attribute dictionary
16n/a """
17n/a _code = 'aevt'
18n/a _subcode = 'odoc'
19n/a
20n/a if _arguments: raise TypeError, 'No optional args expected'
21n/a _arguments['----'] = _object
22n/a
23n/a
24n/a _reply, _arguments, _attributes = self.send(_code, _subcode,
25n/a _arguments, _attributes)
26n/a if _arguments.get('errn', 0):
27n/a raise aetools.Error, aetools.decodeerror(_arguments)
28n/a # XXXX Optionally decode result
29n/a if _arguments.has_key('----'):
30n/a return _arguments['----']
31n/a
32n/a def run(self, _no_object=None, _attributes={}, **_arguments):
33n/a """run: Run an application. Most applications will open an empty, untitled window.
34n/a Keyword argument _attributes: AppleEvent attribute dictionary
35n/a """
36n/a _code = 'aevt'
37n/a _subcode = 'oapp'
38n/a
39n/a if _arguments: raise TypeError, 'No optional args expected'
40n/a if _no_object is not None: raise TypeError, 'No direct arg expected'
41n/a
42n/a
43n/a _reply, _arguments, _attributes = self.send(_code, _subcode,
44n/a _arguments, _attributes)
45n/a if _arguments.get('errn', 0):
46n/a raise aetools.Error, aetools.decodeerror(_arguments)
47n/a # XXXX Optionally decode result
48n/a if _arguments.has_key('----'):
49n/a return _arguments['----']
50n/a
51n/a def reopen(self, _no_object=None, _attributes={}, **_arguments):
52n/a """reopen: Reactivate a running application. Some applications will open a new untitled window if no window is open.
53n/a Keyword argument _attributes: AppleEvent attribute dictionary
54n/a """
55n/a _code = 'aevt'
56n/a _subcode = 'rapp'
57n/a
58n/a if _arguments: raise TypeError, 'No optional args expected'
59n/a if _no_object is not None: raise TypeError, 'No direct arg expected'
60n/a
61n/a
62n/a _reply, _arguments, _attributes = self.send(_code, _subcode,
63n/a _arguments, _attributes)
64n/a if _arguments.get('errn', 0):
65n/a raise aetools.Error, aetools.decodeerror(_arguments)
66n/a # XXXX Optionally decode result
67n/a if _arguments.has_key('----'):
68n/a return _arguments['----']
69n/a
70n/a def _print(self, _object, _attributes={}, **_arguments):
71n/a """print: Print the specified object(s)
72n/a Required argument: list of objects to print
73n/a Keyword argument _attributes: AppleEvent attribute dictionary
74n/a """
75n/a _code = 'aevt'
76n/a _subcode = 'pdoc'
77n/a
78n/a if _arguments: raise TypeError, 'No optional args expected'
79n/a _arguments['----'] = _object
80n/a
81n/a
82n/a _reply, _arguments, _attributes = self.send(_code, _subcode,
83n/a _arguments, _attributes)
84n/a if _arguments.get('errn', 0):
85n/a raise aetools.Error, aetools.decodeerror(_arguments)
86n/a # XXXX Optionally decode result
87n/a if _arguments.has_key('----'):
88n/a return _arguments['----']
89n/a
90n/a _argmap_quit = {
91n/a 'saving' : 'savo',
92n/a }
93n/a
94n/a def quit(self, _no_object=None, _attributes={}, **_arguments):
95n/a """quit: Quit an application
96n/a Keyword argument saving: specifies whether to save currently open documents
97n/a Keyword argument _attributes: AppleEvent attribute dictionary
98n/a """
99n/a _code = 'aevt'
100n/a _subcode = 'quit'
101n/a
102n/a aetools.keysubst(_arguments, self._argmap_quit)
103n/a if _no_object is not None: raise TypeError, 'No direct arg expected'
104n/a
105n/a aetools.enumsubst(_arguments, 'savo', _Enum_savo)
106n/a
107n/a _reply, _arguments, _attributes = self.send(_code, _subcode,
108n/a _arguments, _attributes)
109n/a if _arguments.get('errn', 0):
110n/a raise aetools.Error, aetools.decodeerror(_arguments)
111n/a # XXXX Optionally decode result
112n/a if _arguments.has_key('----'):
113n/a return _arguments['----']
114n/a
115n/a _argmap_close = {
116n/a 'saving' : 'savo',
117n/a 'saving_in' : 'kfil',
118n/a }
119n/a
120n/a_Enum_savo = {
121n/a 'yes' : 'yes ', # Save objects now
122n/a 'no' : 'no ', # Do not save objects
123n/a 'ask' : 'ask ', # Ask the user whether to save
124n/a}
125n/a
126n/a#
127n/a# Indices of types declared in this module
128n/a#
129n/a_classdeclarations = {
130n/a}
131n/a
132n/a_propdeclarations = {
133n/a}
134n/a
135n/a_compdeclarations = {
136n/a}
137n/a
138n/a_enumdeclarations = {
139n/a 'savo' : _Enum_savo,
140n/a}