set window position based on configuration

save window configuration on exit
This commit is contained in:
Josh Holtrop 2011-07-06 16:29:09 -04:00
parent e74b3620ca
commit a701c69dc0

View File

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