Merge branch 'master' of git://git.assembla.com/fpdb-eric

This commit is contained in:
Ray 2008-12-04 12:57:05 -05:00
commit 22111e6d3f
2 changed files with 25 additions and 42 deletions

View File

@ -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.
@ -372,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()

View File

@ -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."""