Rev 3937 | Rev 4058 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3937 | Rev 4054 | ||
---|---|---|---|
Line 335... | Line 335... | ||
335 | # If there is just one option, use it |
335 | # If there is just one option, use it |
336 | if (len(choices) == 1): |
336 | if (len(choices) == 1): |
337 | defaults[varname] = choices[0][0] |
337 | defaults[varname] = choices[0][0] |
338 | continue |
338 | continue |
339 | 339 | ||
- | 340 | if (default == None): |
|
- | 341 | options.append("? %s --> " % name) |
|
- | 342 | else: |
|
340 | options.append(" %s [%s] --> " % (name, default)) |
343 | options.append(" %s [%s] --> " % (name, default)) |
341 | elif (vartype == 'y'): |
344 | elif (vartype == 'y'): |
342 | defaults[varname] = '*' |
345 | defaults[varname] = '*' |
343 | continue |
346 | continue |
344 | elif (vartype == 'y/n'): |
347 | elif (vartype == 'y/n'): |
345 | if (default == None): |
348 | if (default == None): |
346 | default = 'y' |
349 | default = 'y' |
347 | defaults[varname] = default |
350 | defaults[varname] = default |
348 | options.append(" <%s> %s " % (yes_no(default), name)) |
351 | options.append(" <%s> %s " % (yes_no(default), name)) |
349 | elif (vartype == 'n/y'): |
352 | elif (vartype == 'n/y'): |
350 | if (default == None): |
353 | if (default == None): |
351 | default = 'n' |
354 | default = 'n' |
352 | defaults[varname] = default |
355 | defaults[varname] = default |
353 | options.append(" <%s> %s " % (yes_no(default), name)) |
356 | options.append(" <%s> %s " % (yes_no(default), name)) |
354 | else: |
357 | else: |
355 | raise RuntimeError("Unknown variable type: %s" % vartype) |
358 | raise RuntimeError("Unknown variable type: %s" % vartype) |
356 | 359 | ||
357 | opt2row[cnt] = (varname, vartype, name, choices) |
360 | opt2row[cnt] = (varname, vartype, name, choices) |
358 | 361 | ||
Line 375... | Line 378... | ||
375 | 378 | ||
376 | if (button == 'done'): |
379 | if (button == 'done'): |
377 | if (check_choices(defaults, ask_names)): |
380 | if (check_choices(defaults, ask_names)): |
378 | break |
381 | break |
379 | else: |
382 | else: |
380 | xtui.error_dialog(screen, 'Error', 'Some options have still undefined values.') |
383 | xtui.error_dialog(screen, 'Error', 'Some options have still undefined values. These options are marked with the "?" sign.') |
381 | continue |
384 | continue |
382 | 385 | ||
383 | if (seltype == 'choice'): |
386 | if (seltype == 'choice'): |
384 | defaults[selname] = subchoice(screen, name, choices, default) |
387 | defaults[selname] = subchoice(screen, name, choices, default) |
385 | elif ((seltype == 'y/n') or (seltype == 'n/y')): |
388 | elif ((seltype == 'y/n') or (seltype == 'n/y')): |