Share and Money Management  0.16
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | List of all members
gui.controls.BaseChoice Class Reference

A class derivated from the wx.Choice widget to filling with a set of objects. More...

Inheritance diagram for gui.controls.BaseChoice:

Public Member Functions

def __init__
 Constructor.
def addEmptyChoice
 Add an empty choice to the widget.
def GetSelection
 Returns the selected object or None.
def SetSelection
 Select an other object.
def SelectFirst
 Select the first (non-empty) element.
def Select
 Selecting a element specified by the given object.

Public Attributes

 idx_obj
 Dictionary to lookup relations between position and object.

Static Public Attributes

 addEmpty = False
 Add an empty entry to the widget during initialisation.

Private Member Functions

def _formatElement
 Return the formatted object.
def _getElements
 Return a list / iterator of all object to add to the choice control.
def _addElements
 Add the given elements to the Choice box.

Detailed Description

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 is'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 internaly into strings using _formatElement and adds the strings to the choice widget.

Constructor & Destructor Documentation

def gui.controls.BaseChoice.__init__ (   self,
  args,
  kwargs 
)

Member Function Documentation

def gui.controls.BaseChoice._addElements (   self,
  elements 
)
private

Add the given elements to the Choice box.

Parameters
selfThe object instance itself
elementsList of tuples with text and object

References gui.controls.BaseChoice.idx_obj.

Referenced by gui.controls.BaseChoice.addEmptyChoice().

Here is the caller graph for this function:

def gui.controls.BaseChoice._formatElement (   self,
  obj 
)
private

Return the formatted object.

def gui.controls.BaseChoice._getElements (   self)
private

Return a list / iterator of all object to add to the choice control.

def gui.controls.BaseChoice.addEmptyChoice (   self)

Add an empty choice to the widget.

An empty choice refers to None.

See Also
addEmpty, _addElements()

References gui.controls.BaseChoice._addElements().

Here is the call graph for this function:

def gui.controls.BaseChoice.GetSelection (   self)

Returns the selected object or None.

References gui.controls.BaseChoice.idx_obj.

def gui.controls.BaseChoice.Select (   self,
  obj 
)

Selecting a element specified by the given object.

Parameters
selfThe object instance itself
objObject to select
def gui.controls.BaseChoice.SelectFirst (   self)

Select the first (non-empty) element.

See Also
addEmpty

References gui.controls.BaseChoice.addEmpty.

def gui.controls.BaseChoice.SetSelection (   self,
  obj 
)

Select an other object.

Member Data Documentation

gui.controls.BaseChoice.addEmpty = False
static

Add an empty entry to the widget during initialisation.

See Also
addEmptyChoice()

Referenced by gui.controls.BaseChoice.__init__(), and 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.

See Also
helper.ReverseDict

Referenced by gui.controls.BaseChoice._addElements(), and gui.controls.BaseChoice.GetSelection().


The documentation for this class was generated from the following file: