Fix three PyChecker-detected gotchas.
[python/dscho.git] / Mac / Lib / lib-scriptpackages / Finder / Finder_Basics.py
blobc75a219df7a4bc492178e8c7f74c3f4afaa8a41a
1 """Suite Finder Basics: Commonly-used Finder commands and object classes
2 Level 1, version 1
4 Generated from Macintosh HD:Systeemmap: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.has_key('errn'):
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.has_key('errn'):
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.has_key('errn'):
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.has_key('errn'):
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.has_key('errn'):
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.has_key('errn'):
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¹s 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¹s name """
157 which = 'pnam'
158 want = 'itxt'
159 class visible(aetools.NProperty):
160 """visible - Is the Finder¹s 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 ³New Folder² 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 ³About this Computer² 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 Finder_preferences(aetools.NProperty):
200 """Finder preferences - Various preferences that apply to the Finder as a whole """
201 which = 'pfrp'
202 want = 'cprf'
203 # element 'cobj' as ['indx', 'name']
204 # element 'ctnr' as ['indx', 'name']
205 # element 'sctr' as ['indx', 'name']
206 # element 'cdis' as ['indx', 'name', 'ID ']
207 # element 'cfol' as ['indx', 'name', 'ID ']
208 # element 'file' as ['indx', 'name']
209 # element 'alia' as ['indx', 'name']
210 # element 'appf' as ['indx', 'name', 'ID ']
211 # element 'docf' as ['indx', 'name']
212 # element 'fntf' as ['indx', 'name']
213 # element 'dafi' as ['indx', 'name']
214 # element 'inlf' as ['indx', 'name']
215 # element 'sndf' as ['indx', 'name']
216 # element 'clpf' as ['indx', 'name']
217 # element 'pack' as ['indx', 'name']
218 # element 'stcs' as ['indx', 'name']
219 # element 'fsut' as ['indx', 'name']
220 # element 'dsut' as ['indx', 'name']
221 # element 'prcs' as ['indx', 'name']
222 # element 'pcap' as ['indx', 'name']
223 # element 'pcda' as ['indx', 'name']
224 # element 'cwin' as ['indx', 'name']
225 # element 'cwnd' as ['indx', 'name']
226 # element 'iwnd' as ['indx', 'name']
227 # element 'lwnd' as ['indx', 'name']
228 # element 'dwnd' as ['indx', 'name']
230 class special_folders(aetools.ComponentItem):
231 """special folders - The special folders used by the Mac OS """
232 want = 'spfl'
233 class system_folder(aetools.NProperty):
234 """system folder - the System folder """
235 which = 'macs'
236 want = 'obj '
237 class apple_menu_items_folder(aetools.NProperty):
238 """apple menu items folder - the special folder named ³Apple Menu Items,² the contents of which appear in the Apple menu """
239 which = 'amnu'
240 want = 'obj '
241 class control_panels_folder(aetools.NProperty):
242 """control panels folder - the special folder named ³Control Panels² """
243 which = 'ctrl'
244 want = 'obj '
245 class extensions_folder(aetools.NProperty):
246 """extensions folder - the special folder named ³Extensions² """
247 which = 'extn'
248 want = 'obj '
249 class fonts_folder(aetools.NProperty):
250 """fonts folder - the special folder named ³Fonts² """
251 which = 'font'
252 want = 'obj '
253 class preferences_folder(aetools.NProperty):
254 """preferences folder - the special folder named ³Preferences² """
255 which = 'pref'
256 want = 'obj '
257 class shutdown_items_folder(aetools.NProperty):
258 """shutdown items folder - the special folder named ³Shutdown Items² """
259 which = 'shdf'
260 want = 'obj '
261 class startup_items_folder(aetools.NProperty):
262 """startup items folder - the special folder named ³Startup Items² """
263 which = 'strt'
264 want = 'obj '
265 class temporary_items_folder(aetools.NProperty):
266 """temporary items folder - the special folder named ³Temporary Items² (invisible) """
267 which = 'temp'
268 want = 'obj '
269 import Earlier_terms
270 import Containers_and_folders
271 import Files_and_suitcases
272 import Process_classes
273 import Window_classes
274 application._propdict = {
275 'clipboard' : clipboard,
276 'largest_free_block' : largest_free_block,
277 'name' : name,
278 'visible' : visible,
279 'frontmost' : frontmost,
280 'selection' : selection,
281 'insertion_location' : insertion_location,
282 'file_sharing' : file_sharing,
283 'sharing_starting_up' : sharing_starting_up,
284 'product_version' : product_version,
285 'version' : version,
286 'about_this_computer' : about_this_computer,
287 'desktop' : desktop,
288 'Finder_preferences' : Finder_preferences,
290 application._elemdict = {
291 'item' : Earlier_terms.item,
292 'container' : Containers_and_folders.container,
293 'sharable_container' : Earlier_terms.sharable_container,
294 'disk' : Containers_and_folders.disk,
295 'folder' : Containers_and_folders.folder,
296 'file' : Files_and_suitcases.file,
297 'alias_file' : Files_and_suitcases.alias_file,
298 'application_file' : Earlier_terms.application_file,
299 'document_file' : Files_and_suitcases.document_file,
300 'font_file' : Files_and_suitcases.font_file,
301 'desk_accessory_file' : Files_and_suitcases.desk_accessory_file,
302 'internet_location' : Earlier_terms.internet_location,
303 'sound_file' : Files_and_suitcases.sound_file,
304 'clipping' : Files_and_suitcases.clipping,
305 'package' : Files_and_suitcases.package,
306 'suitcase' : Files_and_suitcases.suitcase,
307 'font_suitcase' : Files_and_suitcases.font_suitcase,
308 'accessory_suitcase' : Earlier_terms.accessory_suitcase,
309 'process' : Earlier_terms.process,
310 'application_process' : Process_classes.application_process,
311 'accessory_process' : Earlier_terms.accessory_process,
312 'window' : Earlier_terms.window,
313 'container_window' : Earlier_terms.container_window,
314 'information_window' : Earlier_terms.information_window,
315 'clipping_window' : Window_classes.clipping_window,
316 'content_space' : Window_classes.content_space,
318 special_folders._propdict = {
319 'system_folder' : system_folder,
320 'apple_menu_items_folder' : apple_menu_items_folder,
321 'control_panels_folder' : control_panels_folder,
322 'extensions_folder' : extensions_folder,
323 'fonts_folder' : fonts_folder,
324 'preferences_folder' : preferences_folder,
325 'shutdown_items_folder' : shutdown_items_folder,
326 'startup_items_folder' : startup_items_folder,
327 'temporary_items_folder' : temporary_items_folder,
329 special_folders._elemdict = {
333 # Indices of types declared in this module
335 _classdeclarations = {
336 'spfl' : special_folders,
337 'capp' : application,
340 _propdeclarations = {
341 'amnu' : apple_menu_items_folder,
342 'extn' : extensions_folder,
343 'pnam' : name,
344 'fshr' : file_sharing,
345 'pcli' : clipboard,
346 'strt' : startup_items_folder,
347 'pref' : preferences_folder,
348 'pisf' : frontmost,
349 'pins' : insertion_location,
350 'pvis' : visible,
351 'abbx' : about_this_computer,
352 'temp' : temporary_items_folder,
353 'font' : fonts_folder,
354 'pfrp' : Finder_preferences,
355 'desk' : desktop,
356 'fsup' : sharing_starting_up,
357 'mfre' : largest_free_block,
358 'ctrl' : control_panels_folder,
359 'sele' : selection,
360 'shdf' : shutdown_items_folder,
361 'macs' : system_folder,
362 'ver2' : product_version,
363 'vers' : version,
366 _compdeclarations = {
369 _enumdeclarations = {