Share and Money Management 0.18devel
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 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...
 

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 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.

Constructor & Destructor Documentation

◆ __init__()

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

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, 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().

Here is the caller graph for this function:

◆ _formatElement()

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

◆ _getElements()

def gui.controls.BaseChoice._getElements (   self)
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.

◆ 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(), 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.

Here is the call graph for this function:

◆ GetSelection()

def gui.controls.BaseChoice.GetSelection (   self)

◆ Select()

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

◆ SelectFirst()

def gui.controls.BaseChoice.SelectFirst (   self)

Select the first (non-empty) element.

See also
addEmpty

References gui.controls.BaseChoice.addEmpty, and gui.controls.ExchangeChoice.addEmpty.

◆ SetSelection()

def gui.controls.BaseChoice.SetSelection (   self,
  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: