Using Gtk.FileChooserNative

Submitting an app for Flatpak packaging, I’ve been advised that I should not use

filechooserdialog = Gtk.FileChooserDialog(title=“Select a file”, action=Gtk.FileChooserAction.OPEN, parent=self.window)

which worked perfectly well.

For portability reasons I should use something like

filechooserdialog = Gtk.FileChooserNative(title=“Select a file”, action=Gtk.FileChooserAction.OPEN)

which opens a completely new window with an extra icon to the list of open applications - very clumsy and confusing to use. It doesn’t allow adding a reference to a parent window.

so I tried

filechooserdialog = Gtk.FileChooserNative.new(‘Select a file’, self.window, Gtk.FileChooserAction.OPEN,‘OK’,‘Cancel’)

no better, it still opens a completely separate window. I have replaced something that looks great on its native system but might look a little less than perfectly matched on another system, with something that looks absolutely awful on any system including the native system!

What am I doing wrong Have I perhaps misunderstood what ‘parent=’ does?

b

(‘window’ is the name of the application’s top-level window. Imaginative eh?)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.