mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 10:10:32 +00:00
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.
This commit is contained in:
parent
4e334e0e00
commit
b866669ae1
2 changed files with 32 additions and 10 deletions
|
@ -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)
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
||||
|
|
Loading…
Reference in a new issue