restore window position across invocations

This commit is contained in:
Josh Holtrop 2016-06-23 14:21:35 -04:00
parent 77963428f1
commit 5171536e18

View File

@ -38,13 +38,20 @@ class MainWindow(Gtk.Window):
self.connect("delete-event", self.__close) self.connect("delete-event", self.__close)
self.show_all() self.show_all()
if (self.cache_file["x"] is not None and
self.cache_file["y"] is not None):
self.move(self.cache_file["x"], self.cache_file["y"])
def run(self): def run(self):
Gtk.main() Gtk.main()
def __close(self, *more): def __close(self, *more):
size = self.get_size() size = self.get_size()
position = self.get_position()
self.cache_file["width"] = size[0] self.cache_file["width"] = size[0]
self.cache_file["height"] = size[1] self.cache_file["height"] = size[1]
self.cache_file["x"] = position[0]
self.cache_file["y"] = position[1]
self.cache_file.write() self.cache_file.write()
Gtk.main_quit() Gtk.main_quit()
return True return True