Cédric Krier pushed to branch branch/default at Tryton / Tryton
Commits: 6064ddb6 by Cédric Krier at 2022-12-22T20:06:03+01:00 Use Gtk.FileChooserNative instead of Gtk.FileChooserDialog It is the recommended and easy way to use the portals for Flatpak. Closed #11941 - - - - - 1 changed file: - tryton/tryton/common/common.py Changes: ===================================== tryton/tryton/common/common.py ===================================== @@ -439,11 +439,5 @@ action=Gtk.FileChooserAction.OPEN, preview=True, multi=False, filters=None): parent = get_toplevel_window() - if action == Gtk.FileChooserAction.OPEN: - buttons = (set_underline(_("Cancel")), Gtk.ResponseType.CANCEL, - set_underline(_("Select")), Gtk.ResponseType.OK) - else: - buttons = (set_underline(_("Cancel")), Gtk.ResponseType.CANCEL, - set_underline(_("Save")), Gtk.ResponseType.OK) - win = Gtk.FileChooserDialog( + win = Gtk.FileChooserNative( title=title, transient_for=parent, action=action) @@ -449,6 +443,4 @@ title=title, transient_for=parent, action=action) - win.add_buttons(*buttons) - win.set_icon(TRYTON_ICON) if filename: filename = slugify(filename) if action in (Gtk.FileChooserAction.SAVE, @@ -459,7 +451,6 @@ if hasattr(win, 'set_do_overwrite_confirmation'): win.set_do_overwrite_confirmation(True) win.set_select_multiple(multi) - win.set_default_response(Gtk.ResponseType.OK) if filters is not None: for filt in filters: win.add_filter(filt) @@ -484,7 +475,7 @@ win.connect('update-preview', update_preview_cb, img_preview) button = win.run() - if button != Gtk.ResponseType.OK: + if button != Gtk.ResponseType.ACCEPT: result = None elif not multi: result = PurePath(win.get_filename()) View it on Heptapod: https://foss.heptapod.net/tryton/tryton/-/commit/6064ddb64052c84dec5f90deb8bdb8918f475944 -- View it on Heptapod: https://foss.heptapod.net/tryton/tryton/-/commit/6064ddb64052c84dec5f90deb8bdb8918f475944 You're receiving this email because of your account on foss.heptapod.net.