Beispiel #1
0
def GetSaveFile(message=None, ProposedFileName=None, filetypes=None):
    if filetypes is None:
        filetypes = []
    try:
        from Foundation import NSSavePanel
        from AppKit import NSOKButton
    except ImportError:
        assert len(filetypes) == 1
        filetype = filetypes[0]
        ProposedFileName = ProposedFileName if ProposedFileName else ""
        return fl.GetFileName(
            0, "", ProposedFileName,
            "%s file|*.%s" % (filetype.capitalize(), filetype))
    Panel = NSSavePanel.savePanel().retain()
    if message is not None:
        Panel.setTitle_(message)
    Panel.setCanChooseFiles_(True)
    Panel.setCanChooseDirectories_(False)
    Panel.setAllowedFileTypes_(filetypes)
    if ProposedFileName is not None:
        Panel.setNameFieldStringValue_(ProposedFileName)
    pressedButton = Panel.runModalForTypes_(filetypes)
    if pressedButton == NSOKButton:
        return Panel.filename()
    return None
Beispiel #2
0
def GetSaveFile(message=None, ProposedFileName=None, filetypes=None):
	if filetypes is None:
		filetypes = []
	from Foundation import NSSavePanel
	from AppKit import NSOKButton
	Panel = NSSavePanel.savePanel().retain()
	if message is not None:
		Panel.setTitle_(message)
	Panel.setCanChooseFiles_(True)
	Panel.setCanChooseDirectories_(False)
	Panel.setAllowedFileTypes_(filetypes)
	if ProposedFileName is not None:
		Panel.setNameFieldStringValue_(ProposedFileName)
	pressedButton = Panel.runModalForTypes_(filetypes)
	if pressedButton == NSOKButton:
		return Panel.filename()
	return None
def GetSaveFile(message=None, ProposedFileName=None, filetypes=None):
	if filetypes is None:
		filetypes = []
	from Foundation import NSSavePanel
	from AppKit import NSOKButton
	Panel = NSSavePanel.savePanel().retain()
	if message is not None:
		Panel.setTitle_(message)
	Panel.setCanChooseFiles_(True)
	Panel.setCanChooseDirectories_(False)
	Panel.setAllowedFileTypes_(filetypes)
	if ProposedFileName is not None:
		Panel.setNameFieldStringValue_(ProposedFileName)
	pressedButton = Panel.runModalForTypes_(filetypes)
	if pressedButton == NSOKButton:
		return Panel.filename()
	return None
Beispiel #4
0
def GetSaveFile(message=None, ProposedFileName=None, filetypes=None):
	if filetypes is None:
		filetypes = []
	try:
		from Foundation import NSSavePanel
		from AppKit import NSOKButton
	except ImportError:
		assert len(filetypes) == 1
		filetype = filetypes[0]
		ProposedFileName = ProposedFileName if ProposedFileName else ""
		return fl.GetFileName(0, "", ProposedFileName, "%s file|*.%s" % (filetype.capitalize(), filetype))
	Panel = NSSavePanel.savePanel().retain()
	if message is not None:
		Panel.setTitle_(message)
	Panel.setCanChooseFiles_(True)
	Panel.setCanChooseDirectories_(False)
	Panel.setAllowedFileTypes_(filetypes)
	if ProposedFileName is not None:
		Panel.setNameFieldStringValue_(ProposedFileName)
	pressedButton = Panel.runModalForTypes_(filetypes)
	if pressedButton == NSOKButton:
		return Panel.filename()
	return None