From 7a602846ff1cfacf8cab2dd4165da591a0977c50 Mon Sep 17 00:00:00 2001 From: fpdb-mme Date: Thu, 5 Nov 2009 00:34:02 +0100 Subject: [PATCH] combed over Config.get_tv_parameters() there was a bit much of unconditional exception handling note: some parts of the application call Config.get_tv_parameters() but afaics the actual parameters are never used anywhere. so maybe its leftover code. someone drop a note if or not to remove tv related stuff --- pyfpdb/Configuration.py | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/pyfpdb/Configuration.py b/pyfpdb/Configuration.py index 3083ee9f..3f9b9e8a 100755 --- a/pyfpdb/Configuration.py +++ b/pyfpdb/Configuration.py @@ -328,9 +328,9 @@ class HudUI: class Tv: def __init__(self, node): - self.combinedStealFold = node.getAttribute("combinedStealFold") - self.combined2B3B = node.getAttribute("combined2B3B") - self.combinedPostflop = node.getAttribute("combinedPostflop") + self.combinedStealFold = string_to_bool(node.getAttribute("combinedStealFold"), default=True) + self.combined2B3B = string_to_bool(node.getAttribute("combined2B3B"), default=True) + self.combinedPostflop = string_to_bool(node.getAttribute("combinedPostflop"), default=True) def __str__(self): return (" combinedStealFold = %s\n combined2B3B = %s\n combinedPostflop = %s\n" % @@ -392,6 +392,8 @@ class Config: self.hhcs = {} self.popup_windows = {} self.db_selected = None # database the user would like to use + self.tv = None + # s_sites = doc.getElementsByTagName("supported_sites") for site_node in doc.getElementsByTagName("site"): @@ -448,8 +450,7 @@ class Config: self.ui = hui for tv_node in doc.getElementsByTagName("tv"): - tv = Tv(node = tv_node) - self.tv = tv + self.tv = Tv(node = tv_node) db = self.get_db_parameters() if db['db-password'] == 'YOUR MYSQL PASSWORD': @@ -655,16 +656,13 @@ class Config: return None def get_tv_parameters(self): - tv = {} - try: tv['combinedStealFold'] = self.tv.combinedStealFold - except: tv['combinedStealFold'] = True - - try: tv['combined2B3B'] = self.tv.combined2B3B - except: tv['combined2B3B'] = True - - try: tv['combinedPostflop'] = self.tv.combinedPostflop - except: tv['combinedPostflop'] = True - return tv + if self.tv is not None: + return { + 'combinedStealFold': self.tv.combinedStealFold, + 'combined2B3B': self.tv.combined2B3B, + 'combinedPostflop': self.tv.combinedPostflop + } + return {} # Allow to change the menu appearance def get_hud_ui_parameters(self):