From e880fb89546f9cbb2f36e519ee445fc843fedeb8 Mon Sep 17 00:00:00 2001 From: eblade Date: Thu, 2 Apr 2009 05:02:24 -0400 Subject: [PATCH 1/6] add a giant tooltip temporarily to the popup stats window --- pyfpdb/Hud.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pyfpdb/Hud.py b/pyfpdb/Hud.py index cf96893f..122e94a9 100644 --- a/pyfpdb/Hud.py +++ b/pyfpdb/Hud.py @@ -529,11 +529,15 @@ class Popup_window: # db_connection.close_connection() stat_dict = stat_window.parent.stat_dict pu_text = "" + mo_text = "" for s in stat_list: number = Stats.do_stat(stat_dict, player = int(stat_window.player_id), stat = s) + mo_text += number[5] + " " + number[4] + "\n" pu_text += number[3] + "\n" + - self.lab.set_text(pu_text) + self.lab.set_text(pu_text) + Stats.do_tip(self.lab, mo_text) self.window.show_all() self.window.set_transient_for(stat_window.window) From f1230c459c77aeed94442e5c5b88d692774b151a Mon Sep 17 00:00:00 2001 From: eblade Date: Sat, 30 May 2009 12:02:31 -0400 Subject: [PATCH 2/6] Apparently I made a comment and a change that I didn't realise before 0.11, and forgot to commit. oopsie. --- pyfpdb/Hud.py | 1 + pyfpdb/Tables.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/pyfpdb/Hud.py b/pyfpdb/Hud.py index 87cf9f14..8360dc20 100644 --- a/pyfpdb/Hud.py +++ b/pyfpdb/Hud.py @@ -473,6 +473,7 @@ class Popup_window: def __init__(self, parent, stat_window): self.sb_click = 0 self.stat_window = stat_window + self.parent = parent # create the popup window self.window = gtk.Window() diff --git a/pyfpdb/Tables.py b/pyfpdb/Tables.py index ffc50b01..7bc22710 100755 --- a/pyfpdb/Tables.py +++ b/pyfpdb/Tables.py @@ -309,6 +309,10 @@ def get_site_from_exe(c, exe): return params['site_name'] return None +def everleaf_decode_table(tw): +# 2 - Tournament ID: 573256 - NL Hold'em - 150/300 blinds - Good luck ! - [Connection is ...] + pass + def pokerstars_decode_table(tw): # Extract poker information from the window title. This is not needed for # fpdb, since all that information is available in the db via new_hand_number. From 6e63e2a5e945db4f2f49c2a8ac85840813d5bdac Mon Sep 17 00:00:00 2001 From: eblade Date: Wed, 10 Jun 2009 12:58:14 -0400 Subject: [PATCH 3/6] fix some junk related to determining window height/width, b_width and tb_height, comment out the window_foreign_new() that's screwing up the window right now --- pyfpdb/Tables_Demo.py | 2 ++ pyfpdb/WinTables.py | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/pyfpdb/Tables_Demo.py b/pyfpdb/Tables_Demo.py index ffc8d412..e141cab1 100644 --- a/pyfpdb/Tables_Demo.py +++ b/pyfpdb/Tables_Demo.py @@ -92,6 +92,8 @@ if __name__=="__main__": print "game =", table.get_game() fake = fake_hud(table) + print "fake =", fake gobject.timeout_add(100, check_on_table, table, fake) + print "calling main" gtk.main() diff --git a/pyfpdb/WinTables.py b/pyfpdb/WinTables.py index b867b83d..cb449a52 100644 --- a/pyfpdb/WinTables.py +++ b/pyfpdb/WinTables.py @@ -65,8 +65,11 @@ class Table(Table_Window): print "x = %s y = %s width = %s height = %s" % (x, y, width, height) self.x = int(x) + b_width self.y = int(y) + tb_height - self.height = int(height) - b_width - tb_height - self.width = int(width) - 2*b_width + self.width = width - x + self.height = height - y + print "x = %s y = %s width = %s height = %s" % (self.x, self.y, self.width, self.height) + #self.height = int(height) - b_width - tb_height + #self.width = int(width) - 2*b_width self.exe = self.get_nt_exe(hwnd) self.title = titles[hwnd] @@ -82,6 +85,8 @@ class Table(Table_Window): try: (x, y, width, height) = win32gui.GetWindowRect(hwnd) + width = width - x + height = height - y return {'x' : int(x) + b_width, 'y' : int(y) + tb_height, 'width' : int(height) - b_width - tb_height, @@ -128,8 +133,12 @@ class Table(Table_Window): for w in tl_windows: if w[1] == unique_name: - hud.main_window.gdkhandle = gtk.gdk.window_foreign_new(w[0]) - hud.main_window.gdkhandle.set_transient_for(self.gdkhandle) +# hud.main_window.gdkhandle = gtk.gdk.window_foreign_new(w[0]) +# hud.main_window.gdkhandle.set_transient_for(self.gdkhandle) + rect = self.gdkhandle.get_frame_extents() + (innerx, innery) = self.gdkhandle.get_origin() + b_width = rect.x - innerx + tb_height = rect.y - innery # # style = win32gui.GetWindowLong(self.number, win32con.GWL_EXSTYLE) # style |= win32con.WS_CLIPCHILDREN From eb37de359477c092098660cb0fe439c5f9797746 Mon Sep 17 00:00:00 2001 From: eblade Date: Wed, 10 Jun 2009 13:47:07 -0400 Subject: [PATCH 4/6] fix get_geometry to use the correct parameters to IsWindow and GetWindowRect (too much error trapping will create pitfalls), use main_window.window instead of window_foreign_new() to get gdkhandle for gtkwindow, remove process enumeration in topify() for windows --- pyfpdb/WinTables.py | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/pyfpdb/WinTables.py b/pyfpdb/WinTables.py index cb449a52..d8f138eb 100644 --- a/pyfpdb/WinTables.py +++ b/pyfpdb/WinTables.py @@ -79,12 +79,11 @@ class Table(Table_Window): self.gdkhandle = gtk.gdk.window_foreign_new(long(self.window)) def get_geometry(self): - - if not win32gui.IsWindow(self.window): # window closed + if not win32gui.IsWindow(self.number): # window closed return None try: - (x, y, width, height) = win32gui.GetWindowRect(hwnd) + (x, y, width, height) = win32gui.GetWindowRect(self.number) width = width - x height = height - y return {'x' : int(x) + b_width, @@ -121,31 +120,32 @@ class Table(Table_Window): def topify(self, hud): """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 = hud.main_window.get_title() - hud.main_window.set_title(unique_name) - tl_windows = [] - win32gui.EnumWindows(windowEnumerationHandler, tl_windows) - - for w in tl_windows: - if w[1] == unique_name: +# 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 = hud.main_window.get_title() +# hud.main_window.set_title(unique_name) +# tl_windows = [] +# win32gui.EnumWindows(windowEnumerationHandler, tl_windows) +# +# for w in tl_windows: +# if w[1] == unique_name: # hud.main_window.gdkhandle = gtk.gdk.window_foreign_new(w[0]) -# hud.main_window.gdkhandle.set_transient_for(self.gdkhandle) - rect = self.gdkhandle.get_frame_extents() - (innerx, innery) = self.gdkhandle.get_origin() - b_width = rect.x - innerx - tb_height = rect.y - innery + hud.main_window.gdkhandle = hud.main_window.window + hud.main_window.gdkhandle.set_transient_for(self.gdkhandle) + rect = self.gdkhandle.get_frame_extents() + (innerx, innery) = self.gdkhandle.get_origin() + b_width = rect.x - innerx + tb_height = rect.y - innery # # style = win32gui.GetWindowLong(self.number, win32con.GWL_EXSTYLE) # style |= win32con.WS_CLIPCHILDREN # win32gui.SetWindowLong(self.number, win32con.GWL_EXSTYLE, style) - break +# break - hud.main_window.set_title(real_name) +# hud.main_window.set_title(real_name) def win_enum_handler(hwnd, titles): titles[hwnd] = win32gui.GetWindowText(hwnd) From c63e0ab46165b6991b44691dad2e500a627de2bf Mon Sep 17 00:00:00 2001 From: eblade Date: Wed, 10 Jun 2009 14:11:20 -0400 Subject: [PATCH 5/6] Q&D change for old Hud code to remove the loop from one topify_window(), as we found out how to get it when working on the new Hud stuff --- pyfpdb/Hud.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/pyfpdb/Hud.py b/pyfpdb/Hud.py index 5ff2c9d7..73f1f82c 100644 --- a/pyfpdb/Hud.py +++ b/pyfpdb/Hud.py @@ -339,30 +339,30 @@ class Hud: Stats.do_tip(window.e_box[r][c], tip) 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: +# """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: self.main_window.parentgdkhandle = gtk.gdk.window_foreign_new(long(self.table.number)) - self.main_window.gdkhandle = gtk.gdk.window_foreign_new(w[0]) +# self.main_window.gdkhandle = gtk.gdk.window_foreign_new(w[0]) + self.main_window.gdkhandle = self.main_window.window self.main_window.gdkhandle.set_transient_for(self.main_window.parentgdkhandle) style = win32gui.GetWindowLong(self.table.number, win32con.GWL_EXSTYLE) style |= win32con.WS_CLIPCHILDREN win32gui.SetWindowLong(self.table.number, win32con.GWL_EXSTYLE, style) - break +# break - window.set_title(real_name) +# window.set_title(real_name) class Stat_Window: From 93172a1a03330fc1b4d03f6d9ae3f025f806d15a Mon Sep 17 00:00:00 2001 From: eblade Date: Fri, 12 Jun 2009 02:30:14 -0400 Subject: [PATCH 6/6] remove the loop from the other topify function (doesn't look like we've needed that in there in months.. oops) --- pyfpdb/Hud.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/pyfpdb/Hud.py b/pyfpdb/Hud.py index 73f1f82c..d7f26304 100644 --- a/pyfpdb/Hud.py +++ b/pyfpdb/Hud.py @@ -577,25 +577,25 @@ class Popup_window: 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))) +# 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) +# 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: - window.set_transient_for(self.parent.main_window) - style = win32gui.GetWindowLong(self.table.number, win32con.GWL_EXSTYLE) - style |= win32con.WS_CLIPCHILDREN - win32gui.SetWindowLong(self.table.number, win32con.GWL_EXSTYLE, style) - break +# for w in tl_windows: +# if w[1] == unique_name: + window.set_transient_for(self.parent.main_window) + style = win32gui.GetWindowLong(self.table.number, win32con.GWL_EXSTYLE) + style |= win32con.WS_CLIPCHILDREN + win32gui.SetWindowLong(self.table.number, win32con.GWL_EXSTYLE, style) +# break - window.set_title(real_name) +# window.set_title(real_name) if __name__== "__main__": main_window = gtk.Window()