changeset fea2cefce57a in tryton:5.0
details: https://hg.tryton.org/tryton?cmd=changeset;node=fea2cefce57a
description:
        Do not detect or set style if there no toolbar

        If the richtext widget has no toolbar, it does not need to detect the 
style and
        neither set style.
        Those callback's failed any way because tag_widgets is not filled.

        issue9048
        review274841004
        (grafted from f010341e7ca5328f043f9d269455f3167dff9bd7)
diffstat:

 tryton/gui/window/view_form/view/form_gtk/richtextbox.py |  4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diffs (21 lines):

diff -r 56d7f47c6929 -r fea2cefce57a 
tryton/gui/window/view_form/view/form_gtk/richtextbox.py
--- a/tryton/gui/window/view_form/view/form_gtk/richtextbox.py  Mon Feb 17 
23:19:51 2020 +0100
+++ b/tryton/gui/window/view_form/view/form_gtk/richtextbox.py  Mon Feb 17 
23:17:39 2020 +0100
@@ -169,6 +169,8 @@
             self.toolbar.set_sensitive(not value)
 
     def detect_style(self, textview, *args):
+        if not self.toolbar:
+            return
         tag_widgets = self.tag_widgets[textview]
         text_buffer = textview.get_buffer()
         try:
@@ -256,6 +258,8 @@
         toggle_justification(justifications, True)
 
     def insert_text_style(self, text_buffer, iter_, text, length, textview):
+        if not self.toolbar:
+            return
         # Text is already inserted so iter_ point to the end
         start = iter_.copy()
         start.backward_chars(length)

Reply via email to