From 8c3f22a509e4e44199ee8aeb49733452689543f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 23 Sep 2014 17:49:25 +0200 Subject: [PATCH] Use floor division to order widget for focus GTK internally use gint to make such computation, so to mimick it correctly we must use a floor division. --- tryton/common/focus.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tryton/common/focus.py b/tryton/common/focus.py index a428121fb9..9d54df1eab 100644 --- a/tryton/common/focus.py +++ b/tryton/common/focus.py @@ -26,12 +26,12 @@ def find_focused_child(widget): def tab_compare(a, b): text_direction = gtk.widget_get_default_direction() - y1 = a.allocation.y + a.allocation.height / 2. - y2 = b.allocation.y + b.allocation.height / 2. + y1 = a.allocation.y + a.allocation.height // 2 + y2 = b.allocation.y + b.allocation.height // 2 if y1 == y2: - x1 = a.allocation.x + a.allocation.width / 2. - x2 = b.allocation.x + b.allocation.width / 2. + x1 = a.allocation.x + a.allocation.width // 2 + x2 = b.allocation.x + b.allocation.width // 2 if text_direction == gtk.TEXT_DIR_RTL: return (x2 > x1) - (x2 < x1)