From b498220dcbf558972248b6c38b60fdb37cb4f5a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 21 Feb 2021 19:46:22 +0100 Subject: [PATCH] Remove usage of deprecated Gtk.Alignment issue10081 review357131002 --- tryton/common/common.py | 10 +++++----- tryton/gui/window/dblogin.py | 8 +++----- tryton/gui/window/view_form/view/form_gtk/image.py | 5 ++--- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/tryton/common/common.py b/tryton/common/common.py index c4987ac28f..83a0f99a80 100644 --- a/tryton/common/common.py +++ b/tryton/common/common.py @@ -603,13 +603,13 @@ class UserWarningDialog(WarningDialog): def build_dialog(self, *args, **kwargs): dialog = super().build_dialog(*args, **kwargs) - 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) + label=_('Do you want to proceed?'), + halign=Gtk.Align.FILL, valign=Gtk.Align.END) dialog.vbox.pack_start(label, expand=True, fill=True, padding=0) + self.always = Gtk.CheckButton( + label=_('Always ignore this warning.'), halign=Gtk.Align.START) + dialog.vbox.pack_start(self.always, expand=True, fill=False, padding=0) return dialog def process_response(self, response): diff --git a/tryton/gui/window/dblogin.py b/tryton/gui/window/dblogin.py index 26330ceba6..80ca92e2ce 100644 --- a/tryton/gui/window/dblogin.py +++ b/tryton/gui/window/dblogin.py @@ -407,11 +407,9 @@ class DBLogin(object): tooltips.set_tip(self.button_connect, _('Connect the Tryton server')) self.dialog.add_action_widget(self.button_connect, Gtk.ResponseType.OK) self.dialog.set_default_response(Gtk.ResponseType.OK) - alignment = Gtk.Alignment(yalign=0, yscale=0, xscale=1) - grid = Gtk.Grid(column_spacing=3, row_spacing=3) - alignment.add(grid) - self.dialog.vbox.pack_start( - alignment, expand=True, fill=True, padding=0) + grid = Gtk.Grid( + column_spacing=3, row_spacing=3, valign=Gtk.Align.START) + self.dialog.vbox.pack_start(grid, expand=True, fill=True, padding=0) image = Gtk.Image() image.set_from_file(os.path.join(PIXMAPS_DIR, 'tryton.svg')) diff --git a/tryton/gui/window/view_form/view/form_gtk/image.py b/tryton/gui/window/view_form/view/form_gtk/image.py index 7a60fc9765..05c2188b61 100644 --- a/tryton/gui/window/view_form/view/form_gtk/image.py +++ b/tryton/gui/window/view_form/view/form_gtk/image.py @@ -37,10 +37,9 @@ class Image(BinaryMixin, Widget): toolbar = self.toolbar() # Set button attributes even if not display if not attrs.get('readonly'): - alignment = Gtk.Alignment(xalign=0.5, yalign=0.5) - alignment.add(toolbar) + toolbar.set_halign(Gtk.Align.CENTER) self.widget.pack_start( - alignment, expand=False, fill=False, padding=0) + toolbar, expand=False, fill=False, padding=0) self._readonly = False