Example #1
0
    def set_edit_markup(self, markup):
        """Call this when markup changes but the underlying text does not.

        You should arrange for this to be called from the 'change' signal.
        """
        self._bpy_text, self._bpy_attr = urwid.decompose_tagmarkup(markup)
        # This is redundant when we're called off the 'change' signal.
        # I'm assuming this is cheap, making that ok.
        self._invalidate()
Example #2
0
    def set_edit_markup(self, markup):
        """Call this when markup changes but the underlying text does not.

        You should arrange for this to be called from the 'change' signal.
        """
        if markup:
            self._bpy_text, self._bpy_attr = urwid.decompose_tagmarkup(markup)
        else:
            # decompose_tagmarkup in some urwids fails on the empty list
            self._bpy_text, self._bpy_attr = "", []
        # This is redundant when we're called off the 'change' signal.
        # I'm assuming this is cheap, making that ok.
        self._invalidate()
Example #3
0
File: editor.py Project: gvx/ovic
 def set_edit_markup(self, markup):
     self.edit_text, self.edit_attr = urwid.decompose_tagmarkup(markup)
Example #4
0
 def test_bad_type(self):
     self.assertRaises(urwid.TagMarkupException,
                       lambda: urwid.decompose_tagmarkup(5))
Example #5
0
 def test(self):
     for input, text, attr in self.mytests:
         restext, resattr = urwid.decompose_tagmarkup(input)
         assert restext == text, "got: %r expected: %r" % (restext, text)
         assert resattr == attr, "got: %r expected: %r" % (resattr, attr)
Example #6
0
 def test_bad_type(self):
     self.assertRaises(urwid.TagMarkupException, lambda:
         urwid.decompose_tagmarkup(5))
Example #7
0
 def test(self):
     for input, text, attr in self.mytests:
         restext,resattr = urwid.decompose_tagmarkup( input )
         assert restext == text, "got: %r expected: %r" % (restext, text)
         assert resattr == attr, "got: %r expected: %r" % (resattr, attr)