Made AskFile* dialogs movable-modal by default, by providing a dummy

eventProc (which simply drops all events on the floor). Also added a
method SetDefaultEventProc through which frameworks can set a global
event handler (which can still be overridden on a per-call basis
with the eventProc argument).
This commit is contained in:
Jack Jansen 2003-02-07 15:45:40 +00:00
parent f631859409
commit 2731c5cf46
1 changed files with 26 additions and 10 deletions

View File

@ -591,7 +591,23 @@ def _process_Nav_args(dftflags, **args):
del args['wanted'] del args['wanted']
return args, tpwanted return args, tpwanted
def _dummy_Nav_eventproc(msg, data):
pass
_default_Nav_eventproc = _dummy_Nav_eventproc
def SetDefaultEventProc(proc):
global _default_Nav_eventproc
rv = _default_Nav_eventproc
if proc is None:
proc = _dummy_Nav_eventproc
_default_Nav_eventproc = proc
return rv
def AskFileForOpen( def AskFileForOpen(
message=None,
typeList=None,
# From here on the order is not documented
version=None, version=None,
defaultLocation=None, defaultLocation=None,
dialogOptionFlags=None, dialogOptionFlags=None,
@ -600,13 +616,11 @@ def AskFileForOpen(
windowTitle=None, windowTitle=None,
actionButtonLabel=None, actionButtonLabel=None,
cancelButtonLabel=None, cancelButtonLabel=None,
message=None,
preferenceKey=None, preferenceKey=None,
popupExtension=None, popupExtension=None,
eventProc=None, eventProc=_dummy_Nav_eventproc,
previewProc=None, previewProc=None,
filterProc=None, filterProc=None,
typeList=None,
wanted=None, wanted=None,
multiple=None): multiple=None):
"""Display a dialog asking the user for a file to open. """Display a dialog asking the user for a file to open.
@ -642,6 +656,9 @@ def AskFileForOpen(
raise TypeError, "Unknown value for argument 'wanted': %s" % repr(tpwanted) raise TypeError, "Unknown value for argument 'wanted': %s" % repr(tpwanted)
def AskFileForSave( def AskFileForSave(
message=None,
savedFileName=None,
# From here on the order is not documented
version=None, version=None,
defaultLocation=None, defaultLocation=None,
dialogOptionFlags=None, dialogOptionFlags=None,
@ -650,11 +667,9 @@ def AskFileForSave(
windowTitle=None, windowTitle=None,
actionButtonLabel=None, actionButtonLabel=None,
cancelButtonLabel=None, cancelButtonLabel=None,
savedFileName=None,
message=None,
preferenceKey=None, preferenceKey=None,
popupExtension=None, popupExtension=None,
eventProc=None, eventProc=_dummy_Nav_eventproc,
fileType=None, fileType=None,
fileCreator=None, fileCreator=None,
wanted=None, wanted=None,
@ -671,8 +686,8 @@ def AskFileForSave(
location=location,clientName=clientName,windowTitle=windowTitle, location=location,clientName=clientName,windowTitle=windowTitle,
actionButtonLabel=actionButtonLabel,cancelButtonLabel=cancelButtonLabel, actionButtonLabel=actionButtonLabel,cancelButtonLabel=cancelButtonLabel,
savedFileName=savedFileName,message=message,preferenceKey=preferenceKey, savedFileName=savedFileName,message=message,preferenceKey=preferenceKey,
popupExtension=popupExtension,fileType=fileType,fileCreator=fileCreator, popupExtension=popupExtension,eventProc=eventProc,fileType=fileType,
wanted=wanted,multiple=multiple) fileCreator=fileCreator,wanted=wanted,multiple=multiple)
try: try:
rr = Nav.NavPutFile(args) rr = Nav.NavPutFile(args)
good = 1 good = 1
@ -703,6 +718,8 @@ def AskFileForSave(
raise TypeError, "Unknown value for argument 'wanted': %s" % repr(tpwanted) raise TypeError, "Unknown value for argument 'wanted': %s" % repr(tpwanted)
def AskFolder( def AskFolder(
message=None,
# From here on the order is not documented
version=None, version=None,
defaultLocation=None, defaultLocation=None,
dialogOptionFlags=None, dialogOptionFlags=None,
@ -711,10 +728,9 @@ def AskFolder(
windowTitle=None, windowTitle=None,
actionButtonLabel=None, actionButtonLabel=None,
cancelButtonLabel=None, cancelButtonLabel=None,
message=None,
preferenceKey=None, preferenceKey=None,
popupExtension=None, popupExtension=None,
eventProc=None, eventProc=_dummy_Nav_eventproc,
filterProc=None, filterProc=None,
wanted=None, wanted=None,
multiple=None): multiple=None):