8367e0e3fe603fb3536b4a30f249dc580d98a58a
[platform/upstream/gstreamer.git] / debug-viewer / GstDebugViewer / GUI / filters.py
1 # -*- coding: utf-8; mode: python; -*-
2 #
3 #  GStreamer Debug Viewer - View and analyze GStreamer debug log files
4 #
5 #  Copyright (C) 2007 RenĂ© Stadler <mail@renestadler.de>
6 #
7 #  This program is free software; you can redistribute it and/or modify it
8 #  under the terms of the GNU General Public License as published by the Free
9 #  Software Foundation; either version 3 of the License, or (at your option)
10 #  any later version.
11 #
12 #  This program is distributed in the hope that it will be useful, but WITHOUT
13 #  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 #  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
15 #  more details.
16 #
17 #  You should have received a copy of the GNU General Public License along with
18 #  this program.  If not, see <http://www.gnu.org/licenses/>.
19
20 """GStreamer Debug Viewer GUI module."""
21
22 from GstDebugViewer.GUI.models import LogModelBase
23
24 class Filter (object):
25
26     pass
27
28 class DebugLevelFilter (Filter):
29
30     def __init__ (self, debug_level):
31
32         col_id = LogModelBase.COL_LEVEL
33         def filter_func (row):
34             return row[col_id] != debug_level
35         self.filter_func = filter_func
36
37 class CategoryFilter (Filter):
38
39     def __init__ (self, category):
40
41         col_id = LogModelBase.COL_CATEGORY
42         def category_filter_func (row):
43             return row[col_id] != category
44         self.filter_func = category_filter_func
45
46 class ObjectFilter (Filter):
47
48     def __init__ (self, object_):
49
50         col_id = LogModelBase.COL_OBJECT
51         def object_filter_func (row):
52             return row[col_id] != object_
53         self.filter_func = object_filter_func
54
55 class FilenameFilter (Filter):
56
57     def __init__ (self, filename):
58
59         col_id = LogModelBase.COL_FILENAME
60         def filename_filter_func (row):
61             return row[col_id] != filename
62         self.filter_func = filename_filter_func
63