From 53becaa72cc90396b472aa62b204763965188107 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Stadler?= Date: Thu, 24 Jan 2008 15:18:37 +0200 Subject: [PATCH] Add filtering for object name and source code filename --- debug-viewer/GstDebugViewer/GUI.py | 35 +++++++++++++++++++++++---- debug-viewer/data/gst-debug-viewer.ui | 2 ++ 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/debug-viewer/GstDebugViewer/GUI.py b/debug-viewer/GstDebugViewer/GUI.py index 96caaa4e36..f08258a536 100644 --- a/debug-viewer/GstDebugViewer/GUI.py +++ b/debug-viewer/GstDebugViewer/GUI.py @@ -672,6 +672,24 @@ class CategoryFilter (Filter): return row[col_id] != category self.filter_func = category_filter_func +class ObjectFilter (Filter): + + def __init__ (self, object_): + + col_id = LogModelBase.COL_OBJECT + def object_filter_func (row): + return row[col_id] != object_ + self.filter_func = object_filter_func + +class FilenameFilter (Filter): + + def __init__ (self, filename): + + col_id = LogModelBase.COL_FILENAME + def filename_filter_func (row): + return row[col_id] != filename + self.filter_func = filename_filter_func + class SubRange (object): __slots__ = ("l", "start", "stop",) @@ -1599,12 +1617,11 @@ class Window (object): ("edit-copy-message", gtk.STOCK_COPY, _("Copy message"), ""), ("hide-log-level", None, _("Hide log level")), ("hide-log-category", None, _("Hide log category")), - ("hide-log-object", None, _("Hide object"))]) + ("hide-log-object", None, _("Hide object")), + ("hide-filename", None, _("Hide filename"))]) group.props.sensitive = False self.actions.add_group (group) - self.actions.hide_log_object.props.visible = False - self.actions.add_group (self.column_manager.action_group) self.log_file = None @@ -1667,7 +1684,7 @@ class Window (object): "hide-before-line", "hide-after-line", "show-hidden-lines", "edit-copy-line", "edit-copy-message", "hide-log-level", "hide-log-category", "hide-log-object", - "show-about",): + "hide-filename", "show-about",): name = action_name.replace ("-", "_") action = getattr (self.actions, name) handler = getattr (self, "handle_%s_action_activate" % (name,)) @@ -2009,7 +2026,15 @@ class Window (object): def handle_hide_log_object_action_activate (self, action): - pass + row = self.get_active_line () + object_ = row[LogModelBase.COL_OBJECT] + self.add_model_filter (ObjectFilter (object_)) + + def handle_hide_filename_action_activate (self, action): + + row = self.get_active_line () + filename = row[LogModelBase.COL_FILENAME] + self.add_model_filter (FilenameFilter (filename)) def handle_show_about_action_activate (self, action): diff --git a/debug-viewer/data/gst-debug-viewer.ui b/debug-viewer/data/gst-debug-viewer.ui index 3374be79f9..7623079a15 100644 --- a/debug-viewer/data/gst-debug-viewer.ui +++ b/debug-viewer/data/gst-debug-viewer.ui @@ -27,6 +27,7 @@ + @@ -57,6 +58,7 @@ +