summaryrefslogtreecommitdiffstats
path: root/Mac/Lib/macfsn.py
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2000-01-13 16:26:35 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2000-01-13 16:26:35 (GMT)
commit5c6634c807c193e06a0bf78171032a35cfa57cbd (patch)
tree87d32470f4d7610a374487723d9879112c9ba7f2 /Mac/Lib/macfsn.py
parent2c6cf972554817772952c29b762df827200fdd78 (diff)
downloadcpython-5c6634c807c193e06a0bf78171032a35cfa57cbd.zip
cpython-5c6634c807c193e06a0bf78171032a35cfa57cbd.tar.gz
cpython-5c6634c807c193e06a0bf78171032a35cfa57cbd.tar.bz2
- Actually _implemented_ SetFolder()
- Fixed StandardPutFile: prompt, default - Check explicitly for userCanceledErr, pass other Nav.error exceptions through.
Diffstat (limited to 'Mac/Lib/macfsn.py')
-rw-r--r--Mac/Lib/macfsn.py30
1 files changed, 27 insertions, 3 deletions
diff --git a/Mac/Lib/macfsn.py b/Mac/Lib/macfsn.py
index dcff677..c78459d 100644
--- a/Mac/Lib/macfsn.py
+++ b/Mac/Lib/macfsn.py
@@ -35,10 +35,14 @@ def _PromptGetFile(prompt, *typelist):
args['preferenceKey'] = 'PyMC'
if _movablemodal:
args['eventProc'] = None
+ args['dialogOptionFlags'] = flags
+ _handleSetFolder(args)
try:
rr = Nav.NavChooseFile(args)
good = 1
except Nav.error, arg:
+ if arg[0] != -128: # userCancelledErr
+ raise Nav.error, arg
good = 0
fss = macfs.FSSpec(':cancelled')
else:
@@ -49,16 +53,22 @@ def _PromptGetFile(prompt, *typelist):
def _StandardPutFile(prompt, default=None):
args = {}
- flags = 0x57
+ flags = 0x07
if prompt:
args['message'] = prompt
args['preferenceKey'] = 'PyMC'
if _movablemodal:
args['eventProc'] = None
+ if default:
+ args['savedFileName'] = default
+ args['dialogOptionFlags'] = flags
+ _handleSetFolder(args)
try:
rr = Nav.NavPutFile(args)
good = 1
except Nav.error, arg:
+ if arg[0] != -128: # userCancelledErr
+ raise Nav.error, arg
good = 0
fss = macfs.FSSpec(':cancelled')
else:
@@ -70,22 +80,36 @@ def _SetFolder(folder):
if _curfolder:
rv = _curfolder
else:
- _curfolder = macfs.FSSpec(":")
+ rv = None
_curfolder = macfs.FSSpec(folder)
return rv
+def _handleSetFolder(args):
+ global _curfolder
+ if not _curfolder:
+ return
+ import aepack
+ fss = macfs.FSSpec(_curfolder)
+ aedesc = aepack.pack(fss)
+ args['defaultLocation'] = aedesc
+ _curfolder = None
+
def _GetDirectory(prompt=None):
args = {}
- flags = 0x57
+ flags = 0x17
if prompt:
args['message'] = prompt
args['preferenceKey'] = 'PyMC'
if _movablemodal:
args['eventProc'] = None
+ args['dialogOptionFlags'] = flags
+ _handleSetFolder(args)
try:
rr = Nav.NavChooseFolder(args)
good = 1
except Nav.error, arg:
+ if arg[0] != -128: # userCancelledErr
+ raise Nav.error, arg
good = 0
fss = macfs.FSSpec(':cancelled')
else: