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()
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()
def set_edit_markup(self, markup): self.edit_text, self.edit_attr = urwid.decompose_tagmarkup(markup)
def test_bad_type(self): self.assertRaises(urwid.TagMarkupException, lambda: urwid.decompose_tagmarkup(5))
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)
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)