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

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

Functions

def init (filename=None)
 Initialize the class and load all values. More...
 
def set_item (key, value)
 Set a configuration value. More...
 
def get_item (key)
 Returns a configuration value. More...
 
def load ()
 Load the configuration from a file. More...
 
def save (force=False, saveAll=False)
 Store configuration into a file. More...
 

Variables

dictionary config = {}
 Contains the current configuration items. More...
 
string config_file = ""
 File name of the configuration file. More...
 
string config_file_win = "./smmgui.ini"
 File name of the configuration file on Windows platforms. More...
 
string config_file_unix = "./smmguirc"
 File name of the configuration file on Unix platforms. More...
 
dictionary config_defaults = {}
 Default configuration settings. More...
 
bool has_changed = False
 Indicate changes at the configuration items. More...
 
string header
 Small header added to every written config file. More...
 
 py_version = sys.version.split()[0]
 Python version. More...
 
string wx_version = "not_set"
 wxPython version More...
 
string platform = "not_set"
 Current platform (mostly wx.Platform) More...
 
string list_sep = " "
 Separator to converts lists into strings and back. More...
 

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

◆ get_item()

def gui.config.get_item (   key)

Returns a configuration value.

Returns
The value of the key, if it exists otherwise None
Exceptions
ValueErrorIf the requested key is unknown

◆ init()

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:

◆ load()

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:

◆ save()

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

◆ set_item()

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

◆ config

gui.config.config = {}

Contains the current configuration items.

◆ config_defaults

dictionary gui.config.config_defaults = {}

Default configuration settings.

◆ config_file

string gui.config.config_file = ""

File name of the configuration file.

See also
config_file_win and config_file_unix

◆ config_file_unix

string gui.config.config_file_unix = "./smmguirc"

File name of the configuration file on Unix platforms.

◆ config_file_win

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

File name of the configuration file on Windows platforms.

◆ has_changed

gui.config.has_changed = False

Indicate changes at the configuration items.

◆ header

string gui.config.header
Initial value:
1= """\
2# Diese Datei wird automatisch erzeugt. Manuelle Aenderungen werden
3# ohne Rueckfrage ueberschrieben. Der Inhalt ist UTF-8 codiert.
4#
5# This is an automatically generated file. Manual changes will be
6# overwritten without warning. The content is UTF-8 encoded.
7
8"""

Small header added to every written config file.

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

◆ list_sep

string gui.config.list_sep = " "

Separator to converts lists into strings and back.

◆ platform

string gui.config.platform = "not_set"

Current platform (mostly wx.Platform)

Note
This entry will be set during the initialisation

◆ py_version

gui.config.py_version = sys.version.split()[0]

Python version.

◆ wx_version

string gui.config.wx_version = "not_set"

wxPython version

Note
This entry will be set during the initialisation