Package peppy :: Package lib :: Module userparams :: Class KeyedIndexChoiceParam
[frames] | no frames]

Class KeyedIndexChoiceParam

      object --+            
               |            
debug.debugmixin --+        
                   |        
               Param --+    
                       |    
        IndexChoiceParam --+
                           |
                          KeyedIndexChoiceParam

Parameter that is restricted to a string from a list of
choices, but using a key corresponding to the string as the value.

A Choice control is its user interface, and the key of the
currently selected string is used as the value.

An example:

    KeyedIndexChoiceParam('edge_indicator',
                          [(wx.stc.STC_EDGE_NONE, 'none'),
                           (wx.stc.STC_EDGE_LINE, 'line'),
                           (wx.stc.STC_EDGE_BACKGROUND, 'background'),
                           ], 'line', help='Long line indication mode'),

means that the user code deals with wx.stc.STC_EDGE_NONE,
wx.stc.STC_EDGE_LINE, and wx.stc.STC_EDGE_BACKGROUND, but stored
in the configuration will be 'none', 'line', or 'background'.  The
strings 'none', 'line', or 'background' are the items that will be
displayed in the choice control.

Instance Methods
 
__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.
 
valueToText(self, value)
Convert the user value to a string suitable to be written to the config file.
 
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

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__

Class Methods

Inherited from debug.debugmixin: dprint

Class Variables

Inherited from IndexChoiceParam: callback_event

Inherited from Param: default

Inherited from debug.debugmixin: debuglevel

Properties

Inherited from object: __class__

Method Details

__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)

textToValue(self, text)

 

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)

valueToText(self, value)

 

Convert the user value to a string suitable to be written to the config file.

Subclasses should convert the value to a string that is acceptable to textToValue.

Overrides: Param.valueToText
(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)

getValue(self, ctrl)

 

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)