changeset 0b026afcba63 in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset;node=0b026afcba63
description:
        Properly test always checkbox in user warning

        We stop using callback on checkbox to store the value but use directly 
the
        value from the widget.

        issue8847
        review272541002
diffstat:

 tryton/common/common.py |  14 +++-----------
 1 files changed, 3 insertions(+), 11 deletions(-)

diffs (34 lines):

diff -r 834f16b60a7f -r 0b026afcba63 tryton/common/common.py
--- a/tryton/common/common.py   Thu Dec 05 21:24:43 2019 +0100
+++ b/tryton/common/common.py   Thu Dec 05 21:43:59 2019 +0100
@@ -592,19 +592,11 @@
 
 class UserWarningDialog(WarningDialog):
 
-    def __init__(self):
-        super(UserWarningDialog, self).__init__()
-        self.always = False
-
-    def _set_always(self, toggle):
-        self.always = toggle.get_active()
-
     def build_dialog(self, *args, **kwargs):
         dialog = super().build_dialog(*args, **kwargs)
-        check = Gtk.CheckButton(label=_('Always ignore this warning.'))
-        check.connect_after('toggled', self._set_always)
+        self.always = Gtk.CheckButton(label=_('Always ignore this warning.'))
         alignment = Gtk.Alignment(xalign=0, yalign=0.5)
-        alignment.add(check)
+        alignment.add(self.always)
         dialog.vbox.pack_start(alignment, expand=True, fill=False, padding=0)
         label = Gtk.Label(
             label=_('Do you want to proceed?'), halign=Gtk.Align.END)
@@ -613,7 +605,7 @@
 
     def process_response(self, response):
         if response == Gtk.ResponseType.YES:
-            if self.always:
+            if self.always.get_active():
                 return 'always'
             return 'ok'
         return 'cancel'

Reply via email to