Getting rid of StandardGetFile

This commit is contained in:
Jack Jansen 2003-01-22 14:03:12 +00:00
parent 96bf0d75e2
commit d44a3ec63c
3 changed files with 13 additions and 17 deletions

View file

@ -35,18 +35,18 @@ def buildapplet():
# Ask for source text if not specified in sys.argv[1:] # Ask for source text if not specified in sys.argv[1:]
if not sys.argv[1:]: if not sys.argv[1:]:
srcfss, ok = macfs.PromptGetFile('Select Python source or applet:', 'TEXT', 'APPL') filename = EasyDialogs.AskFileForOpen(message='Select Python source or applet:',
if not ok: fileTypes=('TEXT', 'APPL'))
if not filename:
return return
filename = srcfss.as_pathname()
tp, tf = os.path.split(filename) tp, tf = os.path.split(filename)
if tf[-3:] == '.py': if tf[-3:] == '.py':
tf = tf[:-3] tf = tf[:-3]
else: else:
tf = tf + '.applet' tf = tf + '.applet'
dstfss, ok = macfs.StandardPutFile('Save application as:', tf) dstfilename = EasyDialogs.AskFileForSave(message='Save application as:',
if not ok: return savedFileName=tf)
dstfilename = dstfss.as_pathname() if not dstfilename: return
cr, tp = MacOS.GetCreatorAndType(filename) cr, tp = MacOS.GetCreatorAndType(filename)
if tp == 'APPL': if tp == 'APPL':
buildtools.update(template, filename, dstfilename) buildtools.update(template, filename, dstfilename)

View file

@ -12,7 +12,6 @@ import sys
import string import string
import os import os
import macfs
import MacOS import MacOS
from Carbon import Res from Carbon import Res
from Carbon import Dlg from Carbon import Dlg
@ -54,10 +53,10 @@ def buildapplication(debug = 0):
# Ask for source text if not specified in sys.argv[1:] # Ask for source text if not specified in sys.argv[1:]
if not sys.argv[1:]: if not sys.argv[1:]:
srcfss, ok = macfs.PromptGetFile('Select Python source:', 'TEXT') filename = EasyDialogs.AskFileForOpen(message='Select Python source:',
if not ok: fileTypes=('TEXT',))
if not filename:
return return
filename = srcfss.as_pathname()
else: else:
if sys.argv[2:]: if sys.argv[2:]:
raise buildtools.BuildError, "please select one file at a time" raise buildtools.BuildError, "please select one file at a time"
@ -73,10 +72,10 @@ def buildapplication(debug = 0):
else: else:
tf = tf + '.app' tf = tf + '.app'
dstfss, ok = macfs.StandardPutFile('Save application as:', tf) dstfilename = EasyDialogs.AskFileForSate(message='Save application as:',
savedFileName=tf)
if not ok: if not ok:
return return
dstfilename = dstfss.as_pathname()
macgen_bin.generate(filename, dstfilename, None, architecture, 1) macgen_bin.generate(filename, dstfilename, None, architecture, 1)

View file

@ -20,7 +20,6 @@ from Carbon import Win
from Carbon import Qd from Carbon import Qd
from FrameWork import * from FrameWork import *
import EasyDialogs import EasyDialogs
import macfs
import os import os
import sys import sys
import macresource import macresource
@ -304,11 +303,9 @@ def GetType():
if rv == DTYPE_CANCEL: if rv == DTYPE_CANCEL:
sys.exit(0) sys.exit(0)
if rv == DTYPE_EXIST: if rv == DTYPE_EXIST:
## macfs.SetFolder(':(MkDistr)') path = EasyDialogs.AskFileForOpen()
fss, ok = macfs.StandardGetFile('TEXT') if not path:
if not ok:
sys.exit(0) sys.exit(0)
path = fss.as_pathname()
basename = os.path.split(path)[-1] basename = os.path.split(path)[-1]
if basename[-8:] <> '.include': if basename[-8:] <> '.include':
EasyDialogs.Message('That is not a distribution include file') EasyDialogs.Message('That is not a distribution include file')