Share and Money Management  0.16
Functions | Variables
gui.config Namespace Reference

The configuration module handles configuration entries stored in a file. More...

Functions

def init
 Initialize the class and load all values.
def set_item
 Set a configuration value.
def get_item
 Returns a configuration value.
def load
 Load the configuration from a file.
def save
 Store configuration into a file.

Variables

dictionary config = {}
 Contains the current configuration items.
string config_file = ''
 File name of the configuration file.
string config_file_win = "./smmgui.ini"
 File name of the configuration file on Windows platforms.
string config_file_unix = "./smmguirc"
 File name of the configuration file on Unix platforms.
dictionary config_defaults = {}
 Default configuration settings.
 has_changed = False
 Indicate changes at the configuration items.
string header
 Small header added to every written config file.
string list_sep = ' '
 Separator to converts lists into strings and back.

Detailed Description

The configuration module handles configuration entries stored in a file.

Author
Carsten Grohmann <mail (at) carstengrohmann (dot) de>
License:
GPL version 2.0

Function Documentation

def gui.config.get_item (   key)

Returns a configuration value.

Returns
The value of the key, if it exists otherwiese None
Exceptions
ValueErrorIf the requested key is unkown
def gui.config.init (   filename = None)

Initialize the class and load all values.

Parameters
filenameName of the configuration file or None to use default settings

References gui.config.load(), and gui.config.set_item().

Here is the call graph for this function:

def gui.config.load ( )

Load the configuration from a file.

Exceptions
TypeErrorIf the type of the configuration item is unknown

Referenced by gui.config.init().

Here is the caller graph for this function:

def gui.config.save (   force = False,
  saveAll = False 
)

Store configuration into a file.

The unchanged values will not write to the configuration file.

Parameters
forceForces writing to disk also if the configuration is unchanged
saveAllSave all configuration items, false means to save the changed items only
def gui.config.set_item (   key,
  value 
)

Set a configuration value.

Parameters
keyConfiguration key section/option
valueNew value
Exceptions
TypeErrorIf item's type doesn't fit the excepted type
ValueErrorFor unknown configuration items

Referenced by gui.config.init().

Here is the caller graph for this function:

Variable Documentation

gui.config.config = {}

Contains the current configuration items.

dictionary gui.config.config_defaults = {}

Default configuration settings.

string gui.config.config_file = ''

File name of the configuration file.

See Also
config_file_win and config_file_unix
string gui.config.config_file_unix = "./smmguirc"

File name of the configuration file on Unix platforms.

string gui.config.config_file_win = "./smmgui.ini"

File name of the configuration file on Windows platforms.

gui.config.has_changed = False

Indicate changes at the configuration items.

string gui.config.header
Initial value:
1 """\
2 # Diese Datei wird automatisch erzeugt. Manuelle Aenderungen werden
3 # ohne Rueckfrage ├╝berschrieben.
4 #
5 # This is an automatically generated file. Manual changes will be
6 # overwritten without warning.
7 
8 """

Small header added to every written config file.

Every header line should start with # to mark it as a comment line.

string gui.config.list_sep = ' '

Separator to converts lists into strings and back.