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

Python code coverage for Lib/plat-mac/lib-scriptpackages/SystemEvents/Folder_Actions_Suite.py

#countcontent
1n/a"""Suite Folder Actions Suite: Terms and Events for controlling Folder Actions
2n/aLevel 1, version 1
3n/a
4n/aGenerated from /System/Library/CoreServices/System Events.app
5n/aAETE/AEUT resource version 1/0, language 0, script 0
6n/a"""
7n/a
8n/aimport aetools
9n/aimport MacOS
10n/a
11n/a_code = 'faco'
12n/a
13n/aclass Folder_Actions_Suite_Events:
14n/a
15n/a _argmap_attach_action_to = {
16n/a 'using' : 'faal',
17n/a }
18n/a
19n/a def attach_action_to(self, _object, _attributes={}, **_arguments):
20n/a """attach action to: Attach an action to a folder
21n/a Required argument: the object for the command
22n/a Keyword argument using: a file containing the script to attach
23n/a Keyword argument _attributes: AppleEvent attribute dictionary
24n/a Returns: the reply for the command
25n/a """
26n/a _code = 'faco'
27n/a _subcode = 'atfa'
28n/a
29n/a aetools.keysubst(_arguments, self._argmap_attach_action_to)
30n/a _arguments['----'] = _object
31n/a
32n/a
33n/a _reply, _arguments, _attributes = self.send(_code, _subcode,
34n/a _arguments, _attributes)
35n/a if _arguments.get('errn', 0):
36n/a raise aetools.Error, aetools.decodeerror(_arguments)
37n/a # XXXX Optionally decode result
38n/a if _arguments.has_key('----'):
39n/a return _arguments['----']
40n/a
41n/a def attached_scripts(self, _object, _attributes={}, **_arguments):
42n/a """attached scripts: List the actions attached to a folder
43n/a Required argument: the object for the command
44n/a Keyword argument _attributes: AppleEvent attribute dictionary
45n/a Returns: the reply for the command
46n/a """
47n/a _code = 'faco'
48n/a _subcode = 'lact'
49n/a
50n/a if _arguments: raise TypeError, 'No optional args expected'
51n/a _arguments['----'] = _object
52n/a
53n/a
54n/a _reply, _arguments, _attributes = self.send(_code, _subcode,
55n/a _arguments, _attributes)
56n/a if _arguments.get('errn', 0):
57n/a raise aetools.Error, aetools.decodeerror(_arguments)
58n/a # XXXX Optionally decode result
59n/a if _arguments.has_key('----'):
60n/a return _arguments['----']
61n/a
62n/a _argmap_do_folder_action = {
63n/a 'with_window_size' : 'fnsz',
64n/a 'with_item_list' : 'flst',
65n/a 'folder_action_code' : 'actn',
66n/a }
67n/a
68n/a def do_folder_action(self, _object, _attributes={}, **_arguments):
69n/a """do folder action: Event the Finder sends to the Folder Actions FBA
70n/a Required argument: the object for the command
71n/a Keyword argument with_window_size: the new window size for the folder action message to process
72n/a Keyword argument with_item_list: a list of items for the folder action message to process
73n/a Keyword argument folder_action_code: the folder action message to process
74n/a Keyword argument _attributes: AppleEvent attribute dictionary
75n/a Returns: the reply for the command
76n/a """
77n/a _code = 'faco'
78n/a _subcode = 'fola'
79n/a
80n/a aetools.keysubst(_arguments, self._argmap_do_folder_action)
81n/a _arguments['----'] = _object
82n/a
83n/a aetools.enumsubst(_arguments, 'actn', _Enum_actn)
84n/a
85n/a _reply, _arguments, _attributes = self.send(_code, _subcode,
86n/a _arguments, _attributes)
87n/a if _arguments.get('errn', 0):
88n/a raise aetools.Error, aetools.decodeerror(_arguments)
89n/a # XXXX Optionally decode result
90n/a if _arguments.has_key('----'):
91n/a return _arguments['----']
92n/a
93n/a _argmap_edit_action_of = {
94n/a 'using_action_name' : 'snam',
95n/a 'using_action_number' : 'indx',
96n/a }
97n/a
98n/a def edit_action_of(self, _object, _attributes={}, **_arguments):
99n/a """edit action of: Edit as action of a folder
100n/a Required argument: the object for the command
101n/a Keyword argument using_action_name: ...or the name of the action to edit
102n/a Keyword argument using_action_number: the index number of the action to edit...
103n/a Keyword argument _attributes: AppleEvent attribute dictionary
104n/a Returns: the reply for the command
105n/a """
106n/a _code = 'faco'
107n/a _subcode = 'edfa'
108n/a
109n/a aetools.keysubst(_arguments, self._argmap_edit_action_of)
110n/a _arguments['----'] = _object
111n/a
112n/a
113n/a _reply, _arguments, _attributes = self.send(_code, _subcode,
114n/a _arguments, _attributes)
115n/a if _arguments.get('errn', 0):
116n/a raise aetools.Error, aetools.decodeerror(_arguments)
117n/a # XXXX Optionally decode result
118n/a if _arguments.has_key('----'):
119n/a return _arguments['----']
120n/a
121n/a _argmap_remove_action_from = {
122n/a 'using_action_name' : 'snam',
123n/a 'using_action_number' : 'indx',
124n/a }
125n/a
126n/a def remove_action_from(self, _object, _attributes={}, **_arguments):
127n/a """remove action from: Remove a folder action from a folder
128n/a Required argument: the object for the command
129n/a Keyword argument using_action_name: ...or the name of the action to remove
130n/a Keyword argument using_action_number: the index number of the action to remove...
131n/a Keyword argument _attributes: AppleEvent attribute dictionary
132n/a Returns: the reply for the command
133n/a """
134n/a _code = 'faco'
135n/a _subcode = 'rmfa'
136n/a
137n/a aetools.keysubst(_arguments, self._argmap_remove_action_from)
138n/a _arguments['----'] = _object
139n/a
140n/a
141n/a _reply, _arguments, _attributes = self.send(_code, _subcode,
142n/a _arguments, _attributes)
143n/a if _arguments.get('errn', 0):
144n/a raise aetools.Error, aetools.decodeerror(_arguments)
145n/a # XXXX Optionally decode result
146n/a if _arguments.has_key('----'):
147n/a return _arguments['----']
148n/a
149n/a
150n/aclass application(aetools.ComponentItem):
151n/a """application - The Folder Actions Suite host program """
152n/a want = 'capp'
153n/aclass _Prop__3c_Inheritance_3e_(aetools.NProperty):
154n/a """<Inheritance> - All of the properties of the superclass. """
155n/a which = 'c@#^'
156n/a want = 'capp'
157n/a_3c_Inheritance_3e_ = _Prop__3c_Inheritance_3e_()
158n/aclass _Prop_folder_actions_enabled(aetools.NProperty):
159n/a """folder actions enabled - Are Folder Actions currently being processed? """
160n/a which = 'faen'
161n/a want = 'bool'
162n/afolder_actions_enabled = _Prop_folder_actions_enabled()
163n/aclass _Prop_properties(aetools.NProperty):
164n/a """properties - every property of the Folder Actions Suite host program """
165n/a which = 'pALL'
166n/a want = '****'
167n/aproperties = _Prop_properties()
168n/a# element 'cdis' as ['name', 'indx', 'rele', 'rang', 'test']
169n/a# element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test']
170n/a# element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test']
171n/a# element 'cwin' as ['name', 'indx', 'rele', 'rang', 'test', 'ID ']
172n/a# element 'docu' as ['name', 'indx', 'rele', 'rang', 'test']
173n/a# element 'file' as ['name', 'indx', 'rele', 'rang', 'test']
174n/a# element 'foac' as ['name', 'indx', 'rele', 'rang', 'test']
175n/a# element 'logi' as ['name', 'indx', 'rele', 'rang', 'test']
176n/a# element 'pcap' as ['name', 'indx', 'rele', 'rang', 'test']
177n/a# element 'pcda' as ['name', 'indx', 'rele', 'rang', 'test']
178n/a# element 'prcs' as ['name', 'indx', 'rele', 'rang', 'test']
179n/a
180n/aapplications = application
181n/a
182n/aclass folder_action(aetools.ComponentItem):
183n/a """folder action - An action attached to a folder in the file system """
184n/a want = 'foac'
185n/aclass _Prop_name(aetools.NProperty):
186n/a """name - the name of the folder action, which is also the name of the folder """
187n/a which = 'pnam'
188n/a want = 'utxt'
189n/aclass _Prop_path(aetools.NProperty):
190n/a """path - the path to the folder to which the folder action applies """
191n/a which = 'ppth'
192n/a want = '****'
193n/aclass _Prop_volume(aetools.NProperty):
194n/a """volume - the volume on which the folder action resides """
195n/a which = 'volu'
196n/a want = 'utxt'
197n/a# element 'scpt' as ['name', 'indx', 'rele', 'rang', 'test']
198n/a
199n/afolder_actions = folder_action
200n/a
201n/aclass script(aetools.ComponentItem):
202n/a """script - A script invoked by a folder action """
203n/a want = 'scpt'
204n/aclass _Prop_POSIX_path(aetools.NProperty):
205n/a """POSIX path - the POSIX file system path of the disk """
206n/a which = 'posx'
207n/a want = 'utxt'
208n/a
209n/ascripts = script
210n/aapplication._superclassnames = []
211n/aimport Disk_Folder_File_Suite
212n/aimport Standard_Suite
213n/aimport Login_Items_Suite
214n/aimport Processes_Suite
215n/aapplication._privpropdict = {
216n/a '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_,
217n/a 'folder_actions_enabled' : _Prop_folder_actions_enabled,
218n/a 'properties' : _Prop_properties,
219n/a}
220n/aapplication._privelemdict = {
221n/a 'application_process' : Processes_Suite.application_process,
222n/a 'desk_accessory_process' : Processes_Suite.desk_accessory_process,
223n/a 'disk' : Disk_Folder_File_Suite.disk,
224n/a 'document' : Standard_Suite.document,
225n/a 'file' : Disk_Folder_File_Suite.file,
226n/a 'folder' : Disk_Folder_File_Suite.folder,
227n/a 'folder_action' : folder_action,
228n/a 'item' : Disk_Folder_File_Suite.item,
229n/a 'login_item' : Login_Items_Suite.login_item,
230n/a 'process' : Processes_Suite.process,
231n/a 'window' : Standard_Suite.window,
232n/a}
233n/afolder_action._superclassnames = ['item']
234n/afolder_action._privpropdict = {
235n/a '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_,
236n/a 'name' : _Prop_name,
237n/a 'path' : _Prop_path,
238n/a 'properties' : _Prop_properties,
239n/a 'volume' : _Prop_volume,
240n/a}
241n/afolder_action._privelemdict = {
242n/a 'script' : script,
243n/a}
244n/ascript._superclassnames = ['item']
245n/ascript._privpropdict = {
246n/a 'POSIX_path' : _Prop_POSIX_path,
247n/a '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_,
248n/a 'name' : _Prop_name,
249n/a 'path' : _Prop_path,
250n/a 'properties' : _Prop_properties,
251n/a}
252n/ascript._privelemdict = {
253n/a}
254n/a_Enum_actn = {
255n/a 'items_added' : 'fget', # items added
256n/a 'items_removed' : 'flos', # items removed
257n/a 'window_closed' : 'fclo', # window closed
258n/a 'window_moved' : 'fsiz', # window moved
259n/a 'window_opened' : 'fopn', # window opened
260n/a}
261n/a
262n/a
263n/a#
264n/a# Indices of types declared in this module
265n/a#
266n/a_classdeclarations = {
267n/a 'capp' : application,
268n/a 'foac' : folder_action,
269n/a 'scpt' : script,
270n/a}
271n/a
272n/a_propdeclarations = {
273n/a 'c@#^' : _Prop__3c_Inheritance_3e_,
274n/a 'faen' : _Prop_folder_actions_enabled,
275n/a 'pALL' : _Prop_properties,
276n/a 'pnam' : _Prop_name,
277n/a 'posx' : _Prop_POSIX_path,
278n/a 'ppth' : _Prop_path,
279n/a 'volu' : _Prop_volume,
280n/a}
281n/a
282n/a_compdeclarations = {
283n/a}
284n/a
285n/a_enumdeclarations = {
286n/a 'actn' : _Enum_actn,
287n/a}