PageRenderTime 327ms CodeModel.GetById 161ms app.highlight 80ms RepoModel.GetById 81ms app.codeStats 0ms

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