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

This commit is contained in:
Worros 2008-10-10 19:37:37 +08:00
commit 8b22981ac6
4 changed files with 36 additions and 3 deletions

View File

@ -106,6 +106,12 @@ class Database:
c.execute(self.sql.query['get_hand_info'], new_hand_id) c.execute(self.sql.query['get_hand_info'], new_hand_id)
return c.fetchall() return c.fetchall()
def get_actual_seat(self, hand_id, name):
c = self.connection.cursor()
c.execute(self.sql.query['get_actual_seat'], (hand_id, name))
row = c.fetchone()
return row[0]
# def get_cards(self, hand): # def get_cards(self, hand):
# this version is for the PTrackSv2 db # this version is for the PTrackSv2 db
# c = self.connection.cursor() # c = self.connection.cursor()

View File

@ -94,14 +94,12 @@ def check_stdin(db_name):
process_new_hand(hand_no, db_name) process_new_hand(hand_no, db_name)
except: except:
pass pass
return True return True
def read_stdin(source, condition, db_name): def read_stdin(source, condition, db_name):
new_hand_id = sys.stdin.readline() new_hand_id = sys.stdin.readline()
if new_hand_id == "": if new_hand_id == "":
destroy() destroy()
print "new_hand_id = ", new_hand_id
process_new_hand(new_hand_id, db_name) process_new_hand(new_hand_id, db_name)
return True return True

View File

@ -109,14 +109,35 @@ class Hud:
self.config.edit_layout(self.table.site, self.max, locations = new_layout) self.config.edit_layout(self.table.site, self.max, locations = new_layout)
self.config.save() self.config.save()
def adj_seats(self, hand, config):
adj = range(0, self.max + 1) # default seat adjustments = no adjustment
# does the user have a fav_seat?
try:
if int(config.supported_sites[self.table.site].layout[self.max].fav_seat) > 0:
fav_seat = config.supported_sites[self.table.site].layout[self.max].fav_seat
db_connection = Database.Database(config, self.db_name, 'temp')
actual_seat = db_connection.get_actual_seat(hand, config.supported_sites[self.table.site].screen_name)
db_connection.close_connection()
for i in range(0, self.max + 1):
j = actual_seat + i
if j > self.max: j = j - self.max
adj[j] = fav_seat + i
if adj[j] > self.max: adj[j] = adj[j] - self.max
except:
pass
return adj
def create(self, hand, config): def create(self, hand, config):
# update this hud, to the stats and players as of "hand" # update this hud, to the stats and players as of "hand"
# hand is the hand id of the most recent hand played at this table # hand is the hand id of the most recent hand played at this table
# #
# this method also manages the creating and destruction of stat # this method also manages the creating and destruction of stat
# windows via calls to the Stat_Window class # windows via calls to the Stat_Window class
adj = self.adj_seats(hand, config)
# create the stat windows
for i in range(1, self.max + 1): for i in range(1, self.max + 1):
(x, y) = config.supported_sites[self.table.site].layout[self.max].location[i] (x, y) = config.supported_sites[self.table.site].layout[self.max].location[adj[i]]
self.stat_windows[i] = Stat_Window(game = config.supported_games[self.poker_game], self.stat_windows[i] = Stat_Window(game = config.supported_games[self.poker_game],
parent = self, parent = self,
table = self.table, table = self.table,

View File

@ -257,6 +257,14 @@ class Sql:
and Gametypes.id = Hands.gametypeId and Gametypes.id = Hands.gametypeId
""" """
self.query['get_actual_seat'] = """
select seatNo
from HandsPlayers
where HandsPlayers.handId = %s
and HandsPlayers.playerId = (select Players.id from Players
where Players.name = %s)
"""
self.query['get_cards'] = """ self.query['get_cards'] = """
select select
seatNo AS seat_number, seatNo AS seat_number,