From 8b07b703dcda831ac6343b6b0ccf8a4875e66659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=C3=89vrard?= Date: Mon, 18 Nov 2019 12:27:19 +0100 Subject: [PATCH] Manage cancelling FileChooser in the Binary issue8821 review268441002 --- tryton/gui/window/view_form/view/form_gtk/binary.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tryton/gui/window/view_form/view/form_gtk/binary.py b/tryton/gui/window/view_form/view/form_gtk/binary.py index 9dca9fe382..9a9a632abc 100644 --- a/tryton/gui/window/view_form/view/form_gtk/binary.py +++ b/tryton/gui/window/view_form/view/form_gtk/binary.py @@ -88,9 +88,10 @@ class BinaryMixin(Widget): def select(self, widget=None): if not self.field: return - self._set_uri( - 'file:///' + file_selection( - _('Select'), preview=self.preview, filters=self.filters)) + filename = file_selection( + _('Select'), preview=self.preview, filters=self.filters) + if filename: + self._set_uri('file:///' + filename) def select_drag_data_received( self, widget, context, x, y, selection, info, timestamp):