config: expand general section as discussed on ML, add defaults for it
This commit is contained in:
parent
b41e385979
commit
0cc5865ba1
|
@ -520,6 +520,20 @@ class General(dict):
|
|||
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 = ""
|
||||
for k in self:
|
||||
|
@ -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
|
||||
|
||||
|
|
|
@ -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"
|
||||
<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>
|
||||
|
|
Loading…
Reference in New Issue
Block a user