changeset e3852854e99b in tryton:5.4
details: https://hg.tryton.org/tryton?cmd=changeset;node=e3852854e99b
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
(grafted from 0b026afcba63fff9bdc8b88f9b952d38e0becd71)
diffstat:
tryton/common/common.py | 14 +++-----------
1 files changed, 3 insertions(+), 11 deletions(-)
diffs (34 lines):
diff -r 3b3ddfa05584 -r e3852854e99b 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'