debug-viewer: Added filter for threads

https://bugzilla.gnome.org/show_bug.cgi?id=793241
This commit is contained in:
Xabier Rodriguez Calvar 2018-02-07 10:05:35 +01:00 committed by Nicolas Dufresne
parent 8c93cc156f
commit 07cd72be78
3 changed files with 35 additions and 0 deletions

View file

@ -89,6 +89,18 @@ class FunctionFilter (Filter):
self.filter_func = function_filter_func
class ThreadFilter (Filter):
def __init__(self, thread_, all_but_this=False):
col_id = LogModelBase.COL_THREAD
comparison_function = get_comparison_function(all_but_this)
def thread_filter_func(row):
return comparison_function(row[col_id], thread_)
self.filter_func = thread_filter_func
class FilenameFilter (Filter):
def __init__(self, filename, all_but_this=False):

View file

@ -40,6 +40,7 @@ from GstDebugViewer.GUI.filters import (CategoryFilter,
DebugLevelFilter,
FilenameFilter,
FunctionFilter,
ThreadFilter,
ObjectFilter)
from GstDebugViewer.GUI.models import (FilteredLogModel,
LazyLogModel,
@ -289,6 +290,10 @@ class Window (object):
"Hide log category")),
("show-only-log-category", None, _(
"Show only log category")),
("hide-log-thread", None, _(
"Hide thread")),
("show-only-log-thread", None, _(
"Show only thread")),
("hide-log-object", None, _("Hide object")),
("show-only-log-object", None, _(
"Show only object")),
@ -824,6 +829,13 @@ class Window (object):
category = row[LogModelBase.COL_CATEGORY]
self.add_model_filter(CategoryFilter(category))
@action
def handle_hide_log_thread_action_activate(self, action):
row = self.get_active_line()
thread = row[LogModelBase.COL_THREAD]
self.add_model_filter(ThreadFilter(thread))
@action
def handle_hide_log_object_action_activate(self, action):
@ -868,6 +880,13 @@ class Window (object):
category = row[LogModelBase.COL_CATEGORY]
self.add_model_filter(CategoryFilter(category, True))
@action
def handle_show_only_log_thread_action_activate(self, action):
row = self.get_active_line()
thread = row[LogModelBase.COL_THREAD]
self.add_model_filter(ThreadFilter(thread, True))
@action
def handle_show_only_log_object_action_activate(self, action):

View file

@ -29,6 +29,8 @@
<menuitem name="ViewContextMenuShowOnlyLevel" action="show-only-log-level"/>
<menuitem name="ViewContextMenuHideCategory" action="hide-log-category"/>
<menuitem name="ViewContextMenuShowOnlyCategory" action="show-only-log-category"/>
<menuitem name="ViewContextMenuHideThread" action="hide-log-thread"/>
<menuitem name="ViewContextMenuShowOnlyThread" action="show-only-log-thread"/>
<menuitem name="ViewContextMenuHideObject" action="hide-log-object"/>
<menuitem name="ViewContextMenuShowOnlyObject" action="show-only-log-object"/>
<menuitem name="ViewContextMenuHideFunction" action="hide-log-function"/>
@ -57,6 +59,8 @@
<menuitem name="ViewContextMenuShowOnlyLevel" action="show-only-log-level"/>
<menuitem name="ViewContextMenuHideCategory" action="hide-log-category"/>
<menuitem name="ViewContextMenuShowOnlyCategory" action="show-only-log-category"/>
<menuitem name="ViewContextMenuHideThread" action="hide-log-thread"/>
<menuitem name="ViewContextMenuShowOnlyThread" action="show-only-log-thread"/>
<menuitem name="ViewContextMenuHideObject" action="hide-log-object"/>
<menuitem name="ViewContextMenuShowOnlyObject" action="show-only-log-object"/>
<menuitem name="ViewContextMenuHideFunction" action="hide-log-function"/>