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