Class IndexChoiceParam
object --+
|
debug.debugmixin --+
|
Param --+
|
IndexChoiceParam
- Known Subclasses:
-
Parameter that is restricted to a string from a list of
choices, but using an integer as the value.
The user interface presents a list of strings, but the value is either
the index of the string within the list in the simple case, or using a map
of index to another integer. If the choices are a simple text string,
index mode is used; however, if the choices are each tuples of an int
and a string, the int in the tuple is used as the value.
For example, IndexChoiceParam('Citrus', ['Lemon','Lime','Grapefruit']) is
a simple index lookup, from the set {0, 1, 2}, where the following uses a
keyed lookup and represents the value as the integer in the first element
of each tuple:
IndexChoiceParam('coins', [(1, 'penny'), (5, 'nickel'), (10, 'dime')])
|
|
__init__(self,
keyword,
choices,
default=None,
help='',
**kwargs)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature |
|
|
|
|
getCtrl(self,
parent,
initial=None)
Create and editing control. |
|
|
|
|
textToValue(self,
text)
Convert the user's config text to the type expected by the python
code. |
|
|
|
|
setValue(self,
ctrl,
value)
Populate the control given the user value. |
|
|
|
|
getValue(self,
ctrl)
Get the user value from the control. |
|
|
|
Inherited from Param:
OnCallback,
__str__,
getLabel,
isSettable,
isVisible,
processCallback,
setCallback,
setInitialState,
setValueWithoutCallback,
valueToText
Inherited from object:
__delattr__,
__getattribute__,
__hash__,
__new__,
__reduce__,
__reduce_ex__,
__repr__,
__setattr__
|
|
Inherited from object:
__class__
|
__init__(self,
keyword,
choices,
default=None,
help='',
**kwargs)
(Constructor)
|
|
x.__init__(...) initializes x; see x.__class__.__doc__ for
signature
- Overrides:
object.__init__
- (inherited documentation)
|
getCtrl(self,
parent,
initial=None)
|
|
Create and editing control.
Given the parent window, create a user interface element to edit the
param.
- Overrides:
Param.getCtrl
- (inherited documentation)
|
|
Convert the user's config text to the type expected by the python
code.
Subclasses should return the type expected by the user code.
- Overrides:
Param.textToValue
- (inherited documentation)
|
setValue(self,
ctrl,
value)
|
|
Populate the control given the user value.
If any conversion is needed to show the user value in the control, do
it here.
- Overrides:
Param.setValue
- (inherited documentation)
|
|
Get the user value from the control.
If the control doesn't automatically return a value of the correct
type, convert it here.
- Overrides:
Param.getValue
- (inherited documentation)
|