Class for holding a set of InputPrm-type parameters.
See src/py/examples/simviz/simviz1cp.py for examples
on usage. Some attributes may be useful in application code:
self.dict is a dictionary of InputPrm-type objects.
self.parameters_sequence (and self._seq) is a list of
InputPrm-type objects in the sequence they were registered.
self.sliders_sequence is a list of InputPrm-type objects,
with slider widget representation in a GUI, in the sequence
they were registered.
self.entries_sequence, self.checkbt_sequence,
self.options_sequence are similar for text entries, checkbuttons,
and option menus.
The self.*_sequence lists can be used to build GUIs or CGI scripts.
Normally, this is automated in classes like AutoSimVizGUI and
AutoSimVizCGI.
Methods
|
|
|
|
__getitem__
|
__getitem__ ( self, name )
|
|
__init__
|
__init__ (
self,
interface='plain',
form=None,
)
interface plain , CGI , or GUI
form cgi.FieldStorage() object
|
|
__setattr__
|
__setattr__ (
self,
name,
value,
)
If name2attr is called, self.m = 2.3 (using this
function) is safe, because this also implies update of
the corresponding InputPrm-type object in self.dict.
|
|
__setitem__
|
__setitem__ (
self,
name,
value,
)
|
|
add
|
add (
self,
name,
default,
str2type,
widget_type='entry',
values=None,
help=None,
unit=None,
cmlarg=None,
)
Add a new parameter.
|
|
dump
|
dump ( self )
|
|
endadd
|
endadd ( self )
Process parameters, make internal data structures.
Exceptions
|
|
ValueError, 'unknown widget_type %s' % p.widget_type
|
|
|
keys
|
keys ( self )
Return parameter names. With this method Parameter objects p
can be used in dictionary update functions: somedict.update(p).
|
|
name2attr
|
name2attr ( self )
Turn all item keys into attributes.
Warning: values are copied! __setitem__ and
__setattr__ (or properties) must
take care of parallel updates.
|
|
parse_options
|
parse_options ( self, argv )
Examine the command line and for each -opt val pair,
set the value of parameter opt to val, if opt is a
registered parameter.
argv is typically sys.argv[1:]
Note that the name of a parameter may contain blanks.
A blank is replaced by two underscores in the command-line
options.
|
|
usage
|
usage ( self )
Print legal command-line options.
|
|