Bump version number to 2.4.2 to pick up the latest minor bug fixes.
[python/dscho.git] / Mac / Lib / lib-scriptpackages / Finder / Finder_Basics.py
blob358912653f587b4a917795b0f0c556f76509a4c7
1 """Suite Finder Basics: Commonly-used Finder commands and object classes
2 Level 1, version 1
4 Generated from /Volumes/Sap/System Folder/Finder
5 AETE/AEUT resource version 0/144, language 0, script 0
6 """
8 import aetools
9 import MacOS
11 _code = 'fndr'
13 class Finder_Basics_Events:
15 _argmap_computer = {
16 'has' : 'has ',
19 def computer(self, _object, _attributes={}, **_arguments):
20 """computer: Test attributes of this computer
21 Required argument: the attribute to test
22 Keyword argument has: test specific bits of response
23 Keyword argument _attributes: AppleEvent attribute dictionary
24 Returns: the result of the query
25 """
26 _code = 'fndr'
27 _subcode = 'gstl'
29 aetools.keysubst(_arguments, self._argmap_computer)
30 _arguments['----'] = _object
33 _reply, _arguments, _attributes = self.send(_code, _subcode,
34 _arguments, _attributes)
35 if _arguments.get('errn', 0):
36 raise aetools.Error, aetools.decodeerror(_arguments)
37 # XXXX Optionally decode result
38 if _arguments.has_key('----'):
39 return _arguments['----']
41 def copy(self, _no_object=None, _attributes={}, **_arguments):
42 """copy: Copy the selected items to the clipboard (the Finder must be the front application)
43 Keyword argument _attributes: AppleEvent attribute dictionary
44 """
45 _code = 'misc'
46 _subcode = 'copy'
48 if _arguments: raise TypeError, 'No optional args expected'
49 if _no_object != None: raise TypeError, 'No direct arg expected'
52 _reply, _arguments, _attributes = self.send(_code, _subcode,
53 _arguments, _attributes)
54 if _arguments.get('errn', 0):
55 raise aetools.Error, aetools.decodeerror(_arguments)
56 # XXXX Optionally decode result
57 if _arguments.has_key('----'):
58 return _arguments['----']
60 def restart(self, _no_object=None, _attributes={}, **_arguments):
61 """restart: Restart the computer
62 Keyword argument _attributes: AppleEvent attribute dictionary
63 """
64 _code = 'fndr'
65 _subcode = 'rest'
67 if _arguments: raise TypeError, 'No optional args expected'
68 if _no_object != None: raise TypeError, 'No direct arg expected'
71 _reply, _arguments, _attributes = self.send(_code, _subcode,
72 _arguments, _attributes)
73 if _arguments.get('errn', 0):
74 raise aetools.Error, aetools.decodeerror(_arguments)
75 # XXXX Optionally decode result
76 if _arguments.has_key('----'):
77 return _arguments['----']
79 def shut_down(self, _no_object=None, _attributes={}, **_arguments):
80 """shut down: Shut Down the computer
81 Keyword argument _attributes: AppleEvent attribute dictionary
82 """
83 _code = 'fndr'
84 _subcode = 'shut'
86 if _arguments: raise TypeError, 'No optional args expected'
87 if _no_object != None: raise TypeError, 'No direct arg expected'
90 _reply, _arguments, _attributes = self.send(_code, _subcode,
91 _arguments, _attributes)
92 if _arguments.get('errn', 0):
93 raise aetools.Error, aetools.decodeerror(_arguments)
94 # XXXX Optionally decode result
95 if _arguments.has_key('----'):
96 return _arguments['----']
98 def sleep(self, _no_object=None, _attributes={}, **_arguments):
99 """sleep: Put the computer to sleep
100 Keyword argument _attributes: AppleEvent attribute dictionary
102 _code = 'fndr'
103 _subcode = 'slep'
105 if _arguments: raise TypeError, 'No optional args expected'
106 if _no_object != None: raise TypeError, 'No direct arg expected'
109 _reply, _arguments, _attributes = self.send(_code, _subcode,
110 _arguments, _attributes)
111 if _arguments.get('errn', 0):
112 raise aetools.Error, aetools.decodeerror(_arguments)
113 # XXXX Optionally decode result
114 if _arguments.has_key('----'):
115 return _arguments['----']
117 _argmap_sort = {
118 'by' : 'by ',
121 def sort(self, _object, _attributes={}, **_arguments):
122 """sort: Return the specified object(s) in a sorted list
123 Required argument: a list of finder objects to sort
124 Keyword argument by: the property to sort the items by (name, index, date, etc.)
125 Keyword argument _attributes: AppleEvent attribute dictionary
126 Returns: the sorted items in their new order
128 _code = 'DATA'
129 _subcode = 'SORT'
131 aetools.keysubst(_arguments, self._argmap_sort)
132 _arguments['----'] = _object
135 _reply, _arguments, _attributes = self.send(_code, _subcode,
136 _arguments, _attributes)
137 if _arguments.get('errn', 0):
138 raise aetools.Error, aetools.decodeerror(_arguments)
139 # XXXX Optionally decode result
140 if _arguments.has_key('----'):
141 return _arguments['----']
144 class application(aetools.ComponentItem):
145 """application - The Finder """
146 want = 'capp'
147 class clipboard(aetools.NProperty):
148 """clipboard - the Finder\xd5s clipboard window """
149 which = 'pcli'
150 want = 'obj '
151 class largest_free_block(aetools.NProperty):
152 """largest free block - the largest free block of process memory available to launch an application """
153 which = 'mfre'
154 want = 'long'
155 class name(aetools.NProperty):
156 """name - the Finder\xd5s name """
157 which = 'pnam'
158 want = 'itxt'
159 class visible(aetools.NProperty):
160 """visible - Is the Finder\xd5s layer visible? """
161 which = 'pvis'
162 want = 'bool'
163 class frontmost(aetools.NProperty):
164 """frontmost - Is the Finder the frontmost process? """
165 which = 'pisf'
166 want = 'bool'
167 class selection(aetools.NProperty):
168 """selection - the selection visible to the user """
169 which = 'sele'
170 want = 'obj '
171 class insertion_location(aetools.NProperty):
172 """insertion location - the container in which a new folder would appear if \xd2New Folder\xd3 was selected """
173 which = 'pins'
174 want = 'obj '
175 class file_sharing(aetools.NProperty):
176 """file sharing - Is file sharing on? """
177 which = 'fshr'
178 want = 'bool'
179 class sharing_starting_up(aetools.NProperty):
180 """sharing starting up - Is file sharing in the process of starting up? """
181 which = 'fsup'
182 want = 'bool'
183 class product_version(aetools.NProperty):
184 """product version - the version of the System software running on this computer """
185 which = 'ver2'
186 want = 'itxt'
187 class version(aetools.NProperty):
188 """version - the version of the Finder """
189 which = 'vers'
190 want = 'itxt'
191 class about_this_computer(aetools.NProperty):
192 """about this computer - the \xd2About this Computer\xd3 dialog and the list of running processes displayed in it """
193 which = 'abbx'
194 want = 'obj '
195 class desktop(aetools.NProperty):
196 """desktop - the desktop """
197 which = 'desk'
198 want = 'cdsk'
199 class execution_state(aetools.NProperty):
200 """execution state - the current execution state of the Finder """
201 which = 'exec'
202 want = 'ese0'
203 class Finder_preferences(aetools.NProperty):
204 """Finder preferences - Various preferences that apply to the Finder as a whole """
205 which = 'pfrp'
206 want = 'cprf'
207 # element 'cobj' as ['indx', 'name']
208 # element 'ctnr' as ['indx', 'name']
209 # element 'sctr' as ['indx', 'name']
210 # element 'cdis' as ['indx', 'name', 'ID ']
211 # element 'cfol' as ['indx', 'name', 'ID ']
212 # element 'file' as ['indx', 'name']
213 # element 'alia' as ['indx', 'name']
214 # element 'appf' as ['indx', 'name', 'ID ']
215 # element 'docf' as ['indx', 'name']
216 # element 'fntf' as ['indx', 'name']
217 # element 'dafi' as ['indx', 'name']
218 # element 'inlf' as ['indx', 'name']
219 # element 'sndf' as ['indx', 'name']
220 # element 'clpf' as ['indx', 'name']
221 # element 'pack' as ['indx', 'name']
222 # element 'stcs' as ['indx', 'name']
223 # element 'fsut' as ['indx', 'name']
224 # element 'dsut' as ['indx', 'name']
225 # element 'prcs' as ['indx', 'name']
226 # element 'pcap' as ['indx', 'name']
227 # element 'pcda' as ['indx', 'name']
228 # element 'cwin' as ['indx', 'name']
229 # element 'cwnd' as ['indx', 'name']
230 # element 'iwnd' as ['indx', 'name']
231 # element 'vwnd' as ['indx', 'name']
232 # element 'lwnd' as ['indx', 'name']
233 # element 'dwnd' as ['indx', 'name']
235 class special_folders(aetools.ComponentItem):
236 """special folders - The special folders used by the Mac OS """
237 want = 'spfl'
238 class system_folder(aetools.NProperty):
239 """system folder - the System folder """
240 which = 'macs'
241 want = 'obj '
242 class apple_menu_items_folder(aetools.NProperty):
243 """apple menu items folder - the special folder named \xd2Apple Menu Items,\xd3 the contents of which appear in the Apple menu """
244 which = 'amnu'
245 want = 'obj '
246 class control_panels_folder(aetools.NProperty):
247 """control panels folder - the special folder named \xd2Control Panels\xd3 """
248 which = 'ctrl'
249 want = 'obj '
250 class extensions_folder(aetools.NProperty):
251 """extensions folder - the special folder named \xd2Extensions\xd3 """
252 which = 'extn'
253 want = 'obj '
254 class fonts_folder(aetools.NProperty):
255 """fonts folder - the special folder named \xd2Fonts\xd3 """
256 which = 'font'
257 want = 'obj '
258 class preferences_folder(aetools.NProperty):
259 """preferences folder - the special folder named \xd2Preferences\xd3 """
260 which = 'pref'
261 want = 'obj '
262 class shutdown_items_folder(aetools.NProperty):
263 """shutdown items folder - the special folder named \xd2Shutdown Items\xd3 """
264 which = 'shdf'
265 want = 'obj '
266 class startup_items_folder(aetools.NProperty):
267 """startup items folder - the special folder named \xd2Startup Items\xd3 """
268 which = 'strt'
269 want = 'obj '
270 class temporary_items_folder(aetools.NProperty):
271 """temporary items folder - the special folder named \xd2Temporary Items\xd3 (invisible) """
272 which = 'temp'
273 want = 'obj '
274 application._superclassnames = []
275 import Earlier_terms
276 import Containers_and_folders
277 import Files_and_suitcases
278 import Process_classes
279 import Window_classes
280 application._privpropdict = {
281 'clipboard' : clipboard,
282 'largest_free_block' : largest_free_block,
283 'name' : name,
284 'visible' : visible,
285 'frontmost' : frontmost,
286 'selection' : selection,
287 'insertion_location' : insertion_location,
288 'file_sharing' : file_sharing,
289 'sharing_starting_up' : sharing_starting_up,
290 'product_version' : product_version,
291 'version' : version,
292 'about_this_computer' : about_this_computer,
293 'desktop' : desktop,
294 'execution_state' : execution_state,
295 'Finder_preferences' : Finder_preferences,
297 application._privelemdict = {
298 'item' : Earlier_terms.item,
299 'container' : Containers_and_folders.container,
300 'sharable_container' : Earlier_terms.sharable_container,
301 'disk' : Containers_and_folders.disk,
302 'folder' : Containers_and_folders.folder,
303 'file' : Files_and_suitcases.file,
304 'alias_file' : Files_and_suitcases.alias_file,
305 'application_file' : Earlier_terms.application_file,
306 'document_file' : Files_and_suitcases.document_file,
307 'font_file' : Files_and_suitcases.font_file,
308 'desk_accessory_file' : Files_and_suitcases.desk_accessory_file,
309 'internet_location' : Earlier_terms.internet_location,
310 'sound_file' : Files_and_suitcases.sound_file,
311 'clipping' : Files_and_suitcases.clipping,
312 'package' : Files_and_suitcases.package,
313 'suitcase' : Files_and_suitcases.suitcase,
314 'font_suitcase' : Files_and_suitcases.font_suitcase,
315 'accessory_suitcase' : Earlier_terms.accessory_suitcase,
316 'process' : Earlier_terms.process,
317 'application_process' : Process_classes.application_process,
318 'accessory_process' : Earlier_terms.accessory_process,
319 'window' : Earlier_terms.window,
320 'container_window' : Earlier_terms.container_window,
321 'information_window' : Earlier_terms.information_window,
322 'view_options_window' : Window_classes.view_options_window,
323 'clipping_window' : Window_classes.clipping_window,
324 'content_space' : Window_classes.content_space,
326 special_folders._superclassnames = []
327 special_folders._privpropdict = {
328 'system_folder' : system_folder,
329 'apple_menu_items_folder' : apple_menu_items_folder,
330 'control_panels_folder' : control_panels_folder,
331 'extensions_folder' : extensions_folder,
332 'fonts_folder' : fonts_folder,
333 'preferences_folder' : preferences_folder,
334 'shutdown_items_folder' : shutdown_items_folder,
335 'startup_items_folder' : startup_items_folder,
336 'temporary_items_folder' : temporary_items_folder,
338 special_folders._privelemdict = {
342 # Indices of types declared in this module
344 _classdeclarations = {
345 'capp' : application,
346 'spfl' : special_folders,
349 _propdeclarations = {
350 'vers' : version,
351 'ver2' : product_version,
352 'pfrp' : Finder_preferences,
353 'exec' : execution_state,
354 'pins' : insertion_location,
355 'mfre' : largest_free_block,
356 'fsup' : sharing_starting_up,
357 'desk' : desktop,
358 'ctrl' : control_panels_folder,
359 'macs' : system_folder,
360 'font' : fonts_folder,
361 'abbx' : about_this_computer,
362 'shdf' : shutdown_items_folder,
363 'temp' : temporary_items_folder,
364 'pvis' : visible,
365 'sele' : selection,
366 'pisf' : frontmost,
367 'pref' : preferences_folder,
368 'strt' : startup_items_folder,
369 'pcli' : clipboard,
370 'fshr' : file_sharing,
371 'pnam' : name,
372 'extn' : extensions_folder,
373 'amnu' : apple_menu_items_folder,
376 _compdeclarations = {
379 _enumdeclarations = {