PageRenderTime 65ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/lib-python/2.7/plat-mac/lib-scriptpackages/SystemEvents/Standard_Suite.py

https://bitbucket.org/dac_io/pypy
Python | 582 lines | 439 code | 60 blank | 83 comment | 31 complexity | 3c09c44ef3e90a0dfc0685f14b10bf2b MD5 | raw file
  1. """Suite Standard Suite: Common classes and commands for most applications.
  2. Level 1, version 1
  3. Generated from /System/Library/CoreServices/System Events.app
  4. AETE/AEUT resource version 1/0, language 0, script 0
  5. """
  6. import aetools
  7. import MacOS
  8. _code = '????'
  9. class Standard_Suite_Events:
  10. _argmap_close = {
  11. 'saving_in' : 'kfil',
  12. 'saving' : 'savo',
  13. }
  14. def close(self, _object, _attributes={}, **_arguments):
  15. """close: Close an object.
  16. Required argument: the object for the command
  17. Keyword argument saving_in: The file in which to save the object.
  18. Keyword argument saving: Specifies whether changes should be saved before closing.
  19. Keyword argument _attributes: AppleEvent attribute dictionary
  20. """
  21. _code = 'core'
  22. _subcode = 'clos'
  23. aetools.keysubst(_arguments, self._argmap_close)
  24. _arguments['----'] = _object
  25. aetools.enumsubst(_arguments, 'savo', _Enum_savo)
  26. _reply, _arguments, _attributes = self.send(_code, _subcode,
  27. _arguments, _attributes)
  28. if _arguments.get('errn', 0):
  29. raise aetools.Error, aetools.decodeerror(_arguments)
  30. # XXXX Optionally decode result
  31. if _arguments.has_key('----'):
  32. return _arguments['----']
  33. _argmap_count = {
  34. 'each' : 'kocl',
  35. }
  36. def count(self, _object, _attributes={}, **_arguments):
  37. """count: Return the number of elements of a particular class within an object.
  38. Required argument: the object for the command
  39. Keyword argument each: The class of objects to be counted.
  40. Keyword argument _attributes: AppleEvent attribute dictionary
  41. Returns: the reply for the command
  42. """
  43. _code = 'core'
  44. _subcode = 'cnte'
  45. aetools.keysubst(_arguments, self._argmap_count)
  46. _arguments['----'] = _object
  47. _reply, _arguments, _attributes = self.send(_code, _subcode,
  48. _arguments, _attributes)
  49. if _arguments.get('errn', 0):
  50. raise aetools.Error, aetools.decodeerror(_arguments)
  51. # XXXX Optionally decode result
  52. if _arguments.has_key('----'):
  53. return _arguments['----']
  54. def delete(self, _object, _attributes={}, **_arguments):
  55. """delete: Delete an object.
  56. Required argument: the object for the command
  57. Keyword argument _attributes: AppleEvent attribute dictionary
  58. """
  59. _code = 'core'
  60. _subcode = 'delo'
  61. if _arguments: raise TypeError, 'No optional args expected'
  62. _arguments['----'] = _object
  63. _reply, _arguments, _attributes = self.send(_code, _subcode,
  64. _arguments, _attributes)
  65. if _arguments.get('errn', 0):
  66. raise aetools.Error, aetools.decodeerror(_arguments)
  67. # XXXX Optionally decode result
  68. if _arguments.has_key('----'):
  69. return _arguments['----']
  70. _argmap_duplicate = {
  71. 'to' : 'insh',
  72. 'with_properties' : 'prdt',
  73. }
  74. def duplicate(self, _object, _attributes={}, **_arguments):
  75. """duplicate: Copy object(s) and put the copies at a new location.
  76. Required argument: the object for the command
  77. Keyword argument to: The location for the new object(s).
  78. Keyword argument with_properties: Properties to be set in the new duplicated object(s).
  79. Keyword argument _attributes: AppleEvent attribute dictionary
  80. """
  81. _code = 'core'
  82. _subcode = 'clon'
  83. aetools.keysubst(_arguments, self._argmap_duplicate)
  84. _arguments['----'] = _object
  85. _reply, _arguments, _attributes = self.send(_code, _subcode,
  86. _arguments, _attributes)
  87. if _arguments.get('errn', 0):
  88. raise aetools.Error, aetools.decodeerror(_arguments)
  89. # XXXX Optionally decode result
  90. if _arguments.has_key('----'):
  91. return _arguments['----']
  92. def exists(self, _object, _attributes={}, **_arguments):
  93. """exists: Verify if an object exists.
  94. Required argument: the object for the command
  95. Keyword argument _attributes: AppleEvent attribute dictionary
  96. Returns: the reply for the command
  97. """
  98. _code = 'core'
  99. _subcode = 'doex'
  100. if _arguments: raise TypeError, 'No optional args expected'
  101. _arguments['----'] = _object
  102. _reply, _arguments, _attributes = self.send(_code, _subcode,
  103. _arguments, _attributes)
  104. if _arguments.get('errn', 0):
  105. raise aetools.Error, aetools.decodeerror(_arguments)
  106. # XXXX Optionally decode result
  107. if _arguments.has_key('----'):
  108. return _arguments['----']
  109. def get(self, _object, _attributes={}, **_arguments):
  110. """get: Get the data for an object.
  111. Required argument: the object for the command
  112. Keyword argument _attributes: AppleEvent attribute dictionary
  113. Returns: the reply for the command
  114. """
  115. _code = 'core'
  116. _subcode = 'getd'
  117. if _arguments: raise TypeError, 'No optional args expected'
  118. _arguments['----'] = _object
  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. _argmap_make = {
  127. 'at' : 'insh',
  128. 'new' : 'kocl',
  129. 'with_data' : 'data',
  130. 'with_properties' : 'prdt',
  131. }
  132. def make(self, _no_object=None, _attributes={}, **_arguments):
  133. """make: Make a new object.
  134. Keyword argument at: The location at which to insert the object.
  135. Keyword argument new: The class of the new object.
  136. Keyword argument with_data: The initial data for the object.
  137. Keyword argument with_properties: The initial values for properties of the object.
  138. Keyword argument _attributes: AppleEvent attribute dictionary
  139. Returns: the reply for the command
  140. """
  141. _code = 'core'
  142. _subcode = 'crel'
  143. aetools.keysubst(_arguments, self._argmap_make)
  144. if _no_object is not None: raise TypeError, 'No direct arg expected'
  145. _reply, _arguments, _attributes = self.send(_code, _subcode,
  146. _arguments, _attributes)
  147. if _arguments.get('errn', 0):
  148. raise aetools.Error, aetools.decodeerror(_arguments)
  149. # XXXX Optionally decode result
  150. if _arguments.has_key('----'):
  151. return _arguments['----']
  152. _argmap_move = {
  153. 'to' : 'insh',
  154. }
  155. def move(self, _object, _attributes={}, **_arguments):
  156. """move: Move object(s) to a new location.
  157. Required argument: the object for the command
  158. Keyword argument to: The new location for the object(s).
  159. Keyword argument _attributes: AppleEvent attribute dictionary
  160. """
  161. _code = 'core'
  162. _subcode = 'move'
  163. aetools.keysubst(_arguments, self._argmap_move)
  164. _arguments['----'] = _object
  165. _reply, _arguments, _attributes = self.send(_code, _subcode,
  166. _arguments, _attributes)
  167. if _arguments.get('errn', 0):
  168. raise aetools.Error, aetools.decodeerror(_arguments)
  169. # XXXX Optionally decode result
  170. if _arguments.has_key('----'):
  171. return _arguments['----']
  172. def open(self, _object=None, _attributes={}, **_arguments):
  173. """open: Open an object.
  174. Required argument: list of objects
  175. Keyword argument _attributes: AppleEvent attribute dictionary
  176. """
  177. _code = 'aevt'
  178. _subcode = 'odoc'
  179. if _arguments: raise TypeError, 'No optional args expected'
  180. _arguments['----'] = _object
  181. _reply, _arguments, _attributes = self.send(_code, _subcode,
  182. _arguments, _attributes)
  183. if _arguments.get('errn', 0):
  184. raise aetools.Error, aetools.decodeerror(_arguments)
  185. # XXXX Optionally decode result
  186. if _arguments.has_key('----'):
  187. return _arguments['----']
  188. def print_(self, _object=None, _attributes={}, **_arguments):
  189. """print: Print an object.
  190. Required argument: list of objects
  191. Keyword argument _attributes: AppleEvent attribute dictionary
  192. """
  193. _code = 'aevt'
  194. _subcode = 'pdoc'
  195. if _arguments: raise TypeError, 'No optional args expected'
  196. _arguments['----'] = _object
  197. _reply, _arguments, _attributes = self.send(_code, _subcode,
  198. _arguments, _attributes)
  199. if _arguments.get('errn', 0):
  200. raise aetools.Error, aetools.decodeerror(_arguments)
  201. # XXXX Optionally decode result
  202. if _arguments.has_key('----'):
  203. return _arguments['----']
  204. _argmap_quit = {
  205. 'saving' : 'savo',
  206. }
  207. def quit(self, _object, _attributes={}, **_arguments):
  208. """quit: Quit an application.
  209. Required argument: the object for the command
  210. Keyword argument saving: Specifies whether changes should be saved before quitting.
  211. Keyword argument _attributes: AppleEvent attribute dictionary
  212. """
  213. _code = 'aevt'
  214. _subcode = 'quit'
  215. aetools.keysubst(_arguments, self._argmap_quit)
  216. _arguments['----'] = _object
  217. aetools.enumsubst(_arguments, 'savo', _Enum_savo)
  218. _reply, _arguments, _attributes = self.send(_code, _subcode,
  219. _arguments, _attributes)
  220. if _arguments.get('errn', 0):
  221. raise aetools.Error, aetools.decodeerror(_arguments)
  222. # XXXX Optionally decode result
  223. if _arguments.has_key('----'):
  224. return _arguments['----']
  225. _argmap_save = {
  226. 'in_' : 'kfil',
  227. 'as' : 'fltp',
  228. }
  229. def save(self, _object, _attributes={}, **_arguments):
  230. """save: Save an object.
  231. Required argument: the object for the command
  232. Keyword argument in_: The file in which to save the object.
  233. Keyword argument as: The file type in which to save the data.
  234. Keyword argument _attributes: AppleEvent attribute dictionary
  235. """
  236. _code = 'core'
  237. _subcode = 'save'
  238. aetools.keysubst(_arguments, self._argmap_save)
  239. _arguments['----'] = _object
  240. _reply, _arguments, _attributes = self.send(_code, _subcode,
  241. _arguments, _attributes)
  242. if _arguments.get('errn', 0):
  243. raise aetools.Error, aetools.decodeerror(_arguments)
  244. # XXXX Optionally decode result
  245. if _arguments.has_key('----'):
  246. return _arguments['----']
  247. _argmap_set = {
  248. 'to' : 'data',
  249. }
  250. def set(self, _object, _attributes={}, **_arguments):
  251. """set: Set an object's data.
  252. Required argument: the object for the command
  253. Keyword argument to: The new value.
  254. Keyword argument _attributes: AppleEvent attribute dictionary
  255. """
  256. _code = 'core'
  257. _subcode = 'setd'
  258. aetools.keysubst(_arguments, self._argmap_set)
  259. _arguments['----'] = _object
  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. class application(aetools.ComponentItem):
  268. """application - An application's top level scripting object. """
  269. want = 'capp'
  270. class _Prop__3c_Inheritance_3e_(aetools.NProperty):
  271. """<Inheritance> - All of the properties of the superclass. """
  272. which = 'c@#^'
  273. want = 'cobj'
  274. _3c_Inheritance_3e_ = _Prop__3c_Inheritance_3e_()
  275. class _Prop_frontmost(aetools.NProperty):
  276. """frontmost - Is this the frontmost (active) application? """
  277. which = 'pisf'
  278. want = 'bool'
  279. frontmost = _Prop_frontmost()
  280. class _Prop_name(aetools.NProperty):
  281. """name - The name of the application. """
  282. which = 'pnam'
  283. want = 'utxt'
  284. name = _Prop_name()
  285. class _Prop_version(aetools.NProperty):
  286. """version - The version of the application. """
  287. which = 'vers'
  288. want = 'utxt'
  289. version = _Prop_version()
  290. # element 'cwin' as ['name', 'indx', 'rele', 'rang', 'test', 'ID ']
  291. # element 'docu' as ['name', 'indx', 'rele', 'rang', 'test']
  292. applications = application
  293. class item(aetools.ComponentItem):
  294. """item - A scriptable object. """
  295. want = 'cobj'
  296. class _Prop_class_(aetools.NProperty):
  297. """class - The class of the object. """
  298. which = 'pcls'
  299. want = 'type'
  300. class _Prop_properties(aetools.NProperty):
  301. """properties - All of the object's properties. """
  302. which = 'pALL'
  303. want = 'reco'
  304. items = item
  305. class color(aetools.ComponentItem):
  306. """color - A color. """
  307. want = 'colr'
  308. colors = color
  309. class window(aetools.ComponentItem):
  310. """window - A window. """
  311. want = 'cwin'
  312. class _Prop_bounds(aetools.NProperty):
  313. """bounds - The bounding rectangle of the window. """
  314. which = 'pbnd'
  315. want = 'qdrt'
  316. class _Prop_closeable(aetools.NProperty):
  317. """closeable - Whether the window has a close box. """
  318. which = 'hclb'
  319. want = 'bool'
  320. class _Prop_document(aetools.NProperty):
  321. """document - The document whose contents are being displayed in the window. """
  322. which = 'docu'
  323. want = 'docu'
  324. class _Prop_floating(aetools.NProperty):
  325. """floating - Whether the window floats. """
  326. which = 'isfl'
  327. want = 'bool'
  328. class _Prop_id(aetools.NProperty):
  329. """id - The unique identifier of the window. """
  330. which = 'ID '
  331. want = 'long'
  332. class _Prop_index(aetools.NProperty):
  333. """index - The index of the window in the back-to-front window ordering. """
  334. which = 'pidx'
  335. want = 'long'
  336. class _Prop_miniaturizable(aetools.NProperty):
  337. """miniaturizable - Whether the window can be miniaturized. """
  338. which = 'ismn'
  339. want = 'bool'
  340. class _Prop_miniaturized(aetools.NProperty):
  341. """miniaturized - Whether the window is currently miniaturized. """
  342. which = 'pmnd'
  343. want = 'bool'
  344. class _Prop_modal(aetools.NProperty):
  345. """modal - Whether the window is the application's current modal window. """
  346. which = 'pmod'
  347. want = 'bool'
  348. class _Prop_resizable(aetools.NProperty):
  349. """resizable - Whether the window can be resized. """
  350. which = 'prsz'
  351. want = 'bool'
  352. class _Prop_titled(aetools.NProperty):
  353. """titled - Whether the window has a title bar. """
  354. which = 'ptit'
  355. want = 'bool'
  356. class _Prop_visible(aetools.NProperty):
  357. """visible - Whether the window is currently visible. """
  358. which = 'pvis'
  359. want = 'bool'
  360. class _Prop_zoomable(aetools.NProperty):
  361. """zoomable - Whether the window can be zoomed. """
  362. which = 'iszm'
  363. want = 'bool'
  364. class _Prop_zoomed(aetools.NProperty):
  365. """zoomed - Whether the window is currently zoomed. """
  366. which = 'pzum'
  367. want = 'bool'
  368. windows = window
  369. class document(aetools.ComponentItem):
  370. """document - A document. """
  371. want = 'docu'
  372. class _Prop_modified(aetools.NProperty):
  373. """modified - Has the document been modified since the last save? """
  374. which = 'imod'
  375. want = 'bool'
  376. class _Prop_path(aetools.NProperty):
  377. """path - The document's path. """
  378. which = 'ppth'
  379. want = 'utxt'
  380. documents = document
  381. application._superclassnames = ['item']
  382. application._privpropdict = {
  383. '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_,
  384. 'frontmost' : _Prop_frontmost,
  385. 'name' : _Prop_name,
  386. 'version' : _Prop_version,
  387. }
  388. application._privelemdict = {
  389. 'document' : document,
  390. 'window' : window,
  391. }
  392. item._superclassnames = []
  393. item._privpropdict = {
  394. 'class_' : _Prop_class_,
  395. 'properties' : _Prop_properties,
  396. }
  397. item._privelemdict = {
  398. }
  399. color._superclassnames = ['item']
  400. color._privpropdict = {
  401. '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_,
  402. }
  403. color._privelemdict = {
  404. }
  405. window._superclassnames = ['item']
  406. window._privpropdict = {
  407. '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_,
  408. 'bounds' : _Prop_bounds,
  409. 'closeable' : _Prop_closeable,
  410. 'document' : _Prop_document,
  411. 'floating' : _Prop_floating,
  412. 'id' : _Prop_id,
  413. 'index' : _Prop_index,
  414. 'miniaturizable' : _Prop_miniaturizable,
  415. 'miniaturized' : _Prop_miniaturized,
  416. 'modal' : _Prop_modal,
  417. 'name' : _Prop_name,
  418. 'resizable' : _Prop_resizable,
  419. 'titled' : _Prop_titled,
  420. 'visible' : _Prop_visible,
  421. 'zoomable' : _Prop_zoomable,
  422. 'zoomed' : _Prop_zoomed,
  423. }
  424. window._privelemdict = {
  425. }
  426. document._superclassnames = ['item']
  427. document._privpropdict = {
  428. '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_,
  429. 'modified' : _Prop_modified,
  430. 'name' : _Prop_name,
  431. 'path' : _Prop_path,
  432. }
  433. document._privelemdict = {
  434. }
  435. class _3c_(aetools.NComparison):
  436. """< - Less than """
  437. class _3d_(aetools.NComparison):
  438. """= - Equal """
  439. class _3e_(aetools.NComparison):
  440. """> - Greater than """
  441. class contains(aetools.NComparison):
  442. """contains - Contains """
  443. class ends_with(aetools.NComparison):
  444. """ends with - Ends with """
  445. class starts_with(aetools.NComparison):
  446. """starts with - Starts with """
  447. class _b2_(aetools.NComparison):
  448. """\xb2 - Less than or equal to """
  449. class _b3_(aetools.NComparison):
  450. """\xb3 - Greater than or equal to """
  451. _Enum_savo = {
  452. 'ask' : 'ask ', # Ask the user whether or not to save the file.
  453. 'yes' : 'yes ', # Save the file.
  454. 'no' : 'no ', # Do not save the file.
  455. }
  456. #
  457. # Indices of types declared in this module
  458. #
  459. _classdeclarations = {
  460. 'capp' : application,
  461. 'cobj' : item,
  462. 'colr' : color,
  463. 'cwin' : window,
  464. 'docu' : document,
  465. }
  466. _propdeclarations = {
  467. 'ID ' : _Prop_id,
  468. 'c@#^' : _Prop__3c_Inheritance_3e_,
  469. 'docu' : _Prop_document,
  470. 'hclb' : _Prop_closeable,
  471. 'imod' : _Prop_modified,
  472. 'isfl' : _Prop_floating,
  473. 'ismn' : _Prop_miniaturizable,
  474. 'iszm' : _Prop_zoomable,
  475. 'pALL' : _Prop_properties,
  476. 'pbnd' : _Prop_bounds,
  477. 'pcls' : _Prop_class_,
  478. 'pidx' : _Prop_index,
  479. 'pisf' : _Prop_frontmost,
  480. 'pmnd' : _Prop_miniaturized,
  481. 'pmod' : _Prop_modal,
  482. 'pnam' : _Prop_name,
  483. 'ppth' : _Prop_path,
  484. 'prsz' : _Prop_resizable,
  485. 'ptit' : _Prop_titled,
  486. 'pvis' : _Prop_visible,
  487. 'pzum' : _Prop_zoomed,
  488. 'vers' : _Prop_version,
  489. }
  490. _compdeclarations = {
  491. '< ' : _3c_,
  492. '<= ' : _b2_,
  493. '= ' : _3d_,
  494. '> ' : _3e_,
  495. '>= ' : _b3_,
  496. 'bgwt' : starts_with,
  497. 'cont' : contains,
  498. 'ends' : ends_with,
  499. }
  500. _enumdeclarations = {
  501. 'savo' : _Enum_savo,
  502. }