mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
Unify two very similar methods
This commit is contained in:
parent
2fa90648aa
commit
e47a5a70d4
1 changed files with 22 additions and 27 deletions
|
@ -1782,41 +1782,36 @@ class Window (object):
|
||||||
|
|
||||||
def handle_hide_after_line_action_activate (self, action):
|
def handle_hide_after_line_action_activate (self, action):
|
||||||
|
|
||||||
model = self.log_view.props.model
|
self.hide_range (after = True)
|
||||||
first_index = model.line_index_to_top (0)
|
|
||||||
try:
|
|
||||||
filtered_line_index = self.get_active_line_index ()
|
|
||||||
except ValueError:
|
|
||||||
return
|
|
||||||
last_index = model.line_index_to_top (filtered_line_index)
|
|
||||||
|
|
||||||
self.logger.info ("hiding lines after %i (abs %i), first line is abs %i",
|
|
||||||
filtered_line_index,
|
|
||||||
last_index,
|
|
||||||
first_index)
|
|
||||||
|
|
||||||
self.push_view_state ()
|
|
||||||
self.log_range.set_range (first_index, last_index)
|
|
||||||
if self.log_filter:
|
|
||||||
self.log_filter.super_model_changed_range ()
|
|
||||||
self.update_model ()
|
|
||||||
self.pop_view_state ()
|
|
||||||
self.actions.show_hidden_lines.props.sensitive = True
|
|
||||||
|
|
||||||
def handle_hide_before_line_action_activate (self, action):
|
def handle_hide_before_line_action_activate (self, action):
|
||||||
|
|
||||||
|
self.hide_range (after = False)
|
||||||
|
|
||||||
|
def hide_range (self, after):
|
||||||
|
|
||||||
|
model = self.log_view.props.model
|
||||||
try:
|
try:
|
||||||
filtered_line_index = self.get_active_line_index ()
|
filtered_line_index = self.get_active_line_index ()
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return
|
return
|
||||||
model = self.log_view.props.model
|
|
||||||
first_index = model.line_index_to_top (filtered_line_index)
|
|
||||||
last_index = model.line_index_to_top (len (model) - 1)
|
|
||||||
|
|
||||||
self.logger.info ("hiding lines before %i (abs %i), last line is abs %i",
|
if after:
|
||||||
filtered_line_index,
|
first_index = model.line_index_to_top (0)
|
||||||
first_index,
|
last_index = model.line_index_to_top (filtered_line_index)
|
||||||
last_index)
|
|
||||||
|
self.logger.info ("hiding lines after %i (abs %i), first line is abs %i",
|
||||||
|
filtered_line_index,
|
||||||
|
last_index,
|
||||||
|
first_index)
|
||||||
|
else:
|
||||||
|
first_index = model.line_index_to_top (filtered_line_index)
|
||||||
|
last_index = model.line_index_to_top (len (model) - 1)
|
||||||
|
|
||||||
|
self.logger.info ("hiding lines before %i (abs %i), last line is abs %i",
|
||||||
|
filtered_line_index,
|
||||||
|
first_index,
|
||||||
|
last_index)
|
||||||
|
|
||||||
self.push_view_state ()
|
self.push_view_state ()
|
||||||
self.log_range.set_range (first_index, last_index)
|
self.log_range.set_range (first_index, last_index)
|
||||||
|
|
Loading…
Reference in a new issue