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

This commit is contained in:
Worros 2008-12-09 23:49:25 +09:00
commit 7b05adea80
2 changed files with 23 additions and 6 deletions

View File

@ -120,6 +120,19 @@ class Hud:
self.main_window.gdkhandle.set_transient_for(self.main_window.parentgdkhandle) #
self.main_window.set_destroy_with_parent(True)
def update_table_position(self):
(x, y) = self.main_window.parentgdkhandle.get_origin()
if self.table.x != x or self.table.y != y:
self.table.x = x
self.table.y = y
self.main_window.move(x, y)
adj = self.adj_seats(self.hand, self.config)
loc = self.config.get_locations(self.table.site, self.max)
for i in range(1, self.max + 1):
(x, y) = loc[adj[i]]
if self.stat_windows.has_key(i):
self.stat_windows[i].relocate(x, y)
def on_button_press(self, widget, event):
if event.button == 1:
@ -137,9 +150,7 @@ class Hud:
self.deleted = True
def reposition_windows(self, *args):
for w in self.stat_windows:
self.stat_windows[w].window.move(self.stat_windows[w].x,
self.stat_windows[w].y)
self.update_table_position()
def debug_stat_windows(self, *args):
print self.table, "\n", self.main_window.window.get_transient_for()
@ -213,9 +224,12 @@ class Hud:
if not game_params['aux'] == "":
aux_params = config.get_aux_parameters(game_params['aux'])
self.aux_windows.append(eval("%s.%s(gtk.Window(), config, 'fpdb')" % (aux_params['module'], aux_params['class'])))
gobject.timeout_add(0.5, self.update_table_position)
def update(self, hand, config, stat_dict):
self.hand = hand # this is the last hand, so it is available later
self.update_table_position()
for s in stat_dict.keys():
try:
self.stat_windows[stat_dict[s]['seat']].player_id = stat_dict[s]['player_id']
@ -260,9 +274,9 @@ class Hud:
for w in tl_windows:
if w[1] == unique_name:
#win32gui.ShowWindow(w[0], win32con.SW_HIDE)
window.parentgdkhandle = gtk.gdk.window_foreign_new(long(self.table.number))
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.set_transient_for(window.parentgdkhandle)
self.main_window.gdkhandle.set_transient_for(self.main_window.parentgdkhandle)
#win32gui.ShowWindow(w[0], win32con.SW_SHOW)
style = win32gui.GetWindowLong(self.table.number, win32con.GWL_EXSTYLE)
@ -307,6 +321,7 @@ class Stat_Window:
pass
if event.button == 1: # left button event
# TODO: make position saving save sizes as well?
if event.state & gtk.gdk.SHIFT_MASK:
self.window.begin_resize_drag(gtk.gdk.WINDOW_EDGE_SOUTH_EAST, event.button, int(event.x_root), int(event.y_root), event.time)
else:

View File

@ -248,7 +248,9 @@ def get_nt_exe(hwnd):
"""Finds the name of the executable that the given window handle belongs to."""
processid = win32process.GetWindowThreadProcessId(hwnd)
pshandle = win32api.OpenProcess(win32con.PROCESS_QUERY_INFORMATION | win32con.PROCESS_VM_READ, False, processid[1])
return win32process.GetModuleFileNameEx(pshandle, 0)
exename = win32process.GetModuleFileNameEx(pshandle, 0)
win32api.CloseHandle(pshandle)
return exename
def decode_windows(c, title, hwnd):
"""Gets window parameters from the window title and handle--Windows."""