Пример #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()
Пример #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()
Пример #3
0
Файл: editor.py Проект: gvx/ovic
 def set_edit_markup(self, markup):
     self.edit_text, self.edit_attr = urwid.decompose_tagmarkup(markup)
Пример #4
0
 def test_bad_type(self):
     self.assertRaises(urwid.TagMarkupException,
                       lambda: urwid.decompose_tagmarkup(5))
Пример #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)
Пример #6
0
 def test_bad_type(self):
     self.assertRaises(urwid.TagMarkupException, lambda:
         urwid.decompose_tagmarkup(5))
Пример #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)