Skip to content
Snippets Groups Projects
Commit 3b1e2833 authored by Stefan Sauer's avatar Stefan Sauer
Browse files

debug-viewer: window: add helper to get visible range

Move this code to the window class, as multiple plugins are going to need it.
parent 561c6124
No related branches found
No related tags found
No related merge requests found
......@@ -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):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment