class MyTest(unittest.TestCase):
    _query_text = 'filter'
    _filtered_text = 'filtered_text'

    def setUp(self):
        unittest.TestCase.setUp(self)

        syntax_nr = QRegExp.RegExp
        syntax = QRegExp.PatternSyntax(syntax_nr)
        self._regExp = QRegExp(self._query_text, Qt.CaseInsensitive, syntax)

        self._filter = TextFilter(self._regExp)
        self._filter.set_text(self._query_text)

    def tearDown(self):
        unittest.TestCase.tearDown(self)

    def test_test_message(self):
        """Testing test_message method."""
        result_regex = self._filter.test_message(self._filtered_text)
        print 'result_regex={}'.format(result_regex)
        self.assertEqual(
            result_regex,
            True  # Both _query_text & filtered_text overlaps.
        )
    def setUp(self):
        unittest.TestCase.setUp(self)

        syntax_nr = QRegExp.RegExp
        syntax = QRegExp.PatternSyntax(syntax_nr)
        self._regExp = QRegExp(self._query_text, Qt.CaseInsensitive, syntax)

        self._filter = TextFilter(self._regExp)
        self._filter.set_text(self._query_text)
    def setUp(self):
        unittest.TestCase.setUp(self)

        syntax_nr = QRegExp.RegExp
        syntax = QRegExp.PatternSyntax(syntax_nr)
        self._regExp = QRegExp(self._query_text, Qt.CaseInsensitive, syntax)

        self._filter = TextFilter(self._regExp)
        self._filter.set_text(self._query_text)
class MyTest(unittest.TestCase):
    _query_text = 'filter'
    _filtered_text = 'filtered_text'

    def setUp(self):
        unittest.TestCase.setUp(self)

        syntax_nr = QRegExp.RegExp
        syntax = QRegExp.PatternSyntax(syntax_nr)
        self._regExp = QRegExp(self._query_text, Qt.CaseInsensitive, syntax)

        self._filter = TextFilter(self._regExp)
        self._filter.set_text(self._query_text)

    def tearDown(self):
        unittest.TestCase.tearDown(self)

    def test_test_message(self):
        """Testing test_message method."""
        result_regex = self._filter.test_message(self._filtered_text)
        print 'result_regex={}'.format(result_regex)
        self.assertEqual(result_regex,
                         True  # Both _query_text & filtered_text overlaps.
                         )
    def __init__(self, context, node=None):
        """
        This class is intended to be called by rqt plugin framework class.
        Currently (12/12/2012) the whole widget is splitted into 2 panes:
        one on left allows you to choose the node(s) you work on. Right side
        pane lets you work with the parameters associated with the node(s) you
        select on the left.

        (12/27/2012) Despite the pkg name is changed to rqt_reconfigure to
        reflect the available functionality, file & class names remain
        'param', expecting all the parameters will become handle-able.
        """

        super(ParamWidget, self).__init__()
        self.setObjectName(self._TITLE_PLUGIN)
        self.setWindowTitle(self._TITLE_PLUGIN)

        rp = rospkg.RosPack()

        #TODO: .ui file needs to replace the GUI components declaration
        #            below. For unknown reason, referring to another .ui files
        #            from a .ui that is used in this class failed. So for now,
        #            I decided not use .ui in this class.
        #            If someone can tackle this I'd appreciate.
        _hlayout_top = QHBoxLayout(self)
        self._splitter = QSplitter(self)
        _hlayout_top.addWidget(self._splitter)

        _vlayout_nodesel_widget = QWidget()
        _vlayout_nodesel_side = QVBoxLayout()
        _hlayout_filter_widget = QWidget(self)
        _hlayout_filter = QHBoxLayout()
        self._text_filter = TextFilter()
        self.filter_lineedit = TextFilterWidget(self._text_filter, rp)
        self.filterkey_label = QLabel("&Filter key:")
        self.filterkey_label.setBuddy(self.filter_lineedit)
        _hlayout_filter.addWidget(self.filterkey_label)
        _hlayout_filter.addWidget(self.filter_lineedit)
        _hlayout_filter_widget.setLayout(_hlayout_filter)
        self._nodesel_widget = NodeSelectorWidget(self, rp, self.sig_sysmsg)
        _vlayout_nodesel_side.addWidget(_hlayout_filter_widget)
        _vlayout_nodesel_side.addWidget(self._nodesel_widget)
        _vlayout_nodesel_side.setSpacing(1)
        _vlayout_nodesel_widget.setLayout(_vlayout_nodesel_side)

        reconf_widget = ParameditWidget(rp)

        self._splitter.insertWidget(0, _vlayout_nodesel_widget)
        self._splitter.insertWidget(1, reconf_widget)
        # 1st column, _vlayout_nodesel_widget, to minimize width.
        # 2nd col to keep the possible max width.
        self._splitter.setStretchFactor(0, 0)
        self._splitter.setStretchFactor(1, 1)

        # Signal from paramedit widget to node selector widget.
        reconf_widget.sig_node_disabled_selected.connect(
            self._nodesel_widget.node_deselected)
        # Pass name of node to editor widget
        self._nodesel_widget.sig_node_selected.connect(
            reconf_widget.show_reconf)

        if not node:
            title = self._TITLE_PLUGIN
        else:
            title = self._TITLE_PLUGIN + ' %s' % node
        self.setObjectName(title)

        #Connect filter signal-slots.
        self._text_filter.filter_changed_signal.connect(
            self._filter_key_changed)