changeset 71de92ba03b6 in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset;node=71de92ba03b6
description:
        Store wizard buttons instead of using get_action_area

        get_action_area is deprecated so we store the buttons added as action to
        remove them via their parent in clean.

        issue8139
        review72441002
diffstat:

 tryton/gui/window/wizard.py |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r 28c176fea66e -r 71de92ba03b6 tryton/gui/window/wizard.py
--- a/tryton/gui/window/wizard.py       Fri Mar 22 11:56:04 2019 +0100
+++ b/tryton/gui/window/wizard.py       Fri Mar 22 11:57:42 2019 +0100
@@ -328,6 +328,8 @@
         self.accel_group = Gtk.AccelGroup()
         self.dia.add_accel_group(self.accel_group)
 
+        self._buttons = set()
+
         self.dia.vbox.pack_start(
             self.widget, expand=True, fill=True, padding=0)
 
@@ -335,14 +337,15 @@
 
     def clean(self):
         super(WizardDialog, self).clean()
-        hbuttonbox = self.dia.get_action_area()
-        for button in hbuttonbox.get_children():
-            hbuttonbox.remove(button)
+        while self._buttons:
+            button = self._buttons.pop()
+            button.get_parent().remove(button)
 
     def _get_button(self, definition):
         button = super(WizardDialog, self)._get_button(definition)
         response = len(self.states)
         self.dia.add_action_widget(button, response)
+        self._buttons.add(button)
         if definition['default']:
             button.add_accelerator(
                 'clicked', self.accel_group, Gdk.KEY_Return,

Reply via email to