diff options
author | René Stadler <mail@renestadler.de> | 2012-08-24 01:42:00 +0200 |
---|---|---|
committer | René Stadler <mail@renestadler.de> | 2012-08-24 01:58:34 +0200 |
commit | 91cc5b693f075e290bdc3f6637ca9d25b141c2d3 (patch) | |
tree | 6ab6954514d9dd2ca5e191fb8b8251746ad5281d /GstDebugViewer | |
parent | 45770b0b126d478599e7a9ede65ae53f5e4d5670 (diff) |
Make RangeFilteredLogModel internal to GUI.models
Diffstat (limited to 'GstDebugViewer')
-rw-r--r-- | GstDebugViewer/GUI/models.py | 23 | ||||
-rw-r--r-- | GstDebugViewer/GUI/window.py | 13 |
2 files changed, 17 insertions, 19 deletions
diff --git a/GstDebugViewer/GUI/models.py b/GstDebugViewer/GUI/models.py index 026a880..9d57b05 100644 --- a/GstDebugViewer/GUI/models.py +++ b/GstDebugViewer/GUI/models.py @@ -276,20 +276,26 @@ class FilteredLogModel (FilteredLogModelBase): self.logger = logging.getLogger ("filtered-log-model") + self.range_model = RangeFilteredLogModel (super_model) + self.filters = [] self.super_index = [] self.from_super_index = {} self.reset () self.__active_process = None self.__filter_progress = 0. - self.__old_super_model_range = super_model.line_index_range + + def _iter_hierarchy (self): + + yield self + yield self.range_model def reset (self): - range_model = self.super_model + range_model = self.range_model + range_model.reset () 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 () @@ -416,19 +422,18 @@ class FilteredLogModel (FilteredLogModelBase): return super_stop - super_start - def super_model_changed_range (self): + def set_range (self, start_index, stop_index): - range_model = self.super_model + range_model = self.range_model + old_start, old_stop = range_model.line_index_range + range_model.set_range (start_index, stop_index) 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 super_start_offset = super_start - old_start @@ -477,8 +482,6 @@ class FilteredLogModel (FilteredLogModelBase): for i in range (len (self.super_index)): self.super_index[i] -= super_start_offset - self.__old_super_model_range = (super_start, super_stop,) - def __remove_range (self, start, stop): if start < 0: diff --git a/GstDebugViewer/GUI/window.py b/GstDebugViewer/GUI/window.py index 6446cbc..75d79a1 100644 --- a/GstDebugViewer/GUI/window.py +++ b/GstDebugViewer/GUI/window.py @@ -270,7 +270,6 @@ class Window (object): self.log_file = None self.log_model = None - self.log_range = None self.log_filter = None self.widget_factory = Common.GUI.WidgetFactory (Main.Paths.data_dir) @@ -309,8 +308,7 @@ class Window (object): def setup_model (self, model): self.log_model = model - self.log_range = RangeFilteredLogModel (self.log_model) - self.log_filter = FilteredLogModel (self.log_range) + self.log_filter = FilteredLogModel (self.log_model) self.log_filter.handle_process_finished = self.handle_log_filter_process_finished def get_top_attach_point (self): @@ -595,8 +593,7 @@ class Window (object): self.push_view_state () start_index = first_index stop_index = last_index + 1 - self.log_range.set_range (start_index, stop_index) - self.log_filter.super_model_changed_range () + self.log_filter.set_range (start_index, stop_index) self.update_model () self.pop_view_state () self.actions.show_hidden_lines.props.sensitive = True @@ -607,7 +604,6 @@ 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.reset () self.update_model (self.log_filter) self.pop_view_state (scroll_to_selection = True) @@ -896,7 +892,6 @@ class Window (object): self.progress_dialog = None self.log_model.set_log (self.log_file) - self.log_range.reset () self.log_filter.reset () self.actions.reload_file.props.sensitive = True @@ -910,12 +905,12 @@ class Window (object): _("It is not a GStreamer log file.")) def idle_set (): - self.log_view.set_model (self.log_range) + self.log_view.set_model (self.log_filter) self.line_view.handle_attach_log_file (self) for feature in self.features: feature.handle_attach_log_file (self, self.log_file) - if len (self.log_range): + if len (self.log_filter): sel = self.log_view.get_selection () sel.select_path ((0,)) return False |