Integrate new table handling code.
This commit is contained in:
parent
2d890be3c8
commit
99e4211e5d
|
@ -53,7 +53,12 @@ import gobject
|
|||
# FreePokerTools modules
|
||||
import Configuration
|
||||
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
|
||||
|
||||
|
||||
|
@ -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: gets called. If there is an exception and threads_leave() doesn't get called we
|
||||
# TODO: lock up. REB
|
||||
table.gdkhandle = gtk.gdk.window_foreign_new(table.number)
|
||||
newlabel = gtk.Label("%s - %s" % (table.site, table_name))
|
||||
self.vb.add(newlabel)
|
||||
newlabel.show()
|
||||
|
@ -210,7 +216,7 @@ class HUD_main(object):
|
|||
# get basic info about the new hand from the db
|
||||
# if there is a db error, complain, skip hand, and proceed
|
||||
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)
|
||||
except Exception, err:
|
||||
print "db error: skipping %s" % new_hand_id
|
||||
|
@ -248,15 +254,17 @@ class HUD_main(object):
|
|||
cards['common'] = comm_cards['common']
|
||||
|
||||
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:
|
||||
tablewindow = Tables.discover_table_by_name(self.config, table_name)
|
||||
tablewindow = Tables.Table(table_name = table_name)
|
||||
if tablewindow 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)
|
||||
sys.stderr.write("HUD create: table name "+table_name+" not found, skipping.\n")
|
||||
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.db_connection.connection.rollback()
|
||||
|
||||
|
|
|
@ -1605,11 +1605,11 @@ class Sql:
|
|||
"""
|
||||
|
||||
self.query['get_table_name'] = """
|
||||
select h.tableName, h.maxSeats, gt.category, gt.type, gt.siteId
|
||||
from Hands h
|
||||
,Gametypes gt
|
||||
where h.id = %s
|
||||
and gt.id = h.gametypeId
|
||||
SELECT h.tableName, h.maxSeats, gt.category, gt.type, s.id, s.name
|
||||
FROM Hands h, Gametypes gt, Sites s
|
||||
WHERE h.id = %s
|
||||
AND gt.id = h.gametypeId
|
||||
AND s.id = gt.siteID
|
||||
"""
|
||||
|
||||
self.query['get_actual_seat'] = """
|
||||
|
|
|
@ -113,12 +113,12 @@ class Table_Window(object):
|
|||
|
||||
def __str__(self):
|
||||
# __str__ method for testing
|
||||
likely_attrs = ("site", "number", "title", "width", "height", "x", "y",
|
||||
"tournament", "table", "gdkhandle")
|
||||
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)
|
||||
# temp = temp + " game = %s\n structure = %s\n max = %s\n" % (self.game, self.structure, self.max)
|
||||
temp = temp + " width = %d\n height = %d\n x = %d\n y = %d\n" % (self.width, self.height, self.x, self.y)
|
||||
if getattr(self, 'tournament', 0):
|
||||
temp = temp + " tournament = %d\n table = %d" % (self.tournament, self.table)
|
||||
for a in likely_attrs:
|
||||
if getattr(self, a, 0):
|
||||
temp += " %s = %s\n" % (a, getattr(self, a))
|
||||
return temp
|
||||
|
||||
def get_game(self):
|
||||
|
|
0
pyfpdb/Tables_Demo.py
Normal file → Executable file
0
pyfpdb/Tables_Demo.py
Normal file → Executable file
|
@ -79,7 +79,8 @@ class Table(Table_Window):
|
|||
self.gdk_handle = None
|
||||
else:
|
||||
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):
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue
Block a user