diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2000-09-21 22:01:08 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2000-09-21 22:01:08 (GMT) |
commit | 0bb0a90b200ef40f812b70c2623c7062cd39f3b3 (patch) | |
tree | ce5daf562fe460a8a216f1db1288d55972cd5aee /Mac/Lib/EasyDialogs.py | |
parent | 00fb4160d3a07d1a3a165ae017f7d5715fb88be0 (diff) | |
download | cpython-0bb0a90b200ef40f812b70c2623c7062cd39f3b3.zip cpython-0bb0a90b200ef40f812b70c2623c7062cd39f3b3.tar.gz cpython-0bb0a90b200ef40f812b70c2623c7062cd39f3b3.tar.bz2 |
Various tweaks and bugfixes to GetArgv. It now appears good enough for Distutils.
Diffstat (limited to 'Mac/Lib/EasyDialogs.py')
-rw-r--r-- | Mac/Lib/EasyDialogs.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Mac/Lib/EasyDialogs.py b/Mac/Lib/EasyDialogs.py index c830c55..e24bc8b 100644 --- a/Mac/Lib/EasyDialogs.py +++ b/Mac/Lib/EasyDialogs.py @@ -389,7 +389,7 @@ def GetArgv(optionlist=None, commandlist=None, addoldfile=1, addnewfile=1, addfo d.GetDialogItemAsControl(ARGV_OPTION_GROUP).DeactivateControl() if 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] h = d.GetDialogItemAsControl(ARGV_COMMAND_EXPLAIN) Dlg.SetDialogItemText(h, help) @@ -422,10 +422,9 @@ def GetArgv(optionlist=None, commandlist=None, addoldfile=1, addnewfile=1, addfo elif n == ARGV_OPTION_ADD: idx = d.GetDialogItemAsControl(ARGV_OPTION_GROUP).GetControlValue()-1 if 0 <= idx < len(optionlist): - if type(optionlist) == type(()): - option = optionlist[idx][0] - else: - option = optionlist[idx] + option = optionlist[idx] + if type(option) == type(()): + option = option[0] if option[-1] == '=' or option[-1] == ':': option = option[:-1] h = d.GetDialogItemAsControl(ARGV_OPTION_VALUE) @@ -443,7 +442,7 @@ def GetArgv(optionlist=None, commandlist=None, addoldfile=1, addnewfile=1, addfo MacOS.SysBeep() elif n == ARGV_COMMAND_GROUP: 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: help = commandlist[idx][-1] 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: idx = d.GetDialogItemAsControl(ARGV_COMMAND_GROUP).GetControlValue()-1 if 0 <= idx < len(commandlist): - if type(commandlist) == type(()): - stringstoadd = [commandlist[idx][0]] - else: - stringstoadd = [commandlist[idx]] + command = commandlist[idx] + if type(command) == type(()): + command = command[0] + stringstoadd = [command] else: MacOS.SysBeep() elif n == ARGV_ADD_OLDFILE: @@ -511,6 +510,7 @@ def GetArgv(optionlist=None, commandlist=None, addoldfile=1, addnewfile=1, addfo return newlist finally: apply(MacOS.SchedParams, appsw) + del d def test(): import time, sys |