示例#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
文件: test_util.py 项目: andy-z/urwid
 def test_bad_type(self):
     self.assertRaises(urwid.TagMarkupException, lambda:
         urwid.decompose_tagmarkup(5))
示例#7
0
文件: test_util.py 项目: andy-z/urwid
 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)