changeset afa28c25b825 in tryton:5.2
details: https://hg.tryton.org/tryton?cmd=changeset;node=afa28c25b825
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 74cc14b47c04 -r afa28c25b825 
tryton/gui/window/view_form/view/form_gtk/richtextbox.py
--- a/tryton/gui/window/view_form/view/form_gtk/richtextbox.py  Tue Feb 04 
18:28:09 2020 +0100
+++ b/tryton/gui/window/view_form/view/form_gtk/richtextbox.py  Mon Feb 17 
23:17:39 2020 +0100
@@ -179,6 +179,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:
@@ -269,6 +271,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