Various tweaks and bugfixes to GetArgv. It now appears good enough for Distutils.

This commit is contained in:
Jack Jansen 2000-09-21 22:01:08 +00:00
parent 00fb4160d3
commit 0bb0a90b20
1 changed files with 10 additions and 10 deletions

View File

@ -389,7 +389,7 @@ def GetArgv(optionlist=None, commandlist=None, addoldfile=1, addnewfile=1, addfo
d.GetDialogItemAsControl(ARGV_OPTION_GROUP).DeactivateControl() d.GetDialogItemAsControl(ARGV_OPTION_GROUP).DeactivateControl()
if commandlist: if commandlist:
_setmenu(d.GetDialogItemAsControl(ARGV_COMMAND_GROUP), commandlist) _setmenu(d.GetDialogItemAsControl(ARGV_COMMAND_GROUP), commandlist)
if type(commandlist) == type(()) and len(commandlist[0]) > 1: if type(commandlist[0]) == type(()) and len(commandlist[0]) > 1:
help = commandlist[0][-1] help = commandlist[0][-1]
h = d.GetDialogItemAsControl(ARGV_COMMAND_EXPLAIN) h = d.GetDialogItemAsControl(ARGV_COMMAND_EXPLAIN)
Dlg.SetDialogItemText(h, help) Dlg.SetDialogItemText(h, help)
@ -422,10 +422,9 @@ def GetArgv(optionlist=None, commandlist=None, addoldfile=1, addnewfile=1, addfo
elif n == ARGV_OPTION_ADD: elif n == ARGV_OPTION_ADD:
idx = d.GetDialogItemAsControl(ARGV_OPTION_GROUP).GetControlValue()-1 idx = d.GetDialogItemAsControl(ARGV_OPTION_GROUP).GetControlValue()-1
if 0 <= idx < len(optionlist): if 0 <= idx < len(optionlist):
if type(optionlist) == type(()): option = optionlist[idx]
option = optionlist[idx][0] if type(option) == type(()):
else: option = option[0]
option = optionlist[idx]
if option[-1] == '=' or option[-1] == ':': if option[-1] == '=' or option[-1] == ':':
option = option[:-1] option = option[:-1]
h = d.GetDialogItemAsControl(ARGV_OPTION_VALUE) h = d.GetDialogItemAsControl(ARGV_OPTION_VALUE)
@ -443,7 +442,7 @@ def GetArgv(optionlist=None, commandlist=None, addoldfile=1, addnewfile=1, addfo
MacOS.SysBeep() MacOS.SysBeep()
elif n == ARGV_COMMAND_GROUP: elif n == ARGV_COMMAND_GROUP:
idx = d.GetDialogItemAsControl(ARGV_COMMAND_GROUP).GetControlValue()-1 idx = d.GetDialogItemAsControl(ARGV_COMMAND_GROUP).GetControlValue()-1
if 0 <= idx < len(commandlist) and type(commandlist) == type(()) and \ if 0 <= idx < len(commandlist) and type(commandlist[idx]) == type(()) and \
len(commandlist[idx]) > 1: len(commandlist[idx]) > 1:
help = commandlist[idx][-1] help = commandlist[idx][-1]
h = d.GetDialogItemAsControl(ARGV_COMMAND_EXPLAIN) h = d.GetDialogItemAsControl(ARGV_COMMAND_EXPLAIN)
@ -451,10 +450,10 @@ def GetArgv(optionlist=None, commandlist=None, addoldfile=1, addnewfile=1, addfo
elif n == ARGV_COMMAND_ADD: elif n == ARGV_COMMAND_ADD:
idx = d.GetDialogItemAsControl(ARGV_COMMAND_GROUP).GetControlValue()-1 idx = d.GetDialogItemAsControl(ARGV_COMMAND_GROUP).GetControlValue()-1
if 0 <= idx < len(commandlist): if 0 <= idx < len(commandlist):
if type(commandlist) == type(()): command = commandlist[idx]
stringstoadd = [commandlist[idx][0]] if type(command) == type(()):
else: command = command[0]
stringstoadd = [commandlist[idx]] stringstoadd = [command]
else: else:
MacOS.SysBeep() MacOS.SysBeep()
elif n == ARGV_ADD_OLDFILE: elif n == ARGV_ADD_OLDFILE:
@ -511,6 +510,7 @@ def GetArgv(optionlist=None, commandlist=None, addoldfile=1, addnewfile=1, addfo
return newlist return newlist
finally: finally:
apply(MacOS.SchedParams, appsw) apply(MacOS.SchedParams, appsw)
del d
def test(): def test():
import time, sys import time, sys