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__ (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 an other object. More...
 
def SelectFirst (self)
 Select the first (non-empty) element. More...
 
def Select (self, obj)
 Selecting a 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...
 

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

◆ __init__()

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

Constructor.

Keyword arguments:
  • addEmpty Override class specific addEmpty

Member Function Documentation

◆ _addElements()

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:

◆ _formatElement()

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

Return the formatted object.

◆ _getElements()

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

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

◆ addEmptyChoice()

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

Here is the call graph for this function:

◆ GetSelection()

def gui.controls.BaseChoice.GetSelection (   self)

Returns the selected object or None.

References gui.controls.BaseChoice.idx_obj.

◆ Select()

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

Selecting a element specified by the given object.

Parameters
selfThe object instance itself
objObject to select

References gui.controls.BaseChoice.idx_obj.

◆ SelectFirst()

def gui.controls.BaseChoice.SelectFirst (   self)

Select the first (non-empty) element.

See also
addEmpty

References gui.controls.BaseChoice.addEmpty.

◆ SetSelection()

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

Select an other object.

References gui.controls.BaseChoice.idx_obj.

Member Data Documentation

◆ addEmpty [1/2]

bool gui.controls.BaseChoice.addEmpty = False
static

Add an empty entry to the widget during initialisation.

See also
addEmptyChoice()

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

◆ addEmpty [2/2]

gui.controls.BaseChoice.addEmpty

◆ idx_obj

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(), gui.controls.BaseChoice.addEmptyChoice(), gui.controls.BaseChoice.GetSelection(), gui.controls.BaseChoice.Select(), and gui.controls.BaseChoice.SetSelection().


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