add config sections for RawHands/Tourneys

This commit is contained in:
steffen123 2010-08-22 04:36:23 +02:00
parent fa6da55618
commit ccec828867
2 changed files with 68 additions and 1 deletions

View File

@ -594,6 +594,58 @@ class GUICashStats(list):
# s = s + " %s = %s\n" % (k, self[k])
# return(s)
class RawHands:
def __init__(self, node=None):
if node==None:
self.save="error"
self.compression="none"
print _("missing config section raw_hands")
else:
save=node.getAttribute("save")
if save in ("none", "error", "all"):
self.save=save
else:
print _("Invalid config value for raw_hands.save, defaulting to \"error\"")
self.save="error"
compression=node.getAttribute("compression")
if save in ("none", "gzip", "bzip2"):
self.compression=compression
else:
print _("Invalid config value for raw_hands.compression, defaulting to \"none\"")
self.compression="none"
#end def __init__
def __str__(self):
return " save= %s, compression= %s\n" % (self.save, self.compression)
#end class RawHands
class RawTourneys:
def __init__(self, node=None):
if node==None:
self.save="error"
self.compression="none"
print _("missing config section raw_tourneys")
else:
save=node.getAttribute("save")
if save in ("none", "error", "all"):
self.save=save
else:
print _("Invalid config value for raw_tourneys.save, defaulting to \"error\"")
self.save="error"
compression=node.getAttribute("compression")
if save in ("none", "gzip", "bzip2"):
self.compression=compression
else:
print _("Invalid config value for raw_tourneys.compression, defaulting to \"none\"")
self.compression="none"
#end def __init__
def __str__(self):
return " save= %s, compression= %s\n" % (self.save, self.compression)
#end class RawTourneys
class Config:
def __init__(self, file = None, dbname = ''):
# "file" is a path to an xml file with the fpdb/HUD configuration
@ -725,7 +777,18 @@ class Config:
db_pass = df_parms['db-password'])
self.save(file=os.path.join(self.default_config_path, "HUD_config.xml"))
if doc.getElementsByTagName("raw_hands") == []:
self.raw_hands = RawHands()
for raw_hands_node in doc.getElementsByTagName('raw_hands'):
self.raw_hands = RawHands(raw_hands_node)
if doc.getElementsByTagName("raw_tourneys") == []:
self.raw_tourneys = RawTourneys()
for raw_tourneys_node in doc.getElementsByTagName('raw_tourneys'):
self.raw_tourneys = RawTourneys(raw_tourneys_node)
print ""
#end def __init__
def set_hhArchiveBase(self, path):
self.imp.node.setAttribute("hhArchiveBase", path)

View File

@ -705,6 +705,10 @@ Left-Drag to Move"
<col col_name="variance" col_title="Variance" disp_all="True" disp_posn="True" field_format="%5.2f" field_type="str" xalignment="1.0"/>
</gui_cash_stats>
<raw_hands save="none" compression="none"/>
<raw_tourneys save="none" compression="none"/>
<supported_databases>
<!-- <database db_name="fpdb" db_server="mysql" db_ip="localhost" db_user="fpdb" db_pass="YOUR MYSQL PASSWORD"></database> -->
<database db_ip="localhost" db_server="sqlite" db_name="fpdb.db3" db_user="fpdb" db_pass="fpdb"/>