Merge branch 'master' of git://git.assembla.com/free_poker_tools

This commit is contained in:
Mika Bostrom 2009-11-07 08:11:01 +02:00
commit 33357447be
5 changed files with 24 additions and 15 deletions

View File

@ -53,7 +53,12 @@ import gobject
# FreePokerTools modules # FreePokerTools modules
import Configuration import Configuration
import Database import Database
import Tables # get the correct module for the current os
if os.name == 'posix':
import XTables as Tables
elif os.name == 'nt':
import WinTables as Tables
#import Tables
import Hud import Hud
@ -131,6 +136,7 @@ class HUD_main(object):
# TODO: The purpose of this try/finally block is to make darn sure that threads_leave() # TODO: The purpose of this try/finally block is to make darn sure that threads_leave()
# TODO: gets called. If there is an exception and threads_leave() doesn't get called we # TODO: gets called. If there is an exception and threads_leave() doesn't get called we
# TODO: lock up. REB # TODO: lock up. REB
table.gdkhandle = gtk.gdk.window_foreign_new(table.number)
newlabel = gtk.Label("%s - %s" % (table.site, table_name)) newlabel = gtk.Label("%s - %s" % (table.site, table_name))
self.vb.add(newlabel) self.vb.add(newlabel)
newlabel.show() newlabel.show()
@ -210,7 +216,7 @@ class HUD_main(object):
# get basic info about the new hand from the db # get basic info about the new hand from the db
# if there is a db error, complain, skip hand, and proceed # if there is a db error, complain, skip hand, and proceed
try: try:
(table_name, max, poker_game, type, site_id, tour_number, tab_number) = \ (table_name, max, poker_game, type, site_id, site_name, tour_number, tab_number) = \
self.db_connection.get_table_info(new_hand_id) self.db_connection.get_table_info(new_hand_id)
except Exception, err: except Exception, err:
print "db error: skipping %s" % new_hand_id print "db error: skipping %s" % new_hand_id
@ -248,15 +254,17 @@ class HUD_main(object):
cards['common'] = comm_cards['common'] cards['common'] = comm_cards['common']
if type == "tour": if type == "tour":
tablewindow = Tables.discover_tournament_table(self.config, tour_number, tab_number) tablewindow = Tables.Table(tournament = tour_number, table_number = tab_number)
else: else:
tablewindow = Tables.discover_table_by_name(self.config, table_name) tablewindow = Tables.Table(table_name = table_name)
if tablewindow is None: if tablewindow is None:
# If no client window is found on the screen, complain and continue # If no client window is found on the screen, complain and continue
if type == "tour": if type == "tour":
table_name = "%s %s" % (tour_number, tab_number) table_name = "%s %s" % (tour_number, tab_number)
sys.stderr.write("HUD create: table name "+table_name+" not found, skipping.\n") sys.stderr.write("HUD create: table name "+table_name+" not found, skipping.\n")
else: else:
tablewindow.max = max
tablewindow.site = site_name
self.create_HUD(new_hand_id, tablewindow, temp_key, max, poker_game, type, stat_dict, cards) self.create_HUD(new_hand_id, tablewindow, temp_key, max, poker_game, type, stat_dict, cards)
self.db_connection.connection.rollback() self.db_connection.connection.rollback()

View File

@ -1605,11 +1605,11 @@ class Sql:
""" """
self.query['get_table_name'] = """ self.query['get_table_name'] = """
select h.tableName, h.maxSeats, gt.category, gt.type, gt.siteId SELECT h.tableName, h.maxSeats, gt.category, gt.type, s.id, s.name
from Hands h FROM Hands h, Gametypes gt, Sites s
,Gametypes gt WHERE h.id = %s
where h.id = %s AND gt.id = h.gametypeId
and gt.id = h.gametypeId AND s.id = gt.siteID
""" """
self.query['get_actual_seat'] = """ self.query['get_actual_seat'] = """

View File

@ -113,12 +113,12 @@ class Table_Window(object):
def __str__(self): def __str__(self):
# __str__ method for testing # __str__ method for testing
likely_attrs = ("site", "number", "title", "width", "height", "x", "y",
"tournament", "table", "gdkhandle")
temp = 'TableWindow object\n' temp = 'TableWindow object\n'
temp = temp + " name = %s\n site = %s\n number = %s\n title = %s\n" % (self.name, self.site, self.number, self.title) for a in likely_attrs:
# temp = temp + " game = %s\n structure = %s\n max = %s\n" % (self.game, self.structure, self.max) if getattr(self, a, 0):
temp = temp + " width = %d\n height = %d\n x = %d\n y = %d\n" % (self.width, self.height, self.x, self.y) temp += " %s = %s\n" % (a, getattr(self, a))
if getattr(self, 'tournament', 0):
temp = temp + " tournament = %d\n table = %d" % (self.tournament, self.table)
return temp return temp
def get_game(self): def get_game(self):

0
pyfpdb/Tables_Demo.py Normal file → Executable file
View File

View File

@ -79,7 +79,8 @@ class Table(Table_Window):
self.gdk_handle = None self.gdk_handle = None
else: else:
self.number = int( mo.group(1), 0) self.number = int( mo.group(1), 0)
self.gdk_handle = gtk.gdk.window_foreign_new(int(self.number)) print "number =", self.number
# self.gdk_handle = gtk.gdk.window_foreign_new(int(self.number))
def get_geometry(self): def get_geometry(self):
try: try: