summaryrefslogtreecommitdiff
path: root/Lib/plat-mac/macfs.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/plat-mac/macfs.py')
-rw-r--r--Lib/plat-mac/macfs.py52
1 files changed, 26 insertions, 26 deletions
diff --git a/Lib/plat-mac/macfs.py b/Lib/plat-mac/macfs.py
index 11dbbeb3cd..73815aeb3f 100644
--- a/Lib/plat-mac/macfs.py
+++ b/Lib/plat-mac/macfs.py
@@ -9,7 +9,7 @@ import warnings
warnings.warn("macfs is deprecated, use Carbon.File, Carbon.Folder or EasyDialogs",
DeprecationWarning, stacklevel=2)
-
+
# First step: ensure we also emulate the MACFS module, which contained
# all the constants
@@ -38,7 +38,7 @@ if time.gmtime(0)[0] == 1970:
t = t + 0x10000000L
return (0, int(t), 0)
else:
- def _utc2time(utc):
+ def _utc2time(utc):
t = utc[1]
if t < 0:
t = t + 0x100000000L
@@ -58,26 +58,26 @@ error = Carbon.File.Error
class FSSpec(Carbon.File.FSSpec):
def as_fsref(self):
return FSRef(self)
-
+
def NewAlias(self, src=None):
return Alias(Carbon.File.NewAlias(src, self))
-
+
def GetCreatorType(self):
finfo = self.FSpGetFInfo()
return finfo.Creator, finfo.Type
-
+
def SetCreatorType(self, ctor, tp):
finfo = self.FSpGetFInfo()
finfo.Creator = ctor
finfo.Type = tp
self.FSpSetFInfo(finfo)
-
+
def GetFInfo(self):
return self.FSpGetFInfo()
-
+
def SetFInfo(self, info):
return self.FSpSetFInfo(info)
-
+
def GetDates(self):
catInfoFlags = kFSCatInfoCreateDate|kFSCatInfoContentMod|kFSCatInfoBackupDate
catinfo, d1, d2, d3 = FSRef(self).FSGetCatalogInfo(catInfoFlags)
@@ -85,7 +85,7 @@ class FSSpec(Carbon.File.FSSpec):
mdate = catinfo.contentModDate
bdate = catinfo.backupDate
return _utc2time(cdate), _utc2time(mdate), _utc2time(bdate)
-
+
def SetDates(self, cdate, mdate, bdate):
catInfoFlags = kFSCatInfoCreateDate|kFSCatInfoContentMod|kFSCatInfoBackupDate
catinfo = Carbon.File.FSCatalogInfo(
@@ -93,23 +93,23 @@ class FSSpec(Carbon.File.FSSpec):
contentModDate = _time2utc(mdate),
backupDate = _time2utc(bdate))
FSRef(self).FSSetCatalogInfo(catInfoFlags, catinfo)
-
+
class FSRef(Carbon.File.FSRef):
def as_fsspec(self):
return FSSpec(self)
-
+
class Alias(Carbon.File.Alias):
def GetInfo(self, index):
return self.GetAliasInfo(index)
-
+
def Update(self, *args):
pass # print "Alias.Update not yet implemented"
-
+
def Resolve(self, src=None):
fss, changed = self.ResolveAlias(src)
return FSSpec(fss), changed
-
+
from Carbon.File import FInfo
# Backward-compatible type names:
@@ -122,19 +122,19 @@ FInfoType = FInfo
def ResolveAliasFile(fss, chain=1):
fss, isdir, isalias = Carbon.File.ResolveAliasFile(fss, chain)
return FSSpec(fss), isdir, isalias
-
+
def RawFSSpec(data):
return FSSpec(rawdata=data)
-
+
def RawAlias(data):
return Alias(rawdata=data)
-
+
def FindApplication(*args):
raise NotImplementedError, "FindApplication no longer implemented"
-
+
def NewAliasMinimalFromFullPath(path):
return Alias(Carbon.File.NewAliasMinimalFromFullPath(path, '', ''))
-
+
# Another global function:
from Carbon.Folder import FindFolder
@@ -148,7 +148,7 @@ def StandardGetFile(*typelist):
"""Ask for an input file, optionally specifying 4-char file types that are
allowable"""
return PromptGetFile('', *typelist)
-
+
def PromptGetFile(prompt, *typelist):
"""Ask for an input file giving the user a prompt message. Optionally you can
specifying 4-char file types that are allowable"""
@@ -157,7 +157,7 @@ def PromptGetFile(prompt, *typelist):
DeprecationWarning, stacklevel=2)
if not typelist:
typelist = None
- fss = EasyDialogs.AskFileForOpen(message=prompt, wanted=FSSpec,
+ fss = EasyDialogs.AskFileForOpen(message=prompt, wanted=FSSpec,
typeList=typelist, defaultLocation=_handleSetFolder())
return fss, not fss is None
@@ -167,10 +167,10 @@ def StandardPutFile(prompt, default=None):
import EasyDialogs
warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen",
DeprecationWarning, stacklevel=2)
- fss = EasyDialogs.AskFileForSave(wanted=FSSpec, message=prompt,
+ fss = EasyDialogs.AskFileForSave(wanted=FSSpec, message=prompt,
savedFileName=default, defaultLocation=_handleSetFolder())
return fss, not fss is None
-
+
def SetFolder(folder):
global _curfolder
warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen",
@@ -181,18 +181,18 @@ def SetFolder(folder):
rv = None
_curfolder = folder
return rv
-
+
def _handleSetFolder():
global _curfolder
rv = _curfolder
_curfolder = None
return rv
-
+
def GetDirectory(prompt=None):
"""Ask the user to select a folder. Optionally you can give a prompt."""
import EasyDialogs
warnings.warn("macfs.StandardGetFile and friends are deprecated, use EasyDialogs.AskFileForOpen",
DeprecationWarning, stacklevel=2)
- fss = EasyDialogs.AskFolder(message=prompt, wanted=FSSpec,
+ fss = EasyDialogs.AskFolder(message=prompt, wanted=FSSpec,
defaultLocation=_handleSetFolder())
return fss, not fss is None