Fix an amazing number of typos & malformed sentences reported by Detlef
[python/dscho.git] / Mac / Lib / lib-scripting / WWW_Suite.py
blob9564249bc43d253331b1b8311c9523ae2884367b
1 """Suite WorldWideWeb suite, as defined in Spyglass spec.:
2 Level 1, version 1
4 Generated from flap:Programma's:Netscape Navigator� Folder:Netscape Navigator� 3.01
5 AETE/AEUT resource version 1/0, language 0, script 0
6 """
8 import aetools
9 import MacOS
11 _code = 'WWW!'
13 class WorldWideWeb_suite_2c__as_defined_in_Spyglass_spec_2e_:
15 _argmap_OpenURL = {
16 'to' : 'INTO',
17 'toWindow' : 'WIND',
18 'flags' : 'FLGS',
19 'post_data' : 'POST',
20 'post_type' : 'MIME',
21 'progressApp' : 'PROG',
24 def OpenURL(self, _object, _attributes={}, **_arguments):
25 """OpenURL: Opens a URL. Allows for more options than GetURL event
26 Required argument: URL
27 Keyword argument to: file destination
28 Keyword argument toWindow: window iD
29 Keyword argument flags: Binary: any combination of 1, 2 and 4 is allowed: 1 and 2 mean force reload the document. 4 is ignored
30 Keyword argument post_data: Form posting data
31 Keyword argument post_type: MIME type of the posting data. Defaults to application/x-www-form-urlencoded
32 Keyword argument progressApp: Application that will display progress
33 Keyword argument _attributes: AppleEvent attribute dictionary
34 Returns: ID of the loading window
35 """
36 _code = 'WWW!'
37 _subcode = 'OURL'
39 aetools.keysubst(_arguments, self._argmap_OpenURL)
40 _arguments['----'] = _object
43 _reply, _arguments, _attributes = self.send(_code, _subcode,
44 _arguments, _attributes)
45 if _arguments.has_key('errn'):
46 raise aetools.Error, aetools.decodeerror(_arguments)
47 # XXXX Optionally decode result
48 if _arguments.has_key('----'):
49 return _arguments['----']
51 _argmap_ShowFile = {
52 'MIME_type' : 'MIME',
53 'Window_ID' : 'WIND',
54 'URL' : 'URL ',
57 def ShowFile(self, _object, _attributes={}, **_arguments):
58 """ShowFile: Similar to OpenDocuments, except that it specifies the parent URL, and MIME type of the file
59 Required argument: File to open
60 Keyword argument MIME_type: MIME type
61 Keyword argument Window_ID: Window to open the file in
62 Keyword argument URL: Use this as a base URL
63 Keyword argument _attributes: AppleEvent attribute dictionary
64 Returns: Window ID of the loaded window. 0 means ShowFile failed, FFFFFFF means that data was not appropriate type to display in the browser.
65 """
66 _code = 'WWW!'
67 _subcode = 'SHWF'
69 aetools.keysubst(_arguments, self._argmap_ShowFile)
70 _arguments['----'] = _object
73 _reply, _arguments, _attributes = self.send(_code, _subcode,
74 _arguments, _attributes)
75 if _arguments.has_key('errn'):
76 raise aetools.Error, aetools.decodeerror(_arguments)
77 # XXXX Optionally decode result
78 if _arguments.has_key('----'):
79 return _arguments['----']
81 _argmap_parse_anchor = {
82 'relative_to' : 'RELA',
85 def parse_anchor(self, _object, _attributes={}, **_arguments):
86 """parse anchor: Resolves the relative URL
87 Required argument: Main URL
88 Keyword argument relative_to: Relative URL
89 Keyword argument _attributes: AppleEvent attribute dictionary
90 Returns: Parsed URL
91 """
92 _code = 'WWW!'
93 _subcode = 'PRSA'
95 aetools.keysubst(_arguments, self._argmap_parse_anchor)
96 _arguments['----'] = _object
99 _reply, _arguments, _attributes = self.send(_code, _subcode,
100 _arguments, _attributes)
101 if _arguments.has_key('errn'):
102 raise aetools.Error, aetools.decodeerror(_arguments)
103 # XXXX Optionally decode result
104 if _arguments.has_key('----'):
105 return _arguments['----']
107 _argmap_cancel_progress = {
108 'in_window' : 'WIND',
111 def cancel_progress(self, _object=None, _attributes={}, **_arguments):
112 """cancel progress: Interrupts the download of the document in the given window
113 Required argument: progress ID, obtained from the progress app
114 Keyword argument in_window: window ID of the progress to cancel
115 Keyword argument _attributes: AppleEvent attribute dictionary
117 _code = 'WWW!'
118 _subcode = 'CNCL'
120 aetools.keysubst(_arguments, self._argmap_cancel_progress)
121 _arguments['----'] = _object
124 _reply, _arguments, _attributes = self.send(_code, _subcode,
125 _arguments, _attributes)
126 if _arguments.has_key('errn'):
127 raise aetools.Error, aetools.decodeerror(_arguments)
128 # XXXX Optionally decode result
129 if _arguments.has_key('----'):
130 return _arguments['----']
132 def find_URL(self, _object, _attributes={}, **_arguments):
133 """find URL: If the file was downloaded by Netscape, you can call FindURL to find out the URL used to download the file.
134 Required argument: File spec
135 Keyword argument _attributes: AppleEvent attribute dictionary
136 Returns: The URL
138 _code = 'WWW!'
139 _subcode = 'FURL'
141 if _arguments: raise TypeError, 'No optional args expected'
142 _arguments['----'] = _object
145 _reply, _arguments, _attributes = self.send(_code, _subcode,
146 _arguments, _attributes)
147 if _arguments.has_key('errn'):
148 raise aetools.Error, aetools.decodeerror(_arguments)
149 # XXXX Optionally decode result
150 if _arguments.has_key('----'):
151 return _arguments['----']
153 def webActivate(self, _object=None, _attributes={}, **_arguments):
154 """webActivate: Makes Netscape the frontmost application, and selects a given window. This event is here for suite completeness/ cross-platform compatibility only, you should use standard AppleEvents instead.
155 Required argument: window to bring to front
156 Keyword argument _attributes: AppleEvent attribute dictionary
158 _code = 'WWW!'
159 _subcode = 'ACTV'
161 if _arguments: raise TypeError, 'No optional args expected'
162 _arguments['----'] = _object
165 _reply, _arguments, _attributes = self.send(_code, _subcode,
166 _arguments, _attributes)
167 if _arguments.has_key('errn'):
168 raise aetools.Error, aetools.decodeerror(_arguments)
169 # XXXX Optionally decode result
170 if _arguments.has_key('----'):
171 return _arguments['----']
173 def list_windows(self, _no_object=None, _attributes={}, **_arguments):
174 """list windows: Lists the IDs of all the hypertext windows
175 Keyword argument _attributes: AppleEvent attribute dictionary
176 Returns: List of unique IDs of all the hypertext windows
178 _code = 'WWW!'
179 _subcode = 'LSTW'
181 if _arguments: raise TypeError, 'No optional args expected'
182 if _no_object != None: raise TypeError, 'No direct arg expected'
185 _reply, _arguments, _attributes = self.send(_code, _subcode,
186 _arguments, _attributes)
187 if _arguments.has_key('errn'):
188 raise aetools.Error, aetools.decodeerror(_arguments)
189 # XXXX Optionally decode result
190 if _arguments.has_key('----'):
191 return _arguments['----']
193 def get_window_info(self, _object=None, _attributes={}, **_arguments):
194 """get window info: Returns the information about the window as a list. Currently the list contains the window title and the URL. You can get the same information using standard Apple Event GetProperty.
195 Required argument: window ID
196 Keyword argument _attributes: AppleEvent attribute dictionary
197 Returns: undocumented, typecode 'list'
199 _code = 'WWW!'
200 _subcode = 'WNFO'
202 if _arguments: raise TypeError, 'No optional args expected'
203 _arguments['----'] = _object
206 _reply, _arguments, _attributes = self.send(_code, _subcode,
207 _arguments, _attributes)
208 if _arguments.has_key('errn'):
209 raise aetools.Error, aetools.decodeerror(_arguments)
210 # XXXX Optionally decode result
211 if _arguments.has_key('----'):
212 return _arguments['----']
214 def register_URL_echo(self, _object=None, _attributes={}, **_arguments):
215 """register URL echo: Registers the ³echo² application. Each download from now on will be echoed to this application.
216 Required argument: Application signature
217 Keyword argument _attributes: AppleEvent attribute dictionary
219 _code = 'WWW!'
220 _subcode = 'RGUE'
222 if _arguments: raise TypeError, 'No optional args expected'
223 _arguments['----'] = _object
226 _reply, _arguments, _attributes = self.send(_code, _subcode,
227 _arguments, _attributes)
228 if _arguments.has_key('errn'):
229 raise aetools.Error, aetools.decodeerror(_arguments)
230 # XXXX Optionally decode result
231 if _arguments.has_key('----'):
232 return _arguments['----']
234 def unregister_URL_echo(self, _object, _attributes={}, **_arguments):
235 """unregister URL echo: cancels URL echo
236 Required argument: application signature
237 Keyword argument _attributes: AppleEvent attribute dictionary
239 _code = 'WWW!'
240 _subcode = 'UNRU'
242 if _arguments: raise TypeError, 'No optional args expected'
243 _arguments['----'] = _object
246 _reply, _arguments, _attributes = self.send(_code, _subcode,
247 _arguments, _attributes)
248 if _arguments.has_key('errn'):
249 raise aetools.Error, aetools.decodeerror(_arguments)
250 # XXXX Optionally decode result
251 if _arguments.has_key('----'):
252 return _arguments['----']
254 _argmap_register_viewer = {
255 'MIME_type' : 'MIME',
256 'with_file_type' : 'FTYP',
259 def register_viewer(self, _object, _attributes={}, **_arguments):
260 """register viewer: Registers an application as a Œspecial¹ viewer for this MIME type. The application will be launched with ViewDoc events
261 Required argument: Application sig
262 Keyword argument MIME_type: MIME type viewer is registering for
263 Keyword argument with_file_type: Mac file type for the downloaded files
264 Keyword argument _attributes: AppleEvent attribute dictionary
265 Returns: TRUE if registration has been successful
267 _code = 'WWW!'
268 _subcode = 'RGVW'
270 aetools.keysubst(_arguments, self._argmap_register_viewer)
271 _arguments['----'] = _object
274 _reply, _arguments, _attributes = self.send(_code, _subcode,
275 _arguments, _attributes)
276 if _arguments.has_key('errn'):
277 raise aetools.Error, aetools.decodeerror(_arguments)
278 # XXXX Optionally decode result
279 if _arguments.has_key('----'):
280 return _arguments['----']
282 _argmap_unregister_viewer = {
283 'MIME_type' : 'MIME',
286 def unregister_viewer(self, _object, _attributes={}, **_arguments):
287 """unregister viewer: Revert to the old way of handling this MIME type
288 Required argument: Application sig
289 Keyword argument MIME_type: MIME type to be unregistered
290 Keyword argument _attributes: AppleEvent attribute dictionary
291 Returns: TRUE if the event was successful
293 _code = 'WWW!'
294 _subcode = 'UNRV'
296 aetools.keysubst(_arguments, self._argmap_unregister_viewer)
297 _arguments['----'] = _object
300 _reply, _arguments, _attributes = self.send(_code, _subcode,
301 _arguments, _attributes)
302 if _arguments.has_key('errn'):
303 raise aetools.Error, aetools.decodeerror(_arguments)
304 # XXXX Optionally decode result
305 if _arguments.has_key('----'):
306 return _arguments['----']
308 _argmap_register_protocol = {
309 'for_protocol' : 'PROT',
312 def register_protocol(self, _object=None, _attributes={}, **_arguments):
313 """register protocol: Registers application as a ³handler² for this protocol with a given prefix. The handler will receive ³OpenURL², or if that fails, ³GetURL² event.
314 Required argument: Application sig
315 Keyword argument for_protocol: protocol prefix: ³finger:², ³file²,
316 Keyword argument _attributes: AppleEvent attribute dictionary
317 Returns: TRUE if registration has been successful
319 _code = 'WWW!'
320 _subcode = 'RGPR'
322 aetools.keysubst(_arguments, self._argmap_register_protocol)
323 _arguments['----'] = _object
326 _reply, _arguments, _attributes = self.send(_code, _subcode,
327 _arguments, _attributes)
328 if _arguments.has_key('errn'):
329 raise aetools.Error, aetools.decodeerror(_arguments)
330 # XXXX Optionally decode result
331 if _arguments.has_key('----'):
332 return _arguments['----']
334 _argmap_unregister_protocol = {
335 'for_protocol' : 'PROT',
338 def unregister_protocol(self, _object=None, _attributes={}, **_arguments):
339 """unregister protocol: reverses the effects of ³register protocol²
340 Required argument: Application sig.
341 Keyword argument for_protocol: protocol prefix. If none, unregister for all protocols
342 Keyword argument _attributes: AppleEvent attribute dictionary
343 Returns: TRUE if successful
345 _code = 'WWW!'
346 _subcode = 'UNRP'
348 aetools.keysubst(_arguments, self._argmap_unregister_protocol)
349 _arguments['----'] = _object
352 _reply, _arguments, _attributes = self.send(_code, _subcode,
353 _arguments, _attributes)
354 if _arguments.has_key('errn'):
355 raise aetools.Error, aetools.decodeerror(_arguments)
356 # XXXX Optionally decode result
357 if _arguments.has_key('----'):
358 return _arguments['----']
360 _argmap_register_window_close = {
361 'for_window' : 'WIND',
364 def register_window_close(self, _object=None, _attributes={}, **_arguments):
365 """register window close: Netscape will notify registered application when this window closes
366 Required argument: Application signature
367 Keyword argument for_window: window ID
368 Keyword argument _attributes: AppleEvent attribute dictionary
369 Returns: true if successful
371 _code = 'WWW!'
372 _subcode = 'RGWC'
374 aetools.keysubst(_arguments, self._argmap_register_window_close)
375 _arguments['----'] = _object
378 _reply, _arguments, _attributes = self.send(_code, _subcode,
379 _arguments, _attributes)
380 if _arguments.has_key('errn'):
381 raise aetools.Error, aetools.decodeerror(_arguments)
382 # XXXX Optionally decode result
383 if _arguments.has_key('----'):
384 return _arguments['----']
386 _argmap_unregister_window_close = {
387 'for_window' : 'WIND',
390 def unregister_window_close(self, _object=None, _attributes={}, **_arguments):
391 """unregister window close: Undo for register window close
392 Required argument: Application signature
393 Keyword argument for_window: window ID
394 Keyword argument _attributes: AppleEvent attribute dictionary
395 Returns: true if successful
397 _code = 'WWW!'
398 _subcode = 'UNRC'
400 aetools.keysubst(_arguments, self._argmap_unregister_window_close)
401 _arguments['----'] = _object
404 _reply, _arguments, _attributes = self.send(_code, _subcode,
405 _arguments, _attributes)
406 if _arguments.has_key('errn'):
407 raise aetools.Error, aetools.decodeerror(_arguments)
408 # XXXX Optionally decode result
409 if _arguments.has_key('----'):
410 return _arguments['----']
414 # Indices of types declared in this module
416 _classdeclarations = {
419 _propdeclarations = {
422 _compdeclarations = {
425 _enumdeclarations = {