config: expand general section as discussed on ML, add defaults for it

This commit is contained in:
steffen123 2010-08-23 03:56:07 +02:00
parent b41e385979
commit 0cc5865ba1
2 changed files with 21 additions and 2 deletions

View File

@ -519,6 +519,20 @@ class General(dict):
for (name, value) in node.attributes.items():
log.debug(_("config.general: adding %s = %s") % (name,value))
self[name] = value
try:
self["version"]=int(self["version"])
except KeyError:
self["version"]=0
self["ui_language"]="system"
self["config_difficuly"]="expert"
def get_defaults(self):
self["version"]=0
self["ui_language"]="system"
self["config_difficuly"]="expert"
self["config_wrap_len"]="-1"
self["day_start"]="5"
def __str__(self):
s = ""
@ -703,6 +717,8 @@ class Config:
self.emails = {}
self.gui_cash_stats = GUICashStats()
if doc.getElementsByTagName("general") == []:
self.general.get_defaults()
for gen_node in doc.getElementsByTagName("general"):
self.general.add_elements(node=gen_node) # add/overwrite elements in self.general

View File

@ -5,8 +5,11 @@
<!-- config_wrap_len is preferred max line length in this file, -1 means no max
day_start is time that logical day starts, e.g. 5 means that any play
between 00:00 and 04:59:59 counts as being on the previous day -->
<general config_wrap_len="-1"
day_start="5"
<general version="1"
config_wrap_len="-1"
day_start="5"
ui_language="system"
config_difficuly="expert"
/>
<import callFpdbHud = "True" interval = "10" fastStoreHudCache="False" hhArchiveBase="~/.fpdb/HandHistories/" saveActions="True"></import>