diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py
index 8c7bee56..63de54b2 100644
--- a/pyfpdb/Database.py
+++ b/pyfpdb/Database.py
@@ -106,6 +106,12 @@ class Database:
c.execute(self.sql.query['get_hand_info'], new_hand_id)
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):
# this version is for the PTrackSv2 db
# c = self.connection.cursor()
diff --git a/pyfpdb/HUD_config.xml.example b/pyfpdb/HUD_config.xml.example
index 423787c5..f5312c99 100644
--- a/pyfpdb/HUD_config.xml.example
+++ b/pyfpdb/HUD_config.xml.example
@@ -135,6 +135,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pyfpdb/HUD_main.py b/pyfpdb/HUD_main.py
index 33bdc890..1d3fc299 100755
--- a/pyfpdb/HUD_main.py
+++ b/pyfpdb/HUD_main.py
@@ -94,14 +94,12 @@ def check_stdin(db_name):
process_new_hand(hand_no, db_name)
except:
pass
-
return True
def read_stdin(source, condition, db_name):
new_hand_id = sys.stdin.readline()
if new_hand_id == "":
destroy()
- print "new_hand_id = ", new_hand_id
process_new_hand(new_hand_id, db_name)
return True
diff --git a/pyfpdb/Hud.py b/pyfpdb/Hud.py
index 9c52dc26..003e0be1 100644
--- a/pyfpdb/Hud.py
+++ b/pyfpdb/Hud.py
@@ -109,14 +109,35 @@ class Hud:
self.config.edit_layout(self.table.site, self.max, locations = new_layout)
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):
# 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
#
# this method also manages the creating and destruction of stat
# 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):
- (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],
parent = self,
table = self.table,
diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py
index 91ebd05b..9bc125f6 100644
--- a/pyfpdb/SQL.py
+++ b/pyfpdb/SQL.py
@@ -257,6 +257,14 @@ class Sql:
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'] = """
select
seatNo AS seat_number,
diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py
index db15ed54..786aea59 100755
--- a/pyfpdb/fpdb_import.py
+++ b/pyfpdb/fpdb_import.py
@@ -48,6 +48,7 @@ class Importer:
self.options = None
self.callHud = False
self.lines = None
+ self.pos_in_file = {} # dict to remember how far we have read in the file
def dbConnect(self, options, settings):
#connect to DB
@@ -74,15 +75,20 @@ class Importer:
self.options=options
starttime = time()
last_read_hand=0
+ loc = 0
if (options.inputFile=="stdin"):
inputFile=sys.stdin
else:
inputFile=open(options.inputFile, "rU")
+ try: loc = self.pos_in_file[options.inputFile]
+ except: pass
self.dbConnect(options,settings)
# Read input file into class and close file
+ inputFile.seek(loc)
self.lines=fpdb_simple.removeTrailingEOL(inputFile.readlines())
+ self.pos_in_file[options.inputFile] = inputFile.tell()
inputFile.close()
firstline = self.lines[0]