gui.model.form_fields

gui.model.form_fields(command)

The options of a command that the form renders, read from the parser.

The fields come from spotregen.parser.command_parser, in the order of the parser. The options listed in HIDDEN_OPTIONS are left out. Every other option becomes a field, so an option added to the parser shows up in the form without a change here.

Parameters

Name Type Description Default
command str "mutate" or "local". required

Returns

Name Type Description
list[FormField] list[FormField]: One field per rendered option.

Raises

Name Type Description
ValueError If the command has no form, or an option is of a kind the form cannot render. The tests turn the second case into a failure, which is the signal to teach the form the new kind.

Examples

from spotregen.gui.model import form_fields

for field in form_fields("mutate"):
    print(field.flag, field.kind, repr(field.text_default))
--max int ''
--timeout float '120'
--python path ''