src
rqt_console
filters
base_filter.py
Go to the documentation of this file.
1
# Software License Agreement (BSD License)
2
#
3
# Copyright (c) 2012, Willow Garage, Inc.
4
# All rights reserved.
5
#
6
# Redistribution and use in source and binary forms, with or without
7
# modification, are permitted provided that the following conditions
8
# are met:
9
#
10
# * Redistributions of source code must retain the above copyright
11
# notice, this list of conditions and the following disclaimer.
12
# * Redistributions in binary form must reproduce the above
13
# copyright notice, this list of conditions and the following
14
# disclaimer in the documentation and/or other materials provided
15
# with the distribution.
16
# * Neither the name of Willow Garage, Inc. nor the names of its
17
# contributors may be used to stoporse or promote products derived
18
# from this software without specific prior written permission.
19
#
20
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
# POSSIBILITY OF SUCH DAMAGE.
32
33
from
python_qt_binding.QtCore
import
QObject, QTimer, Signal
34
35
36
class
BaseFilter
(QObject):
37
38
"""
39
Contains basic functions common to all filters.
40
Handles enabled logic and change notification.
41
"""
42
filter_changed_signal = Signal()
43
44
def
__init__
(self):
45
super(BaseFilter, self).
__init__
()
46
self.
_enabled
=
True
47
48
self.
_timer
= QTimer(self)
49
self.
_timer
.setSingleShot(
True
)
50
self.
_timer
.timeout.connect(self.
filter_changed_signal
.emit)
51
52
def
start_emit_timer
(self, msec=None):
53
"""
54
Starts a timer to emit a signal to refresh the filters after the filter is changed
55
:param msec: number of msecs to wait before emitting the signal to change the filter ''int''
56
"""
57
if
msec
is
None
:
58
self.
_timer
.start(10)
59
else
:
60
self.
_timer
.start(msec)
61
62
def
is_enabled
(self):
63
return
self.
_enabled
64
65
def
set_enabled
(self, checked):
66
"""
67
Setter for _enabled
68
:param checked: boolean flag to set ''bool''
69
:emits filter_changed_signal: Always
70
"""
71
self.
_enabled
= checked
72
self.
start_emit_timer
(200)
73
74
def
has_filter
(self):
75
raise
NotImplementedError()
76
77
def
test_message
(self, message):
78
raise
NotImplementedError()
rqt_console.filters.base_filter.BaseFilter._enabled
_enabled
Definition:
base_filter.py:46
rqt_console.filters.base_filter.BaseFilter.has_filter
def has_filter(self)
Definition:
base_filter.py:74
rqt_console.filters.base_filter.BaseFilter.filter_changed_signal
filter_changed_signal
Definition:
base_filter.py:42
rqt_console.filters.base_filter.BaseFilter._timer
_timer
Definition:
base_filter.py:48
rqt_console.filters.base_filter.BaseFilter
Definition:
base_filter.py:36
rqt_console.filters.base_filter.BaseFilter.test_message
def test_message(self, message)
Definition:
base_filter.py:77
rqt_console.filters.base_filter.BaseFilter.is_enabled
def is_enabled(self)
Definition:
base_filter.py:62
rqt_console.filters.base_filter.BaseFilter.start_emit_timer
def start_emit_timer(self, msec=None)
Definition:
base_filter.py:52
rqt_console.filters.base_filter.BaseFilter.set_enabled
def set_enabled(self, checked)
Definition:
base_filter.py:65
rqt_console.filters.base_filter.BaseFilter.__init__
def __init__(self)
Definition:
base_filter.py:44
rqt_console
Author(s): Aaron Blasdel
autogenerated on Sun Oct 15 2023 02:24:45