mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
debug-viewer: window: add helper to get visible range
Move this code to the window class, as multiple plugins are going to need it.
This commit is contained in:
parent
561c612472
commit
3b1e2833a3
2 changed files with 18 additions and 11 deletions
|
@ -640,6 +640,22 @@ class Window (object):
|
|||
self.pop_view_state()
|
||||
self.actions.show_hidden_lines.props.sensitive = True
|
||||
|
||||
def get_range(self):
|
||||
|
||||
view = self.log_view
|
||||
model = view.get_model()
|
||||
visible_range = view.get_visible_range()
|
||||
if visible_range is None:
|
||||
return None
|
||||
start_path, end_path = visible_range
|
||||
if not start_path or not end_path:
|
||||
return None
|
||||
ts1 = model.get_value(model.get_iter(start_path),
|
||||
model.COL_TIME)
|
||||
ts2 = model.get_value(model.get_iter(end_path),
|
||||
model.COL_TIME)
|
||||
return (ts1, ts2)
|
||||
|
||||
@action
|
||||
def handle_show_hidden_lines_action_activate(self, action):
|
||||
|
||||
|
|
|
@ -975,19 +975,10 @@ class AttachedWindow (object):
|
|||
|
||||
def update_timeline_position(self):
|
||||
|
||||
view = self.window.log_view
|
||||
model = view.get_model()
|
||||
visible_range = view.get_visible_range()
|
||||
visible_range = self.window.get_range()
|
||||
if visible_range is None:
|
||||
return
|
||||
start_path, end_path = visible_range
|
||||
if not start_path or not end_path:
|
||||
return
|
||||
ts1 = model.get_value(model.get_iter(start_path),
|
||||
model.COL_TIME)
|
||||
ts2 = model.get_value(model.get_iter(end_path),
|
||||
model.COL_TIME)
|
||||
|
||||
ts1, ts2 = visible_range
|
||||
self.timeline.update_position(ts1, ts2)
|
||||
|
||||
def handle_show_action_toggled(self, action):
|
||||
|
|
Loading…
Reference in a new issue