set window position based on configuration
save window configuration on exit
This commit is contained in:
parent
e74b3620ca
commit
a701c69dc0
14
Window.py
14
Window.py
@ -17,16 +17,28 @@ class Window(object):
|
|||||||
self.window.connect('button-release-event', self.button_release)
|
self.window.connect('button-release-event', self.button_release)
|
||||||
self.window.set_events(gtk.gdk.BUTTON_RELEASE_MASK)
|
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()
|
self.window.show_all()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
gtk.main()
|
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):
|
def destroy_event(self):
|
||||||
|
self.update_conf()
|
||||||
gtk.main_quit()
|
gtk.main_quit()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def button_release(self, widget, event):
|
def button_release(self, widget, event):
|
||||||
if event.button == 3:
|
if event.button == 3:
|
||||||
gtk.main_quit()
|
self.destroy_event()
|
||||||
return True
|
return True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user