From a701c69dc0c0f291e8aae1bf89a5c1e3bf9661fa Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Wed, 6 Jul 2011 16:29:09 -0400 Subject: [PATCH] set window position based on configuration save window configuration on exit --- Window.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Window.py b/Window.py index cde4b2a..ec40a79 100755 --- a/Window.py +++ b/Window.py @@ -17,16 +17,28 @@ class Window(object): self.window.connect('button-release-event', self.button_release) self.window.set_events(gtk.gdk.BUTTON_RELEASE_MASK) + if 'x' in self.conf and 'y' in self.conf: + self.window.move(self.conf['x'], self.conf['y']) + self.window.show_all() def run(self): gtk.main() + def update_conf(self): + w, h = self.window.get_size() + self.conf['width'] = w + self.conf['height'] = h + x, y = self.window.get_position() + self.conf['x'] = x + self.conf['y'] = y + def destroy_event(self): + self.update_conf() gtk.main_quit() return False def button_release(self, widget, event): if event.button == 3: - gtk.main_quit() + self.destroy_event() return True