Fine tuning tournament support.
This commit is contained in:
parent
9923e6e8ca
commit
461c870690
|
@ -93,7 +93,6 @@ def read_stdin(): # This is the thread function
|
||||||
|
|
||||||
db_connection = Database.Database(config, db_name, 'temp')
|
db_connection = Database.Database(config, db_name, 'temp')
|
||||||
tourny_finder = re.compile('(\d+) (\d+)')
|
tourny_finder = re.compile('(\d+) (\d+)')
|
||||||
print tourny_finder
|
|
||||||
|
|
||||||
while True: # wait for a new hand number on stdin
|
while True: # wait for a new hand number on stdin
|
||||||
new_hand_id = sys.stdin.readline()
|
new_hand_id = sys.stdin.readline()
|
||||||
|
@ -115,10 +114,8 @@ def read_stdin(): # This is the thread function
|
||||||
mat_obj = tourny_finder.search(table_name)
|
mat_obj = tourny_finder.search(table_name)
|
||||||
# if len(mat_obj.groups) == 2:
|
# if len(mat_obj.groups) == 2:
|
||||||
if mat_obj:
|
if mat_obj:
|
||||||
print "found tournament",
|
|
||||||
is_tournament = True
|
is_tournament = True
|
||||||
(tour_number, tab_number) = mat_obj.group(1, 2)
|
(tour_number, tab_number) = mat_obj.group(1, 2)
|
||||||
print " number = %s, table = %s" % (tour_number, tab_number)
|
|
||||||
|
|
||||||
stat_dict = db_connection.get_stats_from_hand(new_hand_id)
|
stat_dict = db_connection.get_stats_from_hand(new_hand_id)
|
||||||
|
|
||||||
|
@ -132,7 +129,6 @@ def read_stdin(): # This is the thread function
|
||||||
else:
|
else:
|
||||||
if is_tournament:
|
if is_tournament:
|
||||||
tablewindow = Tables.discover_tournament_table(config, tour_number, tab_number)
|
tablewindow = Tables.discover_tournament_table(config, tour_number, tab_number)
|
||||||
print tablewindow
|
|
||||||
if tablewindow == None:
|
if tablewindow == None:
|
||||||
sys.stderr.write("tournament %s, table %s not found\n" % (tour_number, tab_number))
|
sys.stderr.write("tournament %s, table %s not found\n" % (tour_number, tab_number))
|
||||||
else:
|
else:
|
||||||
|
|
8
pyfpdb/Tables.py
Normal file → Executable file
8
pyfpdb/Tables.py
Normal file → Executable file
|
@ -223,6 +223,7 @@ def discover_nt(c):
|
||||||
|
|
||||||
def discover_nt_by_name(c, tablename):
|
def discover_nt_by_name(c, tablename):
|
||||||
"""Finds poker client window with the given table name."""
|
"""Finds poker client window with the given table name."""
|
||||||
|
titles = {}
|
||||||
win32gui.EnumWindows(win_enum_handler, titles)
|
win32gui.EnumWindows(win_enum_handler, titles)
|
||||||
for hwnd in titles.keys():
|
for hwnd in titles.keys():
|
||||||
if titles[hwnd].find(tablename) == -1: continue
|
if titles[hwnd].find(tablename) == -1: continue
|
||||||
|
@ -233,7 +234,7 @@ def discover_nt_by_name(c, tablename):
|
||||||
|
|
||||||
def discover_nt_tournament(c, tour_number, tab_number):
|
def discover_nt_tournament(c, tour_number, tab_number):
|
||||||
"""Finds the Windows window handle for the given tournament/table."""
|
"""Finds the Windows window handle for the given tournament/table."""
|
||||||
search_string = "%s.+%s" % (t_number, s_number)
|
search_string = "%s.+%s" % (tour_number, tab_number)
|
||||||
|
|
||||||
titles ={}
|
titles ={}
|
||||||
win32gui.EnumWindows(win_enum_handler, titles)
|
win32gui.EnumWindows(win_enum_handler, titles)
|
||||||
|
@ -260,12 +261,13 @@ def decode_windows(c, title, hwnd):
|
||||||
info = {}
|
info = {}
|
||||||
info['number'] = hwnd
|
info['number'] = hwnd
|
||||||
info['title'] = re.sub('\"', '', title)
|
info['title'] = re.sub('\"', '', title)
|
||||||
(x, y, w, h) = win32gui.GetWindowRect(hwnd)
|
(x, y, width, height) = win32gui.GetWindowRect(hwnd)
|
||||||
|
|
||||||
info['x'] = int(x) + b_width
|
info['x'] = int(x) + b_width
|
||||||
info['y'] = int( y ) + tb_height
|
info['y'] = int( y ) + tb_height
|
||||||
info['width'] = int( width ) - 2*b_width
|
info['width'] = int( width ) - 2*b_width
|
||||||
info['height'] = int( height ) - b_width - tb_height
|
info['height'] = int( height ) - b_width - tb_height
|
||||||
|
info['exe'] = get_nt_exe(hwnd)
|
||||||
|
|
||||||
title_bits = re.split(' - ', info['title'])
|
title_bits = re.split(' - ', info['title'])
|
||||||
info['name'] = title_bits[0]
|
info['name'] = title_bits[0]
|
||||||
|
@ -427,7 +429,7 @@ if __name__=="__main__":
|
||||||
c = Configuration.Config()
|
c = Configuration.Config()
|
||||||
|
|
||||||
print discover_table_by_name(c, "Ostara V")
|
print discover_table_by_name(c, "Ostara V")
|
||||||
print discover_tournament_table(c, "119736621", "1")
|
print discover_tournament_table(c, "118942908", "3")
|
||||||
|
|
||||||
tables = discover(c)
|
tables = discover(c)
|
||||||
for t in tables.keys():
|
for t in tables.keys():
|
||||||
|
|
Loading…
Reference in New Issue
Block a user