From 8bcd471606837a8731692e878bab2539048c802b Mon Sep 17 00:00:00 2001 From: Jack Jansen Date: Sun, 20 Aug 2000 19:56:13 +0000 Subject: Updated for the new applescript interface (which actually makes it so ridiculously simple that its main reason for existence is backward compatability). --- Mac/Lib/findertools.py | 29 ++++++----------------------- 1 file 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""" -- cgit v0.12