Merge branch 'master' of git://git.assembla.com/free_poker_tools
This commit is contained in:
commit
5ce1fbaa5e
|
@ -116,7 +116,7 @@ class HUD_main(object):
|
|||
self.main_window.set_icon_stock(gtk.STOCK_HOME)
|
||||
if not options.hidden:
|
||||
self.main_window.show_all()
|
||||
gobject.timeout_add(100, self.check_tables)
|
||||
gobject.timeout_add(800, self.check_tables)
|
||||
|
||||
except:
|
||||
log.exception("Error initializing main_window")
|
||||
|
|
|
@ -118,6 +118,7 @@ class Table_Window(object):
|
|||
self.site = site
|
||||
self.hud = None # fill in later
|
||||
self.gdkhandle = None
|
||||
self.number = None
|
||||
if tournament is not None and table_number is not None:
|
||||
self.tournament = int(tournament)
|
||||
self.table = int(table_number)
|
||||
|
@ -135,7 +136,14 @@ class Table_Window(object):
|
|||
return None
|
||||
|
||||
self.search_string = getTableTitleRe(self.config, self.site, self.type, **table_kwargs)
|
||||
self.find_table_parameters()
|
||||
trys = 0
|
||||
while True:
|
||||
self.find_table_parameters()
|
||||
if self.number is not None: break
|
||||
trys += 1
|
||||
if trys > 4:
|
||||
log.error("Can't find table %s" % table_name)
|
||||
return None
|
||||
|
||||
geo = self.get_geometry()
|
||||
if geo is None: return None
|
||||
|
|
|
@ -35,11 +35,15 @@ import Xlib.display
|
|||
|
||||
# FPDB modules
|
||||
from TableWindow import Table_Window
|
||||
import Configuration
|
||||
|
||||
# We might as well do this once and make them globals
|
||||
disp = Xlib.display.Display()
|
||||
root = disp.screen().root
|
||||
|
||||
c = Configuration.Config()
|
||||
log = Configuration.get_logger("logging.conf", "hud", log_dir=c.dir_log, log_file='HUD-log.txt')
|
||||
|
||||
class Table(Table_Window):
|
||||
|
||||
def find_table_parameters(self):
|
||||
|
@ -56,14 +60,18 @@ class Table(Table_Window):
|
|||
self.number = None
|
||||
for listing in os.popen('xwininfo -root -tree').readlines():
|
||||
if re.search(self.search_string, listing, re.I):
|
||||
log.info(listing)
|
||||
mo = re.match(reg, listing, re.VERBOSE)
|
||||
title = re.sub('\"', '', mo.groupdict()["TITLE"])
|
||||
if self.check_bad_words(title): continue
|
||||
self.number = int( mo.groupdict()["XID"], 0 )
|
||||
self.title = title
|
||||
if self.number is None:
|
||||
log.warning("Could not retrieve XID from table xwininfo. xwininfo is %s" % listing)
|
||||
break
|
||||
|
||||
if self.number is None:
|
||||
log.warning("No match in XTables for table '%s'." % self.search_string)
|
||||
return None
|
||||
(self.window, self.parent) = self.get_window_from_xid(self.number)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user