changeset 288:44752e8031f8

simple XHTML: fixed crash when parent is set to None + fixed bold restoration when escaped message is modified
author Goffi <goffi@goffi.org>
date Thu, 28 Mar 2019 08:42:11 +0100
parents 5d96bcd3bfec
children 717c6c368f70
files cagou/core/simple_xhtml.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/cagou/core/simple_xhtml.py	Wed Mar 27 22:22:51 2019 +0100
+++ b/cagou/core/simple_xhtml.py	Thu Mar 28 08:42:11 2019 +0100
@@ -41,7 +41,8 @@
 class SimpleXHTMLWidgetEscapedText(Label):
 
     def on_parent(self, instance, parent):
-        self.font_size = parent.font_size
+        if parent is not None:
+            self.font_size = parent.font_size
 
     def _addUrlMarkup(self, text):
         text_elts = []
@@ -152,12 +153,12 @@
     def on_xhtml(self, instance, xhtml):
         """parse xhtml and set content accordingly
 
-        if xhtml is an instance of Escape, a Label with not markup
-        will be used
+        if xhtml is an instance of Escape, a Label with no markup will be used
         """
         self.clear_widgets()
         if isinstance(xhtml, Escape):
-            label = SimpleXHTMLWidgetEscapedText(text=xhtml, color=self.color)
+            label = SimpleXHTMLWidgetEscapedText(
+                text=xhtml, color=self.color, bold=self.bold)
             self.bind(color=label.setter('color'))
             self.bind(bold=label.setter('bold'))
             self.add_widget(label)