PageRenderTime 46ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/lib-python/2.7/plat-mac/lib-scriptpackages/Netscape/WorldWideWeb_suite.py

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