diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2000-08-20 19:56:13 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2000-08-20 19:56:13 (GMT) |
commit | 8bcd471606837a8731692e878bab2539048c802b (patch) | |
tree | 9178c16b6bacf22896b9d2a5475cf5a3cbc11660 /Mac | |
parent | 2eda24475c46448b8eab09509fc921b31f87cc13 (diff) | |
download | cpython-8bcd471606837a8731692e878bab2539048c802b.zip cpython-8bcd471606837a8731692e878bab2539048c802b.tar.gz cpython-8bcd471606837a8731692e878bab2539048c802b.tar.bz2 |
Updated for the new applescript interface (which actually makes it so ridiculously simple that its main reason for existence is backward compatability).
Diffstat (limited to 'Mac')
-rw-r--r-- | Mac/Lib/findertools.py | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/Mac/Lib/findertools.py b/Mac/Lib/findertools.py index 4de4f0c..8a1bf44 100644 --- a/Mac/Lib/findertools.py +++ b/Mac/Lib/findertools.py @@ -1,23 +1,18 @@ """Utility routines depending on the finder.""" -import Finder_7_0_Suite +import Finder import AppleEvents import aetools import MacOS import sys import macfs -SIGNATURE='MACS' - -class Finder(aetools.TalkTo, Finder_7_0_Suite.Finder_7_0_Suite): - pass - _finder_talker = None def _getfinder(): global _finder_talker if not _finder_talker: - _finder_talker = Finder(SIGNATURE) + _finder_talker = Finder.Finder() _finder_talker.send_flags = ( _finder_talker.send_flags | AppleEvents.kAECanInteract | AppleEvents.kAECanSwitchLayer) return _finder_talker @@ -26,39 +21,27 @@ def launch(file): """Open a file thru the finder. Specify file by name or fsspec""" finder = _getfinder() fss = macfs.FSSpec(file) - vRefNum, parID, name = fss.as_tuple() - dir_fss = macfs.FSSpec((vRefNum, parID, '')) - file_alias = fss.NewAlias() - dir_alias = dir_fss.NewAlias() - return finder.open(dir_alias, items=[file_alias]) + return finder.open(fss) def Print(file): """Print a file thru the finder. Specify file by name or fsspec""" finder = _getfinder() fss = macfs.FSSpec(file) - vRefNum, parID, name = fss.as_tuple() - dir_fss = macfs.FSSpec((vRefNum, parID, '')) - file_alias = fss.NewAlias() - dir_alias = dir_fss.NewAlias() - return finder._print(dir_alias, items=[file_alias]) + return finder._print(fss) def copy(src, dstdir): """Copy a file to a folder""" finder = _getfinder() src_fss = macfs.FSSpec(src) dst_fss = macfs.FSSpec(dstdir) - src_alias = src_fss.NewAlias() - dst_alias = dst_fss.NewAlias() - return finder.copy_to(dst_alias, _from=[src_alias]) + return finder.duplicate(src_fss, to=dst_fss) def move(src, dstdir): """Move a file to a folder""" finder = _getfinder() src_fss = macfs.FSSpec(src) dst_fss = macfs.FSSpec(dstdir) - src_alias = src_fss.NewAlias() - dst_alias = dst_fss.NewAlias() - return finder.move_to(dst_alias, _from=[src_alias]) + return finder.move(src_fss, to=dst_fss) def sleep(): """Put the mac to sleep""" |