Catch up WinTables.py to recent changes in TableWindow.py.

This commit is contained in:
Eratosthenes 2010-09-08 20:35:59 -04:00
parent 9772129f30
commit 582377f519
3 changed files with 10 additions and 17 deletions

View File

@ -57,7 +57,7 @@ limit_game_names = { #fpdb name Stars Name FTP Name
# A window title might have our table name + one of these words/ # A window title might have our table name + one of these words/
# phrases. If it has this word in the title, it is not a table. # phrases. If it has this word in the title, it is not a table.
bad_words = ('History for table:', 'HUD:', 'Chat:') bad_words = ('History for table:', 'HUD:', 'Chat:', 'FPDBHUD')
# Here are the custom signals we define for allowing the 'client watcher' # Here are the custom signals we define for allowing the 'client watcher'
# thread to communicate with the gui thread. Any time a poker client is # thread to communicate with the gui thread. Any time a poker client is

View File

@ -1,9 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
"""WinTables.py """Routines for detecting and handling poker client windows for MS Windows.
Routines for detecting and handling poker client windows for MS Windows.
""" """
# Copyright 2008 - 2009, Ray E. Barker # Copyright 2008 - 2010, Ray E. Barker
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -49,24 +47,19 @@ tb_height = 29
class Table(Table_Window): class Table(Table_Window):
def find_table_parameters(self, search_string): def find_table_parameters(self):
"""Finds poker client window with the given table name.""" """Finds poker client window with the given table name."""
titles = {} titles = {}
win32gui.EnumWindows(win_enum_handler, titles) win32gui.EnumWindows(win_enum_handler, titles)
for hwnd in titles: for hwnd in titles:
if titles[hwnd] == "": continue if titles[hwnd] == "": continue
# print "searching ", search_string, " in ", titles[hwnd] if re.search(self.search_string, titles[hwnd]):
if re.search(search_string, titles[hwnd]): if self.check_bad_words(titles[hwnd]): continue
if 'History for table:' in titles[hwnd]: continue # Everleaf Network HH viewer window
if 'HUD:' in titles[hwnd]: continue # FPDB HUD window
if 'Chat:' in titles[hwnd]: continue # Some sites (FTP? PS? Others?) have seperable or seperately constructed chat windows
if 'FPDBHUD' in titles[hwnd]: continue # can't attach to ourselves!
self.window = hwnd
break break
try: try:
if self.window == None: if self.window == None:
log.error( "Window %s not found. Skipping." % search_string ) log.error( "Window %s not found. Skipping." % self.search_string )
return None return None
except AttributeError: except AttributeError:
log.error( "self.window doesn't exist? why?" ) log.error( "self.window doesn't exist? why?" )
@ -79,8 +72,6 @@ class Table(Table_Window):
self.width = width - x self.width = width - x
self.height = height - y self.height = height - y
log.debug("x = %s y = %s width = %s height = %s" % (self.x, self.y, self.width, self.height)) log.debug("x = %s y = %s width = %s height = %s" % (self.x, self.y, self.width, self.height))
#self.height = int(height) - b_width - tb_height
#self.width = int(width) - 2*b_width
self.exe = self.get_nt_exe(hwnd) self.exe = self.get_nt_exe(hwnd)
self.title = titles[hwnd] self.title = titles[hwnd]

View File

@ -45,8 +45,10 @@ class Table(Table_Window):
for listing in os.popen('xwininfo -root -tree').readlines(): for listing in os.popen('xwininfo -root -tree').readlines():
if re.search(self.search_string, listing): if re.search(self.search_string, listing):
mo = re.match('\s+([\dxabcdef]+) (.+):\s\(\"([a-zA-Z0-9\-.]+)\".+ (\d+)x(\d+)\+\d+\+\d+ \+(\d+)\+(\d+)', listing) mo = re.match('\s+([\dxabcdef]+) (.+):\s\(\"([a-zA-Z0-9\-.]+)\".+ (\d+)x(\d+)\+\d+\+\d+ \+(\d+)\+(\d+)', listing)
title = re.sub('\"', '', mo.group(2))
if self.check_bad_words(title): continue
self.number = int( mo.group(1), 0) self.number = int( mo.group(1), 0)
self.title = re.sub('\"', '', mo.group(2)) self.title = title
self.exe = "" # not used? self.exe = "" # not used?
self.hud = None # specified later self.hud = None # specified later
break break