changeset 490d63a94b7a in tryton:5.0
details: https://hg.tryton.org/tryton?cmd=changeset;node=490d63a94b7a
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 | 26 +++++++++-----------------
1 files changed, 9 insertions(+), 17 deletions(-)
diffs (41 lines):
diff -r 9fd5904926bc -r 490d63a94b7a 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
@@ -582,28 +582,20 @@
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(_('Always ignore this warning.'))
- check.connect_after('toggled', self._set_always)
- alignment = gtk.Alignment(0, 0.5)
- alignment.add(check)
- dialog.vbox.pack_start(alignment, True, False)
- label = gtk.Label(_('Do you want to proceed?'))
- label.set_alignment(1, 0.5)
- dialog.vbox.pack_start(label, True, True)
+ self.always = Gtk.CheckButton(label=_('Always ignore this warning.'))
+ alignment = Gtk.Alignment(xalign=0, yalign=0.5)
+ 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)
+ dialog.vbox.pack_start(label, expand=True, fill=True, padding=0)
return dialog
def process_response(self, response):
- if response == gtk.RESPONSE_YES:
- if self.always:
+ if response == Gtk.ResponseType.YES:
+ if self.always.get_active():
return 'always'
return 'ok'
return 'cancel'