summaryrefslogtreecommitdiffstats
path: root/Lib/plat-mac/lib-scriptpackages/Netscape/WorldWideWeb_suite.py
blob: 152c24a9eaf51028ae27b22413ffb6b82415f6e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
"""Suite WorldWideWeb suite, as defined in Spyglass spec.: 
Level 1, version 1

Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2
AETE/AEUT resource version 1/0, language 0, script 0
"""

import aetools
import MacOS

_code = 'WWW!'

class WorldWideWeb_suite_Events:

    _argmap_OpenURL = {
        'to' : 'INTO',
        'toWindow' : 'WIND',
        'flags' : 'FLGS',
        'post_data' : 'POST',
        'post_type' : 'MIME',
        'progressApp' : 'PROG',
    }

    def OpenURL(self, _object, _attributes={}, **_arguments):
        """OpenURL: Opens a URL. Allows for more options than GetURL event
        Required argument: URL
        Keyword argument to: file destination
        Keyword argument toWindow: window iD
        Keyword argument flags: Binary: any combination of 1, 2 and 4 is allowed: 1 and 2 mean force reload the document. 4 is ignored
        Keyword argument post_data: Form posting data
        Keyword argument post_type: MIME type of the posting data. Defaults to application/x-www-form-urlencoded
        Keyword argument progressApp: Application that will display progress
        Keyword argument _attributes: AppleEvent attribute dictionary
        Returns: ID of the loading window
        """
        _code = 'WWW!'
        _subcode = 'OURL'

        aetools.keysubst(_arguments, self._argmap_OpenURL)
        _arguments['----'] = _object


        _reply, _arguments, _attributes = self.send(_code, _subcode,
                _arguments, _attributes)
        if _arguments.get('errn', 0):
            raise aetools.Error, aetools.decodeerror(_arguments)
        # XXXX Optionally decode result
        if _arguments.has_key('----'):
            return _arguments['----']

    _argmap_ShowFile = {
        'MIME_type' : 'MIME',
        'Window_ID' : 'WIND',
        'URL' : 'URL ',
    }

    def ShowFile(self, _object, _attributes={}, **_arguments):
        """ShowFile: Similar to OpenDocuments, except that it specifies the parent URL, and MIME type of the file
        Required argument: File to open
        Keyword argument MIME_type: MIME type
        Keyword argument Window_ID: Window to open the file in
        Keyword argument URL: Use this as a base URL
        Keyword argument _attributes: AppleEvent attribute dictionary
        Returns: Window ID of the loaded window. 0 means ShowFile failed, FFFFFFF means that data was not appropriate type to display in the browser.
        """
        _code = 'WWW!'
        _subcode = 'SHWF'

        aetools.keysubst(_arguments, self._argmap_ShowFile)
        _arguments['----'] = _object


        _reply, _arguments, _attributes = self.send(_code, _subcode,
                _arguments, _attributes)
        if _arguments.get('errn', 0):
            raise aetools.Error, aetools.decodeerror(_arguments)
        # XXXX Optionally decode result
        if _arguments.has_key('----'):
            return _arguments['----']

    _argmap_cancel_progress = {
        'in_window' : 'WIND',
    }

    def cancel_progress(self, _object=None, _attributes={}, **_arguments):
        """cancel progress: Interrupts the download of the document in the given window
        Required argument: progress ID, obtained from the progress app
        Keyword argument in_window: window ID of the progress to cancel
        Keyword argument _attributes: AppleEvent attribute dictionary
        """
        _code = 'WWW!'
        _subcode = 'CNCL'

        aetools.keysubst(_arguments, self._argmap_cancel_progress)
        _arguments['----'] = _object


        _reply, _arguments, _attributes = self.send(_code, _subcode,
                _arguments, _attributes)
        if _arguments.get('errn', 0):
            raise aetools.Error, aetools.decodeerror(_arguments)
        # XXXX Optionally decode result
        if _arguments.has_key('----'):
            return _arguments['----']

    def find_URL(self, _object, _attributes={}, **_arguments):
        """find URL: If the file was downloaded by Netscape, you can call FindURL to find out the URL used to download the file.
        Required argument: File spec
        Keyword argument _attributes: AppleEvent attribute dictionary
        Returns: The URL
        """
        _code = 'WWW!'
        _subcode = 'FURL'

        if _arguments: raise TypeError, 'No optional args expected'
        _arguments['----'] = _object


        _reply, _arguments, _attributes = self.send(_code, _subcode,
                _arguments, _attributes)
        if _arguments.get('errn', 0):
            raise aetools.Error, aetools.decodeerror(_arguments)
        # XXXX Optionally decode result
        if _arguments.has_key('----'):
            return _arguments['----']

    def get_window_info(self, _object=None, _attributes={}, **_arguments):
        """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.
        Required argument: window ID
        Keyword argument _attributes: AppleEvent attribute dictionary
        Returns: undocumented, typecode 'list'
        """
        _code = 'WWW!'
        _subcode = 'WNFO'

        if _arguments: raise TypeError, 'No optional args expected'
        _arguments['----'] = _object


        _reply, _arguments, _attributes = self.send(_code, _subcode,
                _arguments, _attributes)
        if _arguments.get('errn', 0):
            raise aetools.Error, aetools.decodeerror(_arguments)
        # XXXX Optionally decode result
        if _arguments.has_key('----'):
            return _arguments['----']

    def list_windows(self, _no_object=None, _attributes={}, **_arguments):
        """list windows: Lists the IDs of all the hypertext windows
        Keyword argument _attributes: AppleEvent attribute dictionary
        Returns: List of unique IDs of all the hypertext windows
        """
        _code = 'WWW!'
        _subcode = 'LSTW'

        if _arguments: raise TypeError, 'No optional args expected'
        if _no_object != None: raise TypeError, 'No direct arg expected'


        _reply, _arguments, _attributes = self.send(_code, _subcode,
                _arguments, _attributes)
        if _arguments.get('errn', 0):
            raise aetools.Error, aetools.decodeerror(_arguments)
        # XXXX Optionally decode result
        if _arguments.has_key('----'):
            return _arguments['----']

    _argmap_parse_anchor = {
        'relative_to' : 'RELA',
    }

    def parse_anchor(self, _object, _attributes={}, **_arguments):
        """parse anchor: Resolves the relative URL
        Required argument: Main URL
        Keyword argument relative_to: Relative URL
        Keyword argument _attributes: AppleEvent attribute dictionary
        Returns: Parsed  URL
        """
        _code = 'WWW!'
        _subcode = 'PRSA'

        aetools.keysubst(_arguments, self._argmap_parse_anchor)
        _arguments['----'] = _object


        _reply, _arguments, _attributes = self.send(_code, _subcode,
                _arguments, _attributes)
        if _arguments.get('errn', 0):
            raise aetools.Error, aetools.decodeerror(_arguments)
        # XXXX Optionally decode result
        if _arguments.has_key('----'):
            return _arguments['----']

    def register_URL_echo(self, _object=None, _attributes={}, **_arguments):
        """register URL echo: Registers the \xd2echo\xd3 application. Each download from now on will be echoed to this application.
        Required argument: Application signature
        Keyword argument _attributes: AppleEvent attribute dictionary
        """
        _code = 'WWW!'
        _subcode = 'RGUE'

        if _arguments: raise TypeError, 'No optional args expected'
        _arguments['----'] = _object


        _reply, _arguments, _attributes = self.send(_code, _subcode,
                _arguments, _attributes)
        if _arguments.get('errn', 0):
            raise aetools.Error, aetools.decodeerror(_arguments)
        # XXXX Optionally decode result
        if _arguments.has_key('----'):
            return _arguments['----']

    _argmap_register_protocol = {
        'for_protocol' : 'PROT',
    }

    def register_protocol(self, _object=None, _attributes={}, **_arguments):
        """register protocol: Registers application as a \xd2handler\xd3 for this protocol with a given prefix. The handler will receive \xd2OpenURL\xd3, or if that fails, \xd2GetURL\xd3 event.
        Required argument: Application sig
        Keyword argument for_protocol: protocol prefix: \xd2finger:\xd3, \xd2file\xd3,
        Keyword argument _attributes: AppleEvent attribute dictionary
        Returns: TRUE if registration has been successful
        """
        _code = 'WWW!'
        _subcode = 'RGPR'

        aetools.keysubst(_arguments, self._argmap_register_protocol)
        _arguments['----'] = _object


        _reply, _arguments, _attributes = self.send(_code, _subcode,
                _arguments, _attributes)
        if _arguments.get('errn', 0):
            raise aetools.Error, aetools.decodeerror(_arguments)
        # XXXX Optionally decode result
        if _arguments.has_key('----'):
            return _arguments['----']

    _argmap_register_viewer = {
        'MIME_type' : 'MIME',
        'with_file_type' : 'FTYP',
    }

    def register_viewer(self, _object, _attributes={}, **_arguments):
        """register viewer: Registers an application as a \xd4special\xd5 viewer for this MIME type. The application will be launched with ViewDoc events
        Required argument: Application sig
        Keyword argument MIME_type: MIME type viewer is registering for
        Keyword argument with_file_type: Mac file type for the downloaded files
        Keyword argument _attributes: AppleEvent attribute dictionary
        Returns: TRUE if registration has been successful
        """
        _code = 'WWW!'
        _subcode = 'RGVW'

        aetools.keysubst(_arguments, self._argmap_register_viewer)
        _arguments['----'] = _object


        _reply, _arguments, _attributes = self.send(_code, _subcode,
                _arguments, _attributes)
        if _arguments.get('errn', 0):
            raise aetools.Error, aetools.decodeerror(_arguments)
        # XXXX Optionally decode result
        if _arguments.has_key('----'):
            return _arguments['----']

    _argmap_register_window_close = {
        'for_window' : 'WIND',
    }

    def register_window_close(self, _object=None, _attributes={}, **_arguments):
        """register window close: Netscape will notify registered application when this window closes
        Required argument: Application signature
        Keyword argument for_window: window ID
        Keyword argument _attributes: AppleEvent attribute dictionary
        Returns: true if successful
        """
        _code = 'WWW!'
        _subcode = 'RGWC'

        aetools.keysubst(_arguments, self._argmap_register_window_close)
        _arguments['----'] = _object


        _reply, _arguments, _attributes = self.send(_code, _subcode,
                _arguments, _attributes)
        if _arguments.get('errn', 0):
            raise aetools.Error, aetools.decodeerror(_arguments)
        # XXXX Optionally decode result
        if _arguments.has_key('----'):
            return _arguments['----']

    def unregister_URL_echo(self, _object, _attributes={}, **_arguments):
        """unregister URL echo: cancels URL echo
        Required argument: application signature
        Keyword argument _attributes: AppleEvent attribute dictionary
        """
        _code = 'WWW!'
        _subcode = 'UNRU'

        if _arguments: raise TypeError, 'No optional args expected'
        _arguments['----'] = _object


        _reply, _arguments, _attributes = self.send(_code, _subcode,
                _arguments, _attributes)
        if _arguments.get('errn', 0):
            raise aetools.Error, aetools.decodeerror(_arguments)
        # XXXX Optionally decode result
        if _arguments.has_key('----'):
            return _arguments['----']

    _argmap_unregister_protocol = {
        'for_protocol' : 'PROT',
    }

    def unregister_protocol(self, _object=None, _attributes={}, **_arguments):
        """unregister protocol: reverses the effects of \xd2register protocol\xd3
        Required argument: Application sig. 
        Keyword argument for_protocol: protocol prefix. If none, unregister for all protocols
        Keyword argument _attributes: AppleEvent attribute dictionary
        Returns: TRUE if successful
        """
        _code = 'WWW!'
        _subcode = 'UNRP'

        aetools.keysubst(_arguments, self._argmap_unregister_protocol)
        _arguments['----'] = _object


        _reply, _arguments, _attributes = self.send(_code, _subcode,
                _arguments, _attributes)
        if _arguments.get('errn', 0):
            raise aetools.Error, aetools.decodeerror(_arguments)
        # XXXX Optionally decode result
        if _arguments.has_key('----'):
            return _arguments['----']

    _argmap_unregister_viewer = {
        'MIME_type' : 'MIME',
    }

    def unregister_viewer(self, _object, _attributes={}, **_arguments):
        """unregister viewer: Revert to the old way of handling this MIME type
        Required argument: Application sig
        Keyword argument MIME_type: MIME type to be unregistered
        Keyword argument _attributes: AppleEvent attribute dictionary
        Returns: TRUE if the event was successful
        """
        _code = 'WWW!'
        _subcode = 'UNRV'

        aetools.keysubst(_arguments, self._argmap_unregister_viewer)
        _arguments['----'] = _object


        _reply, _arguments, _attributes = self.send(_code, _subcode,
                _arguments, _attributes)
        if _arguments.get('errn', 0):
            raise aetools.Error, aetools.decodeerror(_arguments)
        # XXXX Optionally decode result
        if _arguments.has_key('----'):
            return _arguments['----']

    _argmap_unregister_window_close = {
        'for_window' : 'WIND',
    }

    def unregister_window_close(self, _object=None, _attributes={}, **_arguments):
        """unregister window close: Undo for register window close
        Required argument: Application signature
        Keyword argument for_window: window ID
        Keyword argument _attributes: AppleEvent attribute dictionary
        Returns: true if successful
        """
        _code = 'WWW!'
        _subcode = 'UNRC'

        aetools.keysubst(_arguments, self._argmap_unregister_window_close)
        _arguments['----'] = _object


        _reply, _arguments, _attributes = self.send(_code, _subcode,
                _arguments, _attributes)
        if _arguments.get('errn', 0):
            raise aetools.Error, aetools.decodeerror(_arguments)
        # XXXX Optionally decode result
        if _arguments.has_key('----'):
            return _arguments['----']

    def webActivate(self, _object=None, _attributes={}, **_arguments):
        """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.
        Required argument: window to bring to front
        Keyword argument _attributes: AppleEvent attribute dictionary
        """
        _code = 'WWW!'
        _subcode = 'ACTV'

        if _arguments: raise TypeError, 'No optional args expected'
        _arguments['----'] = _object


        _reply, _arguments, _attributes = self.send(_code, _subcode,
                _arguments, _attributes)
        if _arguments.get('errn', 0):
            raise aetools.Error, aetools.decodeerror(_arguments)
        # XXXX Optionally decode result
        if _arguments.has_key('----'):
            return _arguments['----']


#
# Indices of types declared in this module
#
_classdeclarations = {
}

_propdeclarations = {
}

_compdeclarations = {
}

_enumdeclarations = {
}