diff options
author | René Stadler <mail@renestadler.de> | 2011-11-05 23:47:47 +0100 |
---|---|---|
committer | René Stadler <mail@renestadler.de> | 2011-11-06 00:20:00 +0100 |
commit | a43b9f27f517219301433e4d36e5034810110b4d (patch) | |
tree | ded03d05837713b533c5e1931fbee0a9f0d1ba5c /GstDebugViewer | |
parent | 9ab7b513f4662c6df6fa5327b2f9d130b5382280 (diff) |
Store zoom level in state
Diffstat (limited to 'GstDebugViewer')
-rw-r--r-- | GstDebugViewer/GUI/app.py | 2 | ||||
-rw-r--r-- | GstDebugViewer/GUI/window.py | 14 |
2 files changed, 16 insertions, 0 deletions
diff --git a/GstDebugViewer/GUI/app.py b/GstDebugViewer/GUI/app.py index de17305..da51149 100644 --- a/GstDebugViewer/GUI/app.py +++ b/GstDebugViewer/GUI/app.py @@ -38,6 +38,8 @@ class AppStateSection (Common.GUI.StateSection): column_order = Common.GUI.StateItemList ("column-order", ViewColumnManager) columns_visible = Common.GUI.StateItemList ("columns-visible", ViewColumnManager) + zoom_level = Common.GUI.StateInt ("zoom-level") + class AppState (Common.GUI.State): def __init__ (self, *a, **kw): diff --git a/GstDebugViewer/GUI/window.py b/GstDebugViewer/GUI/window.py index 832526e..6372492 100644 --- a/GstDebugViewer/GUI/window.py +++ b/GstDebugViewer/GUI/window.py @@ -290,6 +290,10 @@ class Window (object): def attach (self): self.zoom_level = 0 + zoom_percent = self.app.state_section.zoom_level + if zoom_percent: + self.restore_zoom (float (zoom_percent) / 100.) + self.window_state.attach (window = self.gtk_window, state = self.app.state_section) @@ -593,6 +597,14 @@ class Window (object): self.update_zoom_level (-self.zoom_level) + def restore_zoom (self, scale): + + from math import log + + self.zoom_level = int (round (log (scale) / log (ZOOM_FACTOR))) + + self.column_manager.set_zoom (scale) + def update_zoom_level (self, delta_step): if not delta_step: @@ -603,6 +615,8 @@ class Window (object): self.column_manager.set_zoom (scale) + self.app.state_section.zoom_level = int (round (scale * 100.)) + def add_model_filter (self, filter): self.progress_dialog = ProgressDialog (self, _("Filtering")) |