From d63b1d5410201bfc236c2dafbb83cb36219ab60d Mon Sep 17 00:00:00 2001 From: Stuart Langridge Date: Fri, 24 May 2019 15:41:27 +0100 Subject: Restore the zoom level on startup and set the dropdown to reflect that --- magnus/__main__.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/magnus/__main__.py b/magnus/__main__.py index 8f7b52f..1ae5d77 100644 --- a/magnus/__main__.py +++ b/magnus/__main__.py @@ -54,7 +54,8 @@ class Main(object): # the zoom chooser zoom = Gtk.ComboBoxText.new() - for i in range(2, 5): + self.zoom = zoom + for i in range(2, 6): zoom.append(str(i), "{}×".format(i)) zoom.set_active(0) zoom.connect("changed", self.set_zoom) @@ -219,7 +220,13 @@ class Main(object): data = json.loads(contents) zl = data.get("zoom") if zl: - self.zoomlevel = zl + idx = 0 + for row in self.zoom.get_model(): + text, lid = list(row) + if lid == str(zl): + self.zoom.set_active(idx) + self.zoomlevel = zl + idx += 1 metrics = data.get("metrics") if metrics: self.restore_window_metrics(metrics) -- cgit