From 2074d755aacca9b2d5d5950a5c4f1e12f8dcb756 Mon Sep 17 00:00:00 2001 From: eblade Date: Mon, 10 Nov 2008 05:58:55 -0500 Subject: [PATCH] Hud.py: fix typos in definitions of reposition_windows and kill_hud, eliminating errors when those functions are called move pop-up window to button 3 when clicked on a stat window, added move/resize functionality to button 1 (hold shift to resize, or just click/drag to move) restore opacity in windows (new window movement works with opacity set) fix error in popup_window initilization referring to window instead of main_window, oops --- pyfpdb/Hud.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/pyfpdb/Hud.py b/pyfpdb/Hud.py index 2490ad91..bee81aaf 100644 --- a/pyfpdb/Hud.py +++ b/pyfpdb/Hud.py @@ -116,13 +116,13 @@ class Hud: return True return False - def kill_hud(self, args): + def kill_hud(self, *args): for k in self.stat_windows.keys(): self.stat_windows[k].window.destroy() self.main_window.destroy() self.deleted = True - def reposition_windows(self, args): + 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) @@ -259,7 +259,8 @@ class Stat_Window: # This handles all callbacks from button presses on the event boxes in # the stat windows. There is a bit of an ugly kludge to separate single- # and double-clicks. - if event.button == 1: # left button event + + if event.button == 3: # right button event if event.type == gtk.gdk.BUTTON_PRESS: # left button single click if self.sb_click > 0: return self.sb_click = gobject.timeout_add(250, self.single_click, widget) @@ -270,12 +271,14 @@ class Stat_Window: self.double_click(widget, event, *args) if event.button == 2: # middle button event - pass # print "middle button clicked" - - if event.button == 3: # right button event pass -# print "right button clicked" + + if event.button == 1: # left button event + 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: + self.window.begin_move_drag(event.button, int(event.x_root), int(event.y_root), event.time) def single_click(self, widget): # Callback from the timeout in the single-click finding part of the @@ -349,8 +352,9 @@ class Stat_Window: # font = pango.FontDescription("Sans 8") 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']) +# 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() @@ -457,7 +461,7 @@ class Popup_window: self.lab.set_text(pu_text) self.window.show_all() - self.window.set_transient_for(stat_window.main_window) + self.window.set_transient_for(stat_window.window) # set_keep_above(1) for windows if os.name == 'nt': self.topify_window(self.window)