From 3f86c54b17b30c95d0f7154779037c79de8f15c9 Mon Sep 17 00:00:00 2001 From: eblade Date: Tue, 2 Dec 2008 10:14:38 -0500 Subject: [PATCH 1/3] add "NA" to fold to steal stats for 0/0's --- pyfpdb/Stats.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/pyfpdb/Stats.py b/pyfpdb/Stats.py index 5ca42fe8..db2ada2e 100644 --- a/pyfpdb/Stats.py +++ b/pyfpdb/Stats.py @@ -261,12 +261,11 @@ def f_SB_steal(stat_dict, player): ) except: return (stat, - '%3.1f' % (0) + '%', - 'fSB=%3.1f' % (0) + '%', - 'fSB_s=%3.1f' % (0) + '%', - '(%d/%d)' % (0, 0), - '% folded SB to steal' - ) + 'NA', + 'fSB=NA', + 'fSB_s=NA', + '0/0', + '% folded SB to steal') def f_BB_steal(stat_dict, player): """ Folded BB to steal.""" @@ -282,12 +281,11 @@ def f_BB_steal(stat_dict, player): ) except: return (stat, - '%3.1f' % (0) + '%', - 'fBB=%3.1f' % (0) + '%', - 'fBB_s=%3.1f' % (0) + '%', - '(%d/%d)' % (0, 0), - '% folded BB to steal' - ) + 'NA', + 'fBB=NA', + 'fBB_s=NA', + '0/0', + '% folded BB to steal') def three_B_0(stat_dict, player): """ Three bet preflop/3rd.""" From cd858d6ade8fe2d0e72d9eb3f0d1eedbadab1c7f Mon Sep 17 00:00:00 2001 From: eblade Date: Wed, 3 Dec 2008 03:25:49 -0500 Subject: [PATCH 2/3] add "debug stat windows" to hud menu .. doesn't do anything useful yet, as i'm trying to figure out what part to actually debug --- pyfpdb/Hud.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pyfpdb/Hud.py b/pyfpdb/Hud.py index 2960db30..3914f5ca 100644 --- a/pyfpdb/Hud.py +++ b/pyfpdb/Hud.py @@ -92,14 +92,22 @@ class Hud: self.menu.append(self.item1) self.item1.connect("activate", self.kill_hud) self.item1.show() + self.item2 = gtk.MenuItem('Save Layout') self.menu.append(self.item2) self.item2.connect("activate", self.save_layout) self.item2.show() + self.item3 = gtk.MenuItem('Reposition Stats') self.menu.append(self.item3) self.item3.connect("activate", self.reposition_windows) self.item3.show() + + self.item4 = gtk.MenuItem('Debug Stat Windows') + self.menu.append(self.item4) + self.item4.connect("activate", self.debug_stat_windows) + self.item4.show() + self.ebox.connect_object("button-press-event", self.on_button_press, self.menu) self.main_window.show_all() @@ -132,6 +140,12 @@ class Hud: for w in self.stat_windows: self.stat_windows[w].window.move(self.stat_windows[w].x, self.stat_windows[w].y) + + def debug_stat_windows(self, *args): + print self.table, "\n", self.main_window.window.get_transient_for() + for w in self.stat_windows: + print self.stat_windows[w].window.window.get_transient_for() + def save_layout(self, *args): new_layout = [(0, 0)] * self.max # todo: have the hud track the poker table's window position regularly, don't forget to update table.x and table.y. From 01861450653ce4fd9f1d1155b326270ea689e55d Mon Sep 17 00:00:00 2001 From: eblade Date: Wed, 3 Dec 2008 13:35:19 -0500 Subject: [PATCH 3/3] remove no-longer-needed "topify_window" for Stat_Window, removed some lines that were commented out due to no longer being needed, etc. Seems to fix the windows randomly re-attaching in Win32. --- pyfpdb/Hud.py | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/pyfpdb/Hud.py b/pyfpdb/Hud.py index 3914f5ca..80ec9a82 100644 --- a/pyfpdb/Hud.py +++ b/pyfpdb/Hud.py @@ -386,41 +386,12 @@ class Stat_Window: font = pango.FontDescription("Sans 7") self.label[r][c].modify_font(font) -# if not os.name == 'nt': # seems to be a bug in opacity on windows self.window.set_opacity(parent.colors['hudopacity']) -# self.window.realize() self.window.move(self.x, self.y) -# self.window.show_all() -# set_keep_above(1) for windows - if os.name == 'nt': self.topify_window(self.window) + self.window.hide() - def topify_window(self, window): - """Set the specified gtk window to stayontop in MS Windows.""" - - def windowEnumerationHandler(hwnd, resultList): - '''Callback for win32gui.EnumWindows() to generate list of window handles.''' - resultList.append((hwnd, win32gui.GetWindowText(hwnd))) - - unique_name = 'unique name for finding this window' - real_name = window.get_title() - window.set_title(unique_name) - tl_windows = [] - win32gui.EnumWindows(windowEnumerationHandler, tl_windows) - - for w in tl_windows: - if w[1] == unique_name: - - #win32gui.SetWindowPos(w[0], win32con.HWND_TOPMOST, 0, 0, 0, 0, win32con.SWP_NOMOVE|win32con.SWP_NOSIZE) - -# style = win32gui.GetWindowLong(w[0], win32con.GWL_EXSTYLE) -# style |= win32con.WS_EX_TOOLWINDOW -# style &= ~win32con.WS_EX_APPWINDOW -# win32gui.SetWindowLong(w[0], win32con.GWL_EXSTYLE, style) - win32gui.ShowWindow(w[0], win32con.SW_SHOW) - window.set_title(real_name) - def destroy(*args): # call back for terminating the main eventloop gtk.main_quit()