/Mac/Demo/applescript/Disk_Copy/Standard_Suite.py

http://unladen-swallow.googlecode.com/ · Python · 477 lines · 448 code · 12 blank · 17 comment · 0 complexity · dd51eec4481350b850b45c39766f394b MD5 · raw file

  1. """Suite Standard Suite: Common terms for most applications
  2. Level 1, version 1
  3. Generated from Macintosh HD:Hulpprogramma's:Disk Copy
  4. AETE/AEUT resource version 1/0, language 0, script 0
  5. """
  6. import aetools
  7. import MacOS
  8. _code = 'Core'
  9. class Standard_Suite_Events:
  10. _argmap_save = {
  11. '_in' : 'kfil',
  12. 'using_format' : 'SvAs',
  13. 'checksum_verification' : 'VChk',
  14. 'signature_verification' : 'VSig',
  15. 'image_signing' : 'SImg',
  16. 'leave_image_mounted' : 'Moun',
  17. 'percent_free_space' : 'Slop',
  18. 'logical_blocks' : 'Blks',
  19. 'zeroing' : 'Zero',
  20. }
  21. def save(self, _object, _attributes={}, **_arguments):
  22. """save: Save an object
  23. Required argument: the source object
  24. Keyword argument _in: the target object
  25. Keyword argument using_format: the format for the target
  26. Keyword argument checksum_verification: Should the checksum be verified before saving?
  27. Keyword argument signature_verification: Should the DigiSignŽ signature be verified before saving?
  28. Keyword argument image_signing: Should the image be signed?
  29. Keyword argument leave_image_mounted: Should the image be mounted after saving?
  30. Keyword argument percent_free_space: percent free space to reserve (for image folder operation, 0-255%)
  31. Keyword argument logical_blocks: number of logical blocks in the image (for image folder operation)
  32. Keyword argument zeroing: Should all the blocks in the image be set to zeros? (for image folder operation)
  33. Keyword argument _attributes: AppleEvent attribute dictionary
  34. Returns: the result of the save operation
  35. """
  36. _code = 'core'
  37. _subcode = 'save'
  38. aetools.keysubst(_arguments, self._argmap_save)
  39. _arguments['----'] = _object
  40. aetools.enumsubst(_arguments, 'kfil', _Enum_obj_)
  41. aetools.enumsubst(_arguments, 'SvAs', _Enum_SvAs)
  42. aetools.enumsubst(_arguments, 'VChk', _Enum_bool)
  43. aetools.enumsubst(_arguments, 'VSig', _Enum_bool)
  44. aetools.enumsubst(_arguments, 'SImg', _Enum_bool)
  45. aetools.enumsubst(_arguments, 'Moun', _Enum_bool)
  46. aetools.enumsubst(_arguments, 'Slop', _Enum_long)
  47. aetools.enumsubst(_arguments, 'Blks', _Enum_long)
  48. aetools.enumsubst(_arguments, 'Zero', _Enum_bool)
  49. _reply, _arguments, _attributes = self.send(_code, _subcode,
  50. _arguments, _attributes)
  51. if _arguments.has_key('errn'):
  52. raise aetools.Error, aetools.decodeerror(_arguments)
  53. # XXXX Optionally decode result
  54. if _arguments.has_key('----'):
  55. return _arguments['----']
  56. def do_script(self, _object, _attributes={}, **_arguments):
  57. """do script: Execute an attached script located in the folder "Scripts"
  58. Required argument: the script to be executed
  59. Keyword argument _attributes: AppleEvent attribute dictionary
  60. """
  61. _code = 'core'
  62. _subcode = 'dosc'
  63. if _arguments: raise TypeError, 'No optional args expected'
  64. _arguments['----'] = _object
  65. _reply, _arguments, _attributes = self.send(_code, _subcode,
  66. _arguments, _attributes)
  67. if _arguments.has_key('errn'):
  68. raise aetools.Error, aetools.decodeerror(_arguments)
  69. # XXXX Optionally decode result
  70. if _arguments.has_key('----'):
  71. return _arguments['----']
  72. class application(aetools.ComponentItem):
  73. """application - The Disk Copy application """
  74. want = 'capp'
  75. class version(aetools.NProperty):
  76. """version - the version of this application """
  77. which = 'vers'
  78. want = 'vers'
  79. class name(aetools.NProperty):
  80. """name - the name of this application """
  81. which = 'pnam'
  82. want = 'TEXT'
  83. class comment(aetools.NProperty):
  84. """comment - the comment associated with the application """
  85. which = 'comt'
  86. want = 'TEXT'
  87. class driver_version(aetools.NProperty):
  88. """driver version - the version of the disk image driver """
  89. which = 'dVer'
  90. want = 'vers'
  91. class nonejectable_mode(aetools.NProperty):
  92. """nonejectable mode - Should mounted images be non-ejectable? """
  93. which = 'otto'
  94. want = 'bool'
  95. class save_log_file(aetools.NProperty):
  96. """save log file - Should the log file be saved on disk? """
  97. which = 'PSaL'
  98. want = 'bool'
  99. class use_speech(aetools.NProperty):
  100. """use speech - Should Disk Copy use spoken feedback? """
  101. which = 'PTlk'
  102. want = 'bool'
  103. class smart_Save_As(aetools.NProperty):
  104. """smart Save As - Should the Save As... dialog box automatically go to the right folder? """
  105. which = 'PSSP'
  106. want = 'bool'
  107. class checksum_verification(aetools.NProperty):
  108. """checksum verification - Should image checksums be verified? """
  109. which = 'PVeC'
  110. want = 'bool'
  111. class signature_verification(aetools.NProperty):
  112. """signature verification - Should digital signatures be verified? """
  113. which = 'PVeS'
  114. want = 'bool'
  115. class exclude_DiskScripts(aetools.NProperty):
  116. """exclude DiskScripts - Should images referenced in DiskScripts/DiskSets be excluded from verification? """
  117. which = 'PExD'
  118. want = 'bool'
  119. class exclude_remote_images(aetools.NProperty):
  120. """exclude remote images - Should images that are located on network volumes be excluded from verification? """
  121. which = 'PExR'
  122. want = 'bool'
  123. class image_signing(aetools.NProperty):
  124. """image signing - Should images be signed with a digital signature? """
  125. which = 'PSiI'
  126. want = 'bool'
  127. class leave_image_mounted(aetools.NProperty):
  128. """leave image mounted - Should images be mounted after they are created? """
  129. which = 'PMoA'
  130. want = 'bool'
  131. class erase_confirmation(aetools.NProperty):
  132. """erase confirmation - Should the user be required to confirm commands that erase disks? """
  133. which = 'PCoE'
  134. want = 'bool'
  135. class zeroing(aetools.NProperty):
  136. """zeroing - Should all blocks of a new image be set to zero? """
  137. which = 'PZeB'
  138. want = 'bool'
  139. class default_create_size(aetools.NProperty):
  140. """default create size - the default size for a new image, in blocks (512 bytes per block) """
  141. which = 'PDeS'
  142. want = 'long'
  143. class default_create_name(aetools.NProperty):
  144. """default create name - the default volume name for a new image """
  145. which = 'PDeN'
  146. want = 'TEXT'
  147. class make_multiple_floppies(aetools.NProperty):
  148. """make multiple floppies - Should the user be prompted to make multiple floppy disk images at a time? """
  149. which = 'PBuM'
  150. want = 'bool'
  151. class auto_image_upon_insert(aetools.NProperty):
  152. """auto image upon insert - Should a newly-inserted disk automatically be processed into an image? """
  153. which = 'Paim'
  154. want = 'bool'
  155. class eject_after_auto_image(aetools.NProperty):
  156. """eject after auto image - Should auto-imaged disks be ejected afterwards? """
  157. which = 'Pejc'
  158. want = 'bool'
  159. class auto_copy_upon_floppy_insert(aetools.NProperty):
  160. """auto copy upon floppy insert - Instead of auto-imaging, should newly-inserted floppy disks be copied? """
  161. which = 'Pcpf'
  162. want = 'bool'
  163. class volume_suffix(aetools.NProperty):
  164. """volume suffix - the default volume name suffix """
  165. which = 'PDiE'
  166. want = 'TEXT'
  167. class image_suffix(aetools.NProperty):
  168. """image suffix - the default image name suffix """
  169. which = 'PImE'
  170. want = 'TEXT'
  171. class default_file_system(aetools.NProperty):
  172. """default file system - the default file system type for new blank images """
  173. which = 'Pfsy'
  174. want = 'Fsys'
  175. class default_image_format(aetools.NProperty):
  176. """default image format - the default image file format """
  177. which = 'Pdfm'
  178. want = 'SvAs'
  179. class disk(aetools.ComponentItem):
  180. """disk - A mounted volume """
  181. want = 'Disk'
  182. name = name
  183. comment = comment
  184. class locked(aetools.NProperty):
  185. """locked - Is the disk locked? """
  186. which = 'islk'
  187. want = 'bool'
  188. class creation_date(aetools.NProperty):
  189. """creation date - the creation date of disk """
  190. which = 'ascd'
  191. want = 'ldt '
  192. class modification_date(aetools.NProperty):
  193. """modification date - the modification date of disk """
  194. which = 'asmo'
  195. want = 'ldt '
  196. class crc32_checksum(aetools.NProperty):
  197. """crc32 checksum - the crc-32 checksum of the disk """
  198. which = 'Xcrc'
  199. want = 'TEXT'
  200. class disk_copy_4_2e_2_checksum(aetools.NProperty):
  201. """disk copy 4.2 checksum - the Disk Copy 4.2 checksum of the disk """
  202. which = 'Xc42'
  203. want = 'TEXT'
  204. class block_count(aetools.NProperty):
  205. """block count - the number of blocks on disk """
  206. which = 'Xblk'
  207. want = 'long'
  208. class file_system(aetools.NProperty):
  209. """file system - the file system used on disk """
  210. which = 'Xfsi'
  211. want = 'TEXT'
  212. class folder(aetools.ComponentItem):
  213. """folder - A folder or directory on a disk """
  214. want = 'Fold'
  215. name = name
  216. comment = comment
  217. creation_date = creation_date
  218. modification_date = modification_date
  219. class disk_image(aetools.ComponentItem):
  220. """disk image - A disk image file """
  221. want = 'DImg'
  222. name = name
  223. comment = comment
  224. locked = locked
  225. creation_date = creation_date
  226. modification_date = modification_date
  227. class file_format(aetools.NProperty):
  228. """file format - the format of the disk image file """
  229. which = 'Ifmt'
  230. want = 'TEXT'
  231. class signed(aetools.NProperty):
  232. """signed - Does the disk image have a DigiSignŽ signature? """
  233. which = 'Isin'
  234. want = 'bool'
  235. class compressed(aetools.NProperty):
  236. """compressed - Is the disk image compressed? """
  237. which = 'Icom'
  238. want = 'bool'
  239. class segmented(aetools.NProperty):
  240. """segmented - Is the disk image segmented? """
  241. which = 'Iseg'
  242. want = 'bool'
  243. class segments(aetools.NProperty):
  244. """segments - a list of references to other segments that make up a complete image """
  245. which = 'Isg#'
  246. want = 'fss '
  247. class disk_name(aetools.NProperty):
  248. """disk name - the name of the disk this image represents """
  249. which = 'Idnm'
  250. want = 'TEXT'
  251. crc32_checksum = crc32_checksum
  252. disk_copy_4_2e_2_checksum = disk_copy_4_2e_2_checksum
  253. block_count = block_count
  254. file_system = file_system
  255. class data_fork_size(aetools.NProperty):
  256. """data fork size - the size (in bytes) of the data fork of the disk image """
  257. which = 'Idfk'
  258. want = 'long'
  259. class resource_fork_size(aetools.NProperty):
  260. """resource fork size - the size (in bytes) of the resource fork of the disk image """
  261. which = 'Irfk'
  262. want = 'long'
  263. class Save_reply_record(aetools.ComponentItem):
  264. """Save reply record - Result from the save operation """
  265. want = 'cpyR'
  266. class resulting_target_object(aetools.NProperty):
  267. """resulting target object - a reference to the target object after it has been saved """
  268. which = 'rcpO'
  269. want = 'obj '
  270. class copy_type(aetools.NProperty):
  271. """copy type - the way in which the target object was saved """
  272. which = 'rcpT'
  273. want = 'rcpT'
  274. application._propdict = {
  275. 'version' : version,
  276. 'name' : name,
  277. 'comment' : comment,
  278. 'driver_version' : driver_version,
  279. 'nonejectable_mode' : nonejectable_mode,
  280. 'save_log_file' : save_log_file,
  281. 'use_speech' : use_speech,
  282. 'smart_Save_As' : smart_Save_As,
  283. 'checksum_verification' : checksum_verification,
  284. 'signature_verification' : signature_verification,
  285. 'exclude_DiskScripts' : exclude_DiskScripts,
  286. 'exclude_remote_images' : exclude_remote_images,
  287. 'image_signing' : image_signing,
  288. 'leave_image_mounted' : leave_image_mounted,
  289. 'erase_confirmation' : erase_confirmation,
  290. 'zeroing' : zeroing,
  291. 'default_create_size' : default_create_size,
  292. 'default_create_name' : default_create_name,
  293. 'make_multiple_floppies' : make_multiple_floppies,
  294. 'auto_image_upon_insert' : auto_image_upon_insert,
  295. 'eject_after_auto_image' : eject_after_auto_image,
  296. 'auto_copy_upon_floppy_insert' : auto_copy_upon_floppy_insert,
  297. 'volume_suffix' : volume_suffix,
  298. 'image_suffix' : image_suffix,
  299. 'default_file_system' : default_file_system,
  300. 'default_image_format' : default_image_format,
  301. }
  302. application._elemdict = {
  303. }
  304. disk._propdict = {
  305. 'name' : name,
  306. 'comment' : comment,
  307. 'locked' : locked,
  308. 'creation_date' : creation_date,
  309. 'modification_date' : modification_date,
  310. 'crc32_checksum' : crc32_checksum,
  311. 'disk_copy_4_2e_2_checksum' : disk_copy_4_2e_2_checksum,
  312. 'block_count' : block_count,
  313. 'file_system' : file_system,
  314. }
  315. disk._elemdict = {
  316. }
  317. folder._propdict = {
  318. 'name' : name,
  319. 'comment' : comment,
  320. 'creation_date' : creation_date,
  321. 'modification_date' : modification_date,
  322. }
  323. folder._elemdict = {
  324. }
  325. disk_image._propdict = {
  326. 'name' : name,
  327. 'comment' : comment,
  328. 'locked' : locked,
  329. 'creation_date' : creation_date,
  330. 'modification_date' : modification_date,
  331. 'file_format' : file_format,
  332. 'signed' : signed,
  333. 'compressed' : compressed,
  334. 'segmented' : segmented,
  335. 'segments' : segments,
  336. 'disk_name' : disk_name,
  337. 'crc32_checksum' : crc32_checksum,
  338. 'disk_copy_4_2e_2_checksum' : disk_copy_4_2e_2_checksum,
  339. 'block_count' : block_count,
  340. 'file_system' : file_system,
  341. 'data_fork_size' : data_fork_size,
  342. 'resource_fork_size' : resource_fork_size,
  343. }
  344. disk_image._elemdict = {
  345. }
  346. Save_reply_record._propdict = {
  347. 'resulting_target_object' : resulting_target_object,
  348. 'copy_type' : copy_type,
  349. }
  350. Save_reply_record._elemdict = {
  351. }
  352. _Enum_UIAc = {
  353. 'never_interact' : 'eNvr', # DonŐt allow any interaction at all
  354. 'interact_with_self' : 'eInS', # Only allow interaction from internal events
  355. 'interact_with_local' : 'eInL', # Allow interaction from any event originating on this machine
  356. 'interact_with_all' : 'eInA', # Allow interaction from network events
  357. }
  358. _Enum_SvAs = {
  359. 'NDIF_RW' : 'RdWr', # read/write NDIF disk image
  360. 'NDIF_RO' : 'Rdxx', # read-only NDIF disk image
  361. 'NDIF_Compressed' : 'ROCo', # compressed NDIF disk image
  362. 'Disk_Copy_4_2e_2' : 'DC42', # Disk Copy 4.2 disk image
  363. }
  364. _Enum_rcpT = {
  365. 'block_disk_copy' : 'cpBl', # block-by-block disk-level copy
  366. 'files_and_file_ID_copy' : 'cpID', # all files including desktop databases and file IDŐs
  367. 'files_and_desktop_info' : 'cpDT', # all files and most desktop information
  368. 'files_only' : 'cpFI', # all files but no desktop information
  369. 'disk_image_conversion' : 'cpCV', # disk image format conversion
  370. 'disk_image_creation' : 'cpCR', # disk image creation
  371. }
  372. _Enum_long = None # XXXX enum long not found!!
  373. _Enum_bool = None # XXXX enum bool not found!!
  374. _Enum_obj_ = None # XXXX enum obj not found!!
  375. #
  376. # Indices of types declared in this module
  377. #
  378. _classdeclarations = {
  379. 'DImg' : disk_image,
  380. 'capp' : application,
  381. 'Disk' : disk,
  382. 'Fold' : folder,
  383. 'cpyR' : Save_reply_record,
  384. }
  385. _propdeclarations = {
  386. 'Xcrc' : crc32_checksum,
  387. 'PDeS' : default_create_size,
  388. 'Idnm' : disk_name,
  389. 'PSSP' : smart_Save_As,
  390. 'Pcpf' : auto_copy_upon_floppy_insert,
  391. 'pnam' : name,
  392. 'Isin' : signed,
  393. 'otto' : nonejectable_mode,
  394. 'PExD' : exclude_DiskScripts,
  395. 'Iseg' : segmented,
  396. 'islk' : locked,
  397. 'asmo' : modification_date,
  398. 'PTlk' : use_speech,
  399. 'Pfsy' : default_file_system,
  400. 'PVeC' : checksum_verification,
  401. 'Xc42' : disk_copy_4_2e_2_checksum,
  402. 'rcpO' : resulting_target_object,
  403. 'Paim' : auto_image_upon_insert,
  404. 'comt' : comment,
  405. 'PCoE' : erase_confirmation,
  406. 'dVer' : driver_version,
  407. 'PDeN' : default_create_name,
  408. 'PBuM' : make_multiple_floppies,
  409. 'rcpT' : copy_type,
  410. 'PDiE' : volume_suffix,
  411. 'Ifmt' : file_format,
  412. 'Pdfm' : default_image_format,
  413. 'ascd' : creation_date,
  414. 'Pejc' : eject_after_auto_image,
  415. 'PZeB' : zeroing,
  416. 'PExR' : exclude_remote_images,
  417. 'PImE' : image_suffix,
  418. 'PVeS' : signature_verification,
  419. 'PSaL' : save_log_file,
  420. 'Xblk' : block_count,
  421. 'PMoA' : leave_image_mounted,
  422. 'Isg#' : segments,
  423. 'Irfk' : resource_fork_size,
  424. 'Icom' : compressed,
  425. 'Xfsi' : file_system,
  426. 'Idfk' : data_fork_size,
  427. 'vers' : version,
  428. 'PSiI' : image_signing,
  429. }
  430. _compdeclarations = {
  431. }
  432. _enumdeclarations = {
  433. 'SvAs' : _Enum_SvAs,
  434. 'UIAc' : _Enum_UIAc,
  435. 'rcpT' : _Enum_rcpT,
  436. }