Share and Money Management 0.18devel
|
A class derivated from the wx.Choice widget to filling with a set of objects. More...
Public Member Functions | |
def | __init__ (self, *args, **kwargs) |
Constructor. More... | |
def | addEmptyChoice (self) |
Add an empty choice to the widget. More... | |
def | GetSelection (self) |
Returns the selected object or None . More... | |
def | SetSelection (self, obj) |
Select another object. More... | |
def | SelectFirst (self) |
Select the first (non-empty) element. More... | |
def | Select (self, obj) |
Selecting an element specified by the given object. More... | |
Public Attributes | |
addEmpty | |
idx_obj | |
Dictionary to lookup relations between position and object. More... | |
Static Public Attributes | |
bool | addEmpty = False |
Add an empty entry to the widget during initialisation. More... | |
Private Member Functions | |
def | _formatElement (self, obj) |
Return the formatted object. More... | |
def | _getElements (self) |
Return a list / iterator of all object to add to the choice control. More... | |
def | _addElements (self, elements) |
Add the given elements to the Choice box. More... | |
A class derivated from the wx.Choice widget to filling with a set of objects.
The class extend the original handling of the wx.Choice widget by implementing own functions like Select() that handles objects instead of simple strings.
This changed behaviour simplify the usage with a larger list of objects. Because isn't possible to set and get the objects directly instead of conversion to a string and setting / getting this string.
The class converts the objects internally into strings using _formatElement and adds the strings to the choice widget.
def gui.controls.BaseChoice.__init__ | ( | self, | |
* | args, | ||
** | kwargs | ||
) |
Constructor.
addEmpty
Override class specific addEmpty Reimplemented in gui.controls.PositionChoice, gui.controls.EncodingChoice, gui.controls.LogLevelChoice, gui.controls.TransactionKindChoice, gui.controls.ShareKindChoice, and gui.controls.ShareSourceChoice.
|
private |
Add the given elements to the Choice box.
self | The object instance itself |
elements | List of tuples with text and object |
References gui.controls.BaseChoice.idx_obj, gui.controls.EncodingChoice.idx_obj, gui.controls.LogLevelChoice.idx_obj, gui.controls.TransactionKindChoice.idx_obj, gui.controls.ShareKindChoice.idx_obj, and gui.controls.ShareSourceChoice.idx_obj.
Referenced by gui.controls.BaseChoice.addEmptyChoice().
|
private |
Return the formatted object.
Reimplemented in gui.controls.PositionChoice, gui.controls.ShareChoice, gui.controls.CurrencyChoice, and gui.controls.ExchangeChoice.
|
private |
Return a list / iterator of all object to add to the choice control.
Reimplemented in gui.controls.PositionChoice, gui.controls.ShareChoice, gui.controls.CurrencyChoice, and gui.controls.ExchangeChoice.
def gui.controls.BaseChoice.addEmptyChoice | ( | self | ) |
Add an empty choice to the widget.
An empty choice refers to None
.
References gui.controls.BaseChoice._addElements(), gui.controls.BaseChoice.idx_obj, gui.controls.EncodingChoice.idx_obj, gui.controls.LogLevelChoice.idx_obj, gui.controls.TransactionKindChoice.idx_obj, gui.controls.ShareKindChoice.idx_obj, and gui.controls.ShareSourceChoice.idx_obj.
def gui.controls.BaseChoice.GetSelection | ( | self | ) |
Returns the selected object or None
.
References gui.controls.BaseChoice.idx_obj, gui.controls.EncodingChoice.idx_obj, gui.controls.LogLevelChoice.idx_obj, gui.controls.TransactionKindChoice.idx_obj, gui.controls.ShareKindChoice.idx_obj, and gui.controls.ShareSourceChoice.idx_obj.
def gui.controls.BaseChoice.Select | ( | self, | |
obj | |||
) |
Selecting an element specified by the given object.
self | The object instance itself |
obj | Object to select |
References gui.controls.BaseChoice.idx_obj, gui.controls.EncodingChoice.idx_obj, gui.controls.LogLevelChoice.idx_obj, gui.controls.TransactionKindChoice.idx_obj, gui.controls.ShareKindChoice.idx_obj, and gui.controls.ShareSourceChoice.idx_obj.
def gui.controls.BaseChoice.SelectFirst | ( | self | ) |
Select the first (non-empty) element.
References gui.controls.BaseChoice.addEmpty, and gui.controls.ExchangeChoice.addEmpty.
def gui.controls.BaseChoice.SetSelection | ( | self, | |
obj | |||
) |
|
static |
Add an empty entry to the widget during initialisation.
Referenced by gui.controls.BaseChoice.SelectFirst().
gui.controls.BaseChoice.addEmpty |
Referenced by gui.controls.BaseChoice.SelectFirst().
gui.controls.BaseChoice.idx_obj |
Dictionary to lookup relations between position and object.
The key is the position in the wx.Choice
widget and the value is the presented object like a share.
Referenced by gui.controls.BaseChoice._addElements(), gui.controls.BaseChoice.addEmptyChoice(), gui.controls.BaseChoice.GetSelection(), gui.controls.BaseChoice.Select(), and gui.controls.BaseChoice.SetSelection().