summaryrefslogtreecommitdiff
path: root/GstDebugViewer
diff options
context:
space:
mode:
authorRené Stadler <mail@renestadler.de>2012-08-24 01:40:24 +0200
committerRené Stadler <mail@renestadler.de>2012-08-24 01:58:34 +0200
commit45770b0b126d478599e7a9ede65ae53f5e4d5670 (patch)
treeac223097b19d65e87cc6d3eff74b36309f8547c1 /GstDebugViewer
parentde0f3656fc79f950a1be1f134fabc9aa7d3ff024 (diff)
Always use a filtered log model in the log view
Preparing to phase out RangeFilteredLogModel.
Diffstat (limited to 'GstDebugViewer')
-rw-r--r--GstDebugViewer/GUI/models.py17
-rw-r--r--GstDebugViewer/GUI/window.py27
2 files changed, 24 insertions, 20 deletions
diff --git a/GstDebugViewer/GUI/models.py b/GstDebugViewer/GUI/models.py
index 3191d7e..026a880 100644
--- a/GstDebugViewer/GUI/models.py
+++ b/GstDebugViewer/GUI/models.py
@@ -286,10 +286,10 @@ class FilteredLogModel (FilteredLogModelBase):
def reset (self):
- del self.line_offsets[:]
- self.line_offsets += self.super_model.line_offsets
- del self.line_levels[:]
- self.line_levels += self.super_model.line_levels
+ range_model = self.super_model
+ self.line_offsets = range_model.line_offsets
+ self.line_levels = range_model.line_levels
+ self.__old_super_model_range = range_model.line_index_range
del self.super_index[:]
self.from_super_index.clear ()
@@ -419,6 +419,15 @@ class FilteredLogModel (FilteredLogModelBase):
def super_model_changed_range (self):
range_model = self.super_model
+
+ if isinstance (self.line_offsets, SubRange):
+ # FIXME: Can only take this shortcut when shrinking the range.
+ self.line_offsets = range_model.line_offsets
+ self.line_levels = range_model.line_levels
+ self.__old_super_model_range = range_model.line_index_range
+ assert self.__old_super_model_range is not None
+ return
+
old_start, old_stop = self.__old_super_model_range
super_start, super_stop = range_model.line_index_range
diff --git a/GstDebugViewer/GUI/window.py b/GstDebugViewer/GUI/window.py
index 7132709..6446cbc 100644
--- a/GstDebugViewer/GUI/window.py
+++ b/GstDebugViewer/GUI/window.py
@@ -269,7 +269,9 @@ class Window (object):
self.actions.add_group (self.column_manager.action_group)
self.log_file = None
- self.setup_model (LazyLogModel ())
+ self.log_model = None
+ self.log_range = None
+ self.log_filter = None
self.widget_factory = Common.GUI.WidgetFactory (Main.Paths.data_dir)
self.widgets = self.widget_factory.make ("main-window.ui", "main_window")
@@ -304,16 +306,12 @@ class Window (object):
self.attach ()
self.column_manager.attach (self.log_view)
- def setup_model (self, model, filter = False):
+ def setup_model (self, model):
self.log_model = model
self.log_range = RangeFilteredLogModel (self.log_model)
- if filter:
- self.log_filter = FilteredLogModel (self.log_range)
- self.log_filter.handle_process_finished = self.handle_log_filter_process_finished
- else:
- self.log_filter = None
-
+ self.log_filter = FilteredLogModel (self.log_range)
+ self.log_filter.handle_process_finished = self.handle_log_filter_process_finished
def get_top_attach_point (self):
return self.widgets.vbox_main
@@ -598,8 +596,7 @@ class Window (object):
start_index = first_index
stop_index = last_index + 1
self.log_range.set_range (start_index, stop_index)
- if self.log_filter:
- self.log_filter.super_model_changed_range ()
+ self.log_filter.super_model_changed_range ()
self.update_model ()
self.pop_view_state ()
self.actions.show_hidden_lines.props.sensitive = True
@@ -609,9 +606,10 @@ class Window (object):
self.logger.info ("restoring model filter to show all lines")
self.push_view_state ()
+ self.log_view.set_model (None)
self.log_range.reset ()
- self.log_filter = None
- self.update_model (self.log_range)
+ self.log_filter.reset ()
+ self.update_model (self.log_filter)
self.pop_view_state (scroll_to_selection = True)
self.actions.show_hidden_lines.props.sensitive = False
@@ -701,9 +699,6 @@ class Window (object):
# things down for nothing.
self.push_view_state ()
self.log_view.set_model (None)
- if self.log_filter is None:
- self.log_filter = FilteredLogModel (self.log_range)
- self.log_filter.handle_process_finished = self.handle_log_filter_process_finished
self.log_filter.add_filter (filter, dispatcher = dispatcher)
gobject.timeout_add (250, self.update_filter_progress)
@@ -902,7 +897,7 @@ class Window (object):
self.log_model.set_log (self.log_file)
self.log_range.reset ()
- self.log_filter = None
+ self.log_filter.reset ()
self.actions.reload_file.props.sensitive = True
self.actions.groups["RowActions"].props.sensitive = True