fpdb_import: auto-import bases it's decisions to check files on file-size changes rather than mtime - could you guys check it out in nix and other poker sites, and tell me if that breaks anything?
HUD: if update() errors due to not enough stat windows being available (ie, your broken site converter tells us we have a 6 max table, but there are people in seats 7-10), it will re-assess the table as a 10-max add StatWindow.relocate(x,y)
This commit is contained in:
parent
0f10f87373
commit
2ecfbf6c2d
|
@ -160,7 +160,10 @@ class Hud:
|
||||||
# create the stat windows
|
# create the stat windows
|
||||||
for i in range(1, self.max + 1):
|
for i in range(1, self.max + 1):
|
||||||
(x, y) = loc[adj[i]]
|
(x, y) = loc[adj[i]]
|
||||||
self.stat_windows[i] = Stat_Window(game = config.supported_games[self.poker_game],
|
if self.stat_windows.has_key(i):
|
||||||
|
self.stat_windows[i].relocate(x, y)
|
||||||
|
else:
|
||||||
|
self.stat_windows[i] = Stat_Window(game = config.supported_games[self.poker_game],
|
||||||
parent = self,
|
parent = self,
|
||||||
table = self.table,
|
table = self.table,
|
||||||
x = x,
|
x = x,
|
||||||
|
@ -185,7 +188,13 @@ class Hud:
|
||||||
def update(self, hand, config, stat_dict):
|
def update(self, hand, config, stat_dict):
|
||||||
self.hand = hand # this is the last hand, so it is available later
|
self.hand = hand # this is the last hand, so it is available later
|
||||||
for s in stat_dict.keys():
|
for s in stat_dict.keys():
|
||||||
self.stat_windows[stat_dict[s]['seat']].player_id = stat_dict[s]['player_id']
|
try:
|
||||||
|
self.stat_windows[stat_dict[s]['seat']].player_id = stat_dict[s]['player_id']
|
||||||
|
except: # omg, we have more seats than stat windows .. damn poker sites with incorrect max seating info .. let's force 10 here
|
||||||
|
self.max = 10
|
||||||
|
self.create(hand, config)
|
||||||
|
self.stat_windows[stat_dict[s]['seat']].player_id = stat_dict[s]['player_id']
|
||||||
|
|
||||||
for r in range(0, config.supported_games[self.poker_game].rows):
|
for r in range(0, config.supported_games[self.poker_game].rows):
|
||||||
for c in range(0, config.supported_games[self.poker_game].cols):
|
for c in range(0, config.supported_games[self.poker_game].cols):
|
||||||
this_stat = config.supported_games[self.poker_game].stats[self.stats[r][c]]
|
this_stat = config.supported_games[self.poker_game].stats[self.stats[r][c]]
|
||||||
|
@ -284,6 +293,11 @@ class Stat_Window:
|
||||||
top.set_decorated(1)
|
top.set_decorated(1)
|
||||||
top.move(x, y)
|
top.move(x, y)
|
||||||
|
|
||||||
|
def relocate(self, x, y):
|
||||||
|
self.x = x + self.table.x
|
||||||
|
self.y = y + self.table.y
|
||||||
|
self.window.move(self.x, self.y)
|
||||||
|
|
||||||
def __init__(self, parent, game, table, seat, x, y, player_id, font):
|
def __init__(self, parent, game, table, seat, x, y, player_id, font):
|
||||||
self.parent = parent # Hud object that this stat window belongs to
|
self.parent = parent # Hud object that this stat window belongs to
|
||||||
self.game = game # Configuration object for the curren
|
self.game = game # Configuration object for the curren
|
||||||
|
|
|
@ -147,12 +147,13 @@ class Importer:
|
||||||
try:
|
try:
|
||||||
lastupdate = self.updated[file]
|
lastupdate = self.updated[file]
|
||||||
# print "Is " + str(stat_info.st_mtime) + " > " + str(lastupdate)
|
# print "Is " + str(stat_info.st_mtime) + " > " + str(lastupdate)
|
||||||
if stat_info.st_mtime > lastupdate:
|
#if stat_info.st_mtime > lastupdate:
|
||||||
|
if stat_info.st_size > lastupdate:
|
||||||
self.import_file_dict(file)
|
self.import_file_dict(file)
|
||||||
self.updated[file] = time()
|
self.updated[file] = stat_info.st_size
|
||||||
except:
|
except:
|
||||||
# print "Adding " + str(file) + " at approx " + str(time())
|
# print "Adding " + str(file) + " at approx " + str(time())
|
||||||
self.updated[file] = time()
|
self.updated[file] = 0
|
||||||
|
|
||||||
# This is now an internal function that should not be called directly.
|
# This is now an internal function that should not be called directly.
|
||||||
def import_file_dict(self, file):
|
def import_file_dict(self, file):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user