summaryrefslogtreecommitdiff
path: root/GstDebugViewer
diff options
context:
space:
mode:
authorRené Stadler <mail@renestadler.de>2011-11-05 23:52:40 +0100
committerRené Stadler <mail@renestadler.de>2011-11-06 00:02:36 +0100
commit32da7ebe7ee5b349070991b15ba3cc54c3b86b51 (patch)
treececee6e594c505d4948c652bf6fd6fafc8ce97b9 /GstDebugViewer
parent3e27cb4e0abde5433a212d47e9b44daf750e24dc (diff)
Refactor and fix zoom handling
ColumnManager has to apply the zoom factor to newly added columns. Otherwise, showing a previously hidden column appears with scale 1.0. This also drops the value-changed signal emission for the vadjustment, as it is apparently not needed.
Diffstat (limited to 'GstDebugViewer')
-rw-r--r--GstDebugViewer/GUI/columns.py15
-rw-r--r--GstDebugViewer/GUI/window.py27
2 files changed, 32 insertions, 10 deletions
diff --git a/GstDebugViewer/GUI/columns.py b/GstDebugViewer/GUI/columns.py
index 62df7f3..0579a41 100644
--- a/GstDebugViewer/GUI/columns.py
+++ b/GstDebugViewer/GUI/columns.py
@@ -377,6 +377,7 @@ class ColumnManager (Common.GUI.Manager):
self.view = None
self.actions = None
+ self.zoom = 1.0
self.__columns_changed_id = None
self.columns = []
self.column_order = list (self.column_classes)
@@ -450,6 +451,15 @@ class ColumnManager (Common.GUI.Manager):
sort_model.set_sort_column_id (TREE_SORTABLE_UNSORTED_COLUMN_ID,
gtk.SORT_ASCENDING)
+ def set_zoom (self, scale):
+
+ for column in self.columns:
+ cell = column.view_column.get_cell_renderers ()[0]
+ cell.props.scale = scale
+ column.view_column.queue_resize ()
+
+ self.zoom = scale
+
def get_toggle_action (self, column_class):
action_name = "show-%s-column" % (column_class.name,)
@@ -463,8 +473,13 @@ class ColumnManager (Common.GUI.Manager):
name = column.name
pos = self.__get_column_insert_position (column)
+
if self.view.props.fixed_height_mode:
column.view_column.props.sizing = gtk.TREE_VIEW_COLUMN_FIXED
+
+ cell = column.view_column.get_cell_renderers ()[0]
+ cell.props.scale = self.zoom
+
self.columns.insert (pos, column)
self.view.insert_column (column.view_column, pos)
diff --git a/GstDebugViewer/GUI/window.py b/GstDebugViewer/GUI/window.py
index ee3437d..411c155 100644
--- a/GstDebugViewer/GUI/window.py
+++ b/GstDebugViewer/GUI/window.py
@@ -19,6 +19,8 @@
"""GStreamer Debug Viewer GUI module."""
+ZOOM_FACTOR = 1.15
+
def _ (s):
return s
@@ -286,6 +288,7 @@ class Window (object):
def attach (self):
+ self.zoom_level = 0
self.window_state.attach (window = self.gtk_window,
state = self.app.state_section)
@@ -577,18 +580,22 @@ class Window (object):
self.clipboard.set_text (self.get_active_line ()[col_id])
def handle_enlarge_text_action_activate (self, action):
- for col in self.column_manager.columns:
- cell = col.view_column.get_cell_renderers ()[0]
- cell.props.scale *= 1.15
- col.view_column.queue_resize ()
- self.widgets.log_view_scrolled_window.props.vadjustment.emit ("value-changed")
+
+ self.update_zoom_level (1)
def handle_shrink_text_action_activate (self, action):
- for col in self.column_manager.columns:
- cell = col.view_column.get_cell_renderers ()[0]
- cell.props.scale /= 1.15
- col.view_column.queue_resize ()
- self.widgets.log_view_scrolled_window.props.vadjustment.emit ("value-changed")
+
+ self.update_zoom_level (-1)
+
+ def update_zoom_level (self, delta_step):
+
+ if not delta_step:
+ return
+
+ self.zoom_level += delta_step
+ scale = ZOOM_FACTOR ** self.zoom_level
+
+ self.column_manager.set_zoom (scale)
def add_model_filter (self, filter):