aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Langridge <sil@kryogenix.org>2019-05-24 15:41:27 +0100
committerStuart Langridge <sil@kryogenix.org>2019-05-24 15:41:27 +0100
commitd63b1d5410201bfc236c2dafbb83cb36219ab60d (patch)
tree7064fc3031844e39be2eff9c2030f4c5fea7a9f4
parentDraw chequerboard pattern on the window if you try to magnify itself, just so... (diff)
downloadmagnus-d63b1d5410201bfc236c2dafbb83cb36219ab60d.tar.gz
magnus-d63b1d5410201bfc236c2dafbb83cb36219ab60d.tar.bz2
magnus-d63b1d5410201bfc236c2dafbb83cb36219ab60d.zip
Restore the zoom level on startup and set the dropdown to reflect that
-rw-r--r--magnus/__main__.py11
1 files 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)
bgstack15