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

Python code coverage for Lib/plat-mac/lib-scriptpackages/Netscape/WorldWideWeb_suite.py

#countcontent
1n/a"""Suite WorldWideWeb suite, as defined in Spyglass spec.:
2n/aLevel 1, version 1
3n/a
4n/aGenerated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2
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 = 'WWW!'
12n/a
13n/aclass WorldWideWeb_suite_Events:
14n/a
15n/a _argmap_OpenURL = {
16n/a 'to' : 'INTO',
17n/a 'toWindow' : 'WIND',
18n/a 'flags' : 'FLGS',
19n/a 'post_data' : 'POST',
20n/a 'post_type' : 'MIME',
21n/a 'progressApp' : 'PROG',
22n/a }
23n/a
24n/a def OpenURL(self, _object, _attributes={}, **_arguments):
25n/a """OpenURL: Opens a URL. Allows for more options than GetURL event
26n/a Required argument: URL
27n/a Keyword argument to: file destination
28n/a Keyword argument toWindow: window iD
29n/a Keyword argument flags: Binary: any combination of 1, 2 and 4 is allowed: 1 and 2 mean force reload the document. 4 is ignored
30n/a Keyword argument post_data: Form posting data
31n/a Keyword argument post_type: MIME type of the posting data. Defaults to application/x-www-form-urlencoded
32n/a Keyword argument progressApp: Application that will display progress
33n/a Keyword argument _attributes: AppleEvent attribute dictionary
34n/a Returns: ID of the loading window
35n/a """
36n/a _code = 'WWW!'
37n/a _subcode = 'OURL'
38n/a
39n/a aetools.keysubst(_arguments, self._argmap_OpenURL)
40n/a _arguments['----'] = _object
41n/a
42n/a
43n/a _reply, _arguments, _attributes = self.send(_code, _subcode,
44n/a _arguments, _attributes)
45n/a if _arguments.get('errn', 0):
46n/a raise aetools.Error, aetools.decodeerror(_arguments)
47n/a # XXXX Optionally decode result
48n/a if _arguments.has_key('----'):
49n/a return _arguments['----']
50n/a
51n/a _argmap_ShowFile = {
52n/a 'MIME_type' : 'MIME',
53n/a 'Window_ID' : 'WIND',
54n/a 'URL' : 'URL ',
55n/a }
56n/a
57n/a def ShowFile(self, _object, _attributes={}, **_arguments):
58n/a """ShowFile: Similar to OpenDocuments, except that it specifies the parent URL, and MIME type of the file
59n/a Required argument: File to open
60n/a Keyword argument MIME_type: MIME type
61n/a Keyword argument Window_ID: Window to open the file in
62n/a Keyword argument URL: Use this as a base URL
63n/a Keyword argument _attributes: AppleEvent attribute dictionary
64n/a Returns: Window ID of the loaded window. 0 means ShowFile failed, FFFFFFF means that data was not appropriate type to display in the browser.
65n/a """
66n/a _code = 'WWW!'
67n/a _subcode = 'SHWF'
68n/a
69n/a aetools.keysubst(_arguments, self._argmap_ShowFile)
70n/a _arguments['----'] = _object
71n/a
72n/a
73n/a _reply, _arguments, _attributes = self.send(_code, _subcode,
74n/a _arguments, _attributes)
75n/a if _arguments.get('errn', 0):
76n/a raise aetools.Error, aetools.decodeerror(_arguments)
77n/a # XXXX Optionally decode result
78n/a if _arguments.has_key('----'):
79n/a return _arguments['----']
80n/a
81n/a _argmap_cancel_progress = {
82n/a 'in_window' : 'WIND',
83n/a }
84n/a
85n/a def cancel_progress(self, _object=None, _attributes={}, **_arguments):
86n/a """cancel progress: Interrupts the download of the document in the given window
87n/a Required argument: progress ID, obtained from the progress app
88n/a Keyword argument in_window: window ID of the progress to cancel
89n/a Keyword argument _attributes: AppleEvent attribute dictionary
90n/a """
91n/a _code = 'WWW!'
92n/a _subcode = 'CNCL'
93n/a
94n/a aetools.keysubst(_arguments, self._argmap_cancel_progress)
95n/a _arguments['----'] = _object
96n/a
97n/a
98n/a _reply, _arguments, _attributes = self.send(_code, _subcode,
99n/a _arguments, _attributes)
100n/a if _arguments.get('errn', 0):
101n/a raise aetools.Error, aetools.decodeerror(_arguments)
102n/a # XXXX Optionally decode result
103n/a if _arguments.has_key('----'):
104n/a return _arguments['----']
105n/a
106n/a def find_URL(self, _object, _attributes={}, **_arguments):
107n/a """find URL: If the file was downloaded by Netscape, you can call FindURL to find out the URL used to download the file.
108n/a Required argument: File spec
109n/a Keyword argument _attributes: AppleEvent attribute dictionary
110n/a Returns: The URL
111n/a """
112n/a _code = 'WWW!'
113n/a _subcode = 'FURL'
114n/a
115n/a if _arguments: raise TypeError, 'No optional args expected'
116n/a _arguments['----'] = _object
117n/a
118n/a
119n/a _reply, _arguments, _attributes = self.send(_code, _subcode,
120n/a _arguments, _attributes)
121n/a if _arguments.get('errn', 0):
122n/a raise aetools.Error, aetools.decodeerror(_arguments)
123n/a # XXXX Optionally decode result
124n/a if _arguments.has_key('----'):
125n/a return _arguments['----']
126n/a
127n/a def get_window_info(self, _object=None, _attributes={}, **_arguments):
128n/a """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.
129n/a Required argument: window ID
130n/a Keyword argument _attributes: AppleEvent attribute dictionary
131n/a Returns: undocumented, typecode 'list'
132n/a """
133n/a _code = 'WWW!'
134n/a _subcode = 'WNFO'
135n/a
136n/a if _arguments: raise TypeError, 'No optional args expected'
137n/a _arguments['----'] = _object
138n/a
139n/a
140n/a _reply, _arguments, _attributes = self.send(_code, _subcode,
141n/a _arguments, _attributes)
142n/a if _arguments.get('errn', 0):
143n/a raise aetools.Error, aetools.decodeerror(_arguments)
144n/a # XXXX Optionally decode result
145n/a if _arguments.has_key('----'):
146n/a return _arguments['----']
147n/a
148n/a def list_windows(self, _no_object=None, _attributes={}, **_arguments):
149n/a """list windows: Lists the IDs of all the hypertext windows
150n/a Keyword argument _attributes: AppleEvent attribute dictionary
151n/a Returns: List of unique IDs of all the hypertext windows
152n/a """
153n/a _code = 'WWW!'
154n/a _subcode = 'LSTW'
155n/a
156n/a if _arguments: raise TypeError, 'No optional args expected'
157n/a if _no_object is not None: raise TypeError, 'No direct arg expected'
158n/a
159n/a
160n/a _reply, _arguments, _attributes = self.send(_code, _subcode,
161n/a _arguments, _attributes)
162n/a if _arguments.get('errn', 0):
163n/a raise aetools.Error, aetools.decodeerror(_arguments)
164n/a # XXXX Optionally decode result
165n/a if _arguments.has_key('----'):
166n/a return _arguments['----']
167n/a
168n/a _argmap_parse_anchor = {
169n/a 'relative_to' : 'RELA',
170n/a }
171n/a
172n/a def parse_anchor(self, _object, _attributes={}, **_arguments):
173n/a """parse anchor: Resolves the relative URL
174n/a Required argument: Main URL
175n/a Keyword argument relative_to: Relative URL
176n/a Keyword argument _attributes: AppleEvent attribute dictionary
177n/a Returns: Parsed URL
178n/a """
179n/a _code = 'WWW!'
180n/a _subcode = 'PRSA'
181n/a
182n/a aetools.keysubst(_arguments, self._argmap_parse_anchor)
183n/a _arguments['----'] = _object
184n/a
185n/a
186n/a _reply, _arguments, _attributes = self.send(_code, _subcode,
187n/a _arguments, _attributes)
188n/a if _arguments.get('errn', 0):
189n/a raise aetools.Error, aetools.decodeerror(_arguments)
190n/a # XXXX Optionally decode result
191n/a if _arguments.has_key('----'):
192n/a return _arguments['----']
193n/a
194n/a def register_URL_echo(self, _object=None, _attributes={}, **_arguments):
195n/a """register URL echo: Registers the \xd2echo\xd3 application. Each download from now on will be echoed to this application.
196n/a Required argument: Application signature
197n/a Keyword argument _attributes: AppleEvent attribute dictionary
198n/a """
199n/a _code = 'WWW!'
200n/a _subcode = 'RGUE'
201n/a
202n/a if _arguments: raise TypeError, 'No optional args expected'
203n/a _arguments['----'] = _object
204n/a
205n/a
206n/a _reply, _arguments, _attributes = self.send(_code, _subcode,
207n/a _arguments, _attributes)
208n/a if _arguments.get('errn', 0):
209n/a raise aetools.Error, aetools.decodeerror(_arguments)
210n/a # XXXX Optionally decode result
211n/a if _arguments.has_key('----'):
212n/a return _arguments['----']
213n/a
214n/a _argmap_register_protocol = {
215n/a 'for_protocol' : 'PROT',
216n/a }
217n/a
218n/a def register_protocol(self, _object=None, _attributes={}, **_arguments):
219n/a """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.
220n/a Required argument: Application sig
221n/a Keyword argument for_protocol: protocol prefix: \xd2finger:\xd3, \xd2file\xd3,
222n/a Keyword argument _attributes: AppleEvent attribute dictionary
223n/a Returns: TRUE if registration has been successful
224n/a """
225n/a _code = 'WWW!'
226n/a _subcode = 'RGPR'
227n/a
228n/a aetools.keysubst(_arguments, self._argmap_register_protocol)
229n/a _arguments['----'] = _object
230n/a
231n/a
232n/a _reply, _arguments, _attributes = self.send(_code, _subcode,
233n/a _arguments, _attributes)
234n/a if _arguments.get('errn', 0):
235n/a raise aetools.Error, aetools.decodeerror(_arguments)
236n/a # XXXX Optionally decode result
237n/a if _arguments.has_key('----'):
238n/a return _arguments['----']
239n/a
240n/a _argmap_register_viewer = {
241n/a 'MIME_type' : 'MIME',
242n/a 'with_file_type' : 'FTYP',
243n/a }
244n/a
245n/a def register_viewer(self, _object, _attributes={}, **_arguments):
246n/a """register viewer: Registers an application as a \xd4special\xd5 viewer for this MIME type. The application will be launched with ViewDoc events
247n/a Required argument: Application sig
248n/a Keyword argument MIME_type: MIME type viewer is registering for
249n/a Keyword argument with_file_type: Mac file type for the downloaded files
250n/a Keyword argument _attributes: AppleEvent attribute dictionary
251n/a Returns: TRUE if registration has been successful
252n/a """
253n/a _code = 'WWW!'
254n/a _subcode = 'RGVW'
255n/a
256n/a aetools.keysubst(_arguments, self._argmap_register_viewer)
257n/a _arguments['----'] = _object
258n/a
259n/a
260n/a _reply, _arguments, _attributes = self.send(_code, _subcode,
261n/a _arguments, _attributes)
262n/a if _arguments.get('errn', 0):
263n/a raise aetools.Error, aetools.decodeerror(_arguments)
264n/a # XXXX Optionally decode result
265n/a if _arguments.has_key('----'):
266n/a return _arguments['----']
267n/a
268n/a _argmap_register_window_close = {
269n/a 'for_window' : 'WIND',
270n/a }
271n/a
272n/a def register_window_close(self, _object=None, _attributes={}, **_arguments):
273n/a """register window close: Netscape will notify registered application when this window closes
274n/a Required argument: Application signature
275n/a Keyword argument for_window: window ID
276n/a Keyword argument _attributes: AppleEvent attribute dictionary
277n/a Returns: true if successful
278n/a """
279n/a _code = 'WWW!'
280n/a _subcode = 'RGWC'
281n/a
282n/a aetools.keysubst(_arguments, self._argmap_register_window_close)
283n/a _arguments['----'] = _object
284n/a
285n/a
286n/a _reply, _arguments, _attributes = self.send(_code, _subcode,
287n/a _arguments, _attributes)
288n/a if _arguments.get('errn', 0):
289n/a raise aetools.Error, aetools.decodeerror(_arguments)
290n/a # XXXX Optionally decode result
291n/a if _arguments.has_key('----'):
292n/a return _arguments['----']
293n/a
294n/a def unregister_URL_echo(self, _object, _attributes={}, **_arguments):
295n/a """unregister URL echo: cancels URL echo
296n/a Required argument: application signature
297n/a Keyword argument _attributes: AppleEvent attribute dictionary
298n/a """
299n/a _code = 'WWW!'
300n/a _subcode = 'UNRU'
301n/a
302n/a if _arguments: raise TypeError, 'No optional args expected'
303n/a _arguments['----'] = _object
304n/a
305n/a
306n/a _reply, _arguments, _attributes = self.send(_code, _subcode,
307n/a _arguments, _attributes)
308n/a if _arguments.get('errn', 0):
309n/a raise aetools.Error, aetools.decodeerror(_arguments)
310n/a # XXXX Optionally decode result
311n/a if _arguments.has_key('----'):
312n/a return _arguments['----']
313n/a
314n/a _argmap_unregister_protocol = {
315n/a 'for_protocol' : 'PROT',
316n/a }
317n/a
318n/a def unregister_protocol(self, _object=None, _attributes={}, **_arguments):
319n/a """unregister protocol: reverses the effects of \xd2register protocol\xd3
320n/a Required argument: Application sig.
321n/a Keyword argument for_protocol: protocol prefix. If none, unregister for all protocols
322n/a Keyword argument _attributes: AppleEvent attribute dictionary
323n/a Returns: TRUE if successful
324n/a """
325n/a _code = 'WWW!'
326n/a _subcode = 'UNRP'
327n/a
328n/a aetools.keysubst(_arguments, self._argmap_unregister_protocol)
329n/a _arguments['----'] = _object
330n/a
331n/a
332n/a _reply, _arguments, _attributes = self.send(_code, _subcode,
333n/a _arguments, _attributes)
334n/a if _arguments.get('errn', 0):
335n/a raise aetools.Error, aetools.decodeerror(_arguments)
336n/a # XXXX Optionally decode result
337n/a if _arguments.has_key('----'):
338n/a return _arguments['----']
339n/a
340n/a _argmap_unregister_viewer = {
341n/a 'MIME_type' : 'MIME',
342n/a }
343n/a
344n/a def unregister_viewer(self, _object, _attributes={}, **_arguments):
345n/a """unregister viewer: Revert to the old way of handling this MIME type
346n/a Required argument: Application sig
347n/a Keyword argument MIME_type: MIME type to be unregistered
348n/a Keyword argument _attributes: AppleEvent attribute dictionary
349n/a Returns: TRUE if the event was successful
350n/a """
351n/a _code = 'WWW!'
352n/a _subcode = 'UNRV'
353n/a
354n/a aetools.keysubst(_arguments, self._argmap_unregister_viewer)
355n/a _arguments['----'] = _object
356n/a
357n/a
358n/a _reply, _arguments, _attributes = self.send(_code, _subcode,
359n/a _arguments, _attributes)
360n/a if _arguments.get('errn', 0):
361n/a raise aetools.Error, aetools.decodeerror(_arguments)
362n/a # XXXX Optionally decode result
363n/a if _arguments.has_key('----'):
364n/a return _arguments['----']
365n/a
366n/a _argmap_unregister_window_close = {
367n/a 'for_window' : 'WIND',
368n/a }
369n/a
370n/a def unregister_window_close(self, _object=None, _attributes={}, **_arguments):
371n/a """unregister window close: Undo for register window close
372n/a Required argument: Application signature
373n/a Keyword argument for_window: window ID
374n/a Keyword argument _attributes: AppleEvent attribute dictionary
375n/a Returns: true if successful
376n/a """
377n/a _code = 'WWW!'
378n/a _subcode = 'UNRC'
379n/a
380n/a aetools.keysubst(_arguments, self._argmap_unregister_window_close)
381n/a _arguments['----'] = _object
382n/a
383n/a
384n/a _reply, _arguments, _attributes = self.send(_code, _subcode,
385n/a _arguments, _attributes)
386n/a if _arguments.get('errn', 0):
387n/a raise aetools.Error, aetools.decodeerror(_arguments)
388n/a # XXXX Optionally decode result
389n/a if _arguments.has_key('----'):
390n/a return _arguments['----']
391n/a
392n/a def webActivate(self, _object=None, _attributes={}, **_arguments):
393n/a """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.
394n/a Required argument: window to bring to front
395n/a Keyword argument _attributes: AppleEvent attribute dictionary
396n/a """
397n/a _code = 'WWW!'
398n/a _subcode = 'ACTV'
399n/a
400n/a if _arguments: raise TypeError, 'No optional args expected'
401n/a _arguments['----'] = _object
402n/a
403n/a
404n/a _reply, _arguments, _attributes = self.send(_code, _subcode,
405n/a _arguments, _attributes)
406n/a if _arguments.get('errn', 0):
407n/a raise aetools.Error, aetools.decodeerror(_arguments)
408n/a # XXXX Optionally decode result
409n/a if _arguments.has_key('----'):
410n/a return _arguments['----']
411n/a
412n/a
413n/a#
414n/a# Indices of types declared in this module
415n/a#
416n/a_classdeclarations = {
417n/a}
418n/a
419n/a_propdeclarations = {
420n/a}
421n/a
422n/a_compdeclarations = {
423n/a}
424n/a
425n/a_enumdeclarations = {
426n/a}