Merge branch 'master' of git://github.com/grindi/fpdb-grindi

This commit is contained in:
Worros 2009-08-08 21:25:57 +08:00
commit a24fe93612

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Configuration.py
Handles HUD configuration files.
@ -543,6 +544,13 @@ class Config:
if db_type != None: self.supported_databases[db_name].dp_type = db_type
return
def getDefaultSite(self):
"Returns first enabled site or None"
for site_name,site in self.supported_sites.iteritems():
if site.enabled:
return site_name
return None
def get_tv_parameters(self):
tv = {}
try: tv['combinedStealFold'] = self.tv.combinedStealFold
@ -573,14 +581,15 @@ class Config:
except: imp['fastStoreHudCache'] = True
return imp
def get_default_paths(self, site = "PokerStars"):
def get_default_paths(self, site = None):
if site is None: site = self.getDefaultSite()
paths = {}
try:
paths['hud-defaultPath'] = os.path.expanduser(self.supported_sites[site].HH_path)
paths['bulkImport-defaultPath'] = os.path.expanduser(self.supported_sites[site].HH_path)
path = os.path.expanduser(self.supported_sites[site].HH_path)
assert(os.path.isdir(path) or os.path.isfile(path)) # maybe it should try another site?
paths['hud-defaultPath'] = paths['bulkImport-defaultPath'] = path
except:
paths['hud-defaultPath'] = "default"
paths['bulkImport-defaultPath'] = "default"
paths['hud-defaultPath'] = paths['bulkImport-defaultPath'] = "default"
return paths
def get_frames(self, site = "PokerStars"):