From 20243ac6ed8d365f905a374fc516e419d1cfeb8c Mon Sep 17 00:00:00 2001 From: Eratosthenes Date: Tue, 1 Mar 2011 12:22:48 -0500 Subject: [PATCH 1/2] Fix problem with missing tables or unfound tables. --- pyfpdb/HUD_main.pyw | 2 +- pyfpdb/TableWindow.py | 6 +++++- pyfpdb/XTables.py | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pyfpdb/HUD_main.pyw b/pyfpdb/HUD_main.pyw index 04476dae..e4d86670 100755 --- a/pyfpdb/HUD_main.pyw +++ b/pyfpdb/HUD_main.pyw @@ -266,7 +266,7 @@ class HUD_main(object): cards = self.get_cards(new_hand_id) table_kwargs = dict(table_name=table_name, tournament=tour_number, table_number=tab_number) tablewindow = Tables.Table(self.config, site_name, **table_kwargs) - if tablewindow is None: + if tablewindow.number is None: # If no client window is found on the screen, complain and continue if type == "tour": table_name = "%s %s" % (tour_number, tab_number) diff --git a/pyfpdb/TableWindow.py b/pyfpdb/TableWindow.py index 72151d13..5d69687f 100644 --- a/pyfpdb/TableWindow.py +++ b/pyfpdb/TableWindow.py @@ -34,9 +34,13 @@ import gtk import gobject # FreePokerTools modules +import Configuration from HandHistoryConverter import getTableTitleRe from HandHistoryConverter import getTableNoRe +c = Configuration.Config() +log = Configuration.get_logger("logging.conf", "hud", log_dir=c.dir_log, log_file='HUD-log.txt') + # Global used for figuring out the current game being played from the title. # The dict key is a tuple of (limit type, category) for the game. # The list is the names for those games used by the supported poker sites @@ -142,7 +146,7 @@ class Table_Window(object): if self.number is not None: break trys += 1 if trys > 4: - log.error(_("Can't find table %s") % table_name) + log.error("Can't find table %s" % table_name) return None geo = self.get_geometry() diff --git a/pyfpdb/XTables.py b/pyfpdb/XTables.py index 10278a05..93664856 100644 --- a/pyfpdb/XTables.py +++ b/pyfpdb/XTables.py @@ -128,7 +128,7 @@ class Table(Table_Window): des_re = 'No such window with id' listing = os.popen("xwininfo -id %d -stats" % (self.number)).read() - + if listing == "": return mo = re.search(des_re, listing) if mo is not None: return None # table has been destroyed From 320c856d9eb55dc3e027951d4fded3f309f0f6f3 Mon Sep 17 00:00:00 2001 From: Steffen Schaumburg Date: Tue, 1 Mar 2011 22:58:23 +0100 Subject: [PATCH 2/2] l10nify a string --- pyfpdb/TableWindow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/TableWindow.py b/pyfpdb/TableWindow.py index 5d69687f..c09ad40f 100644 --- a/pyfpdb/TableWindow.py +++ b/pyfpdb/TableWindow.py @@ -146,7 +146,7 @@ class Table_Window(object): if self.number is not None: break trys += 1 if trys > 4: - log.error("Can't find table %s" % table_name) + log.error(_("Can't find table %s") % table_name) return None geo = self.get_geometry()