Skip to content

Commit

Permalink
ui_gtk: fix 2 bugs in BrowseButton.onClick, #538
Browse files Browse the repository at this point in the history
  • Loading branch information
ilius committed Nov 25, 2023
1 parent f8c433c commit 380d59b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pyglossary/ui/ui_gtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,17 +789,20 @@ def __init__(

def onClick(self, widget):
fcd = gtk.FileChooserNative(
transient_for=self.get_root(),
transient_for=(
self.get_root() if hasattr(self, "get_root")
else self.get_toplevel()
),
action=gtk.FileChooserAction.SAVE if self.actionSave
else gtk.FileChooserAction.OPEN,
title=self.title,
)
fcd.connect("response", lambda w, e: fcd.hide())
fcd.connect(
"file-activated",
lambda w: fcd.response(gtk.ResponseType.OK),
lambda w: fcd.response(gtk.ResponseType.ACCEPT),
)
if fcd.run() == gtk.ResponseType.OK:
if fcd.run() == gtk.ResponseType.ACCEPT:
self.setFilePathFunc(fcd.get_filename())
fcd.destroy()

Expand Down

0 comments on commit 380d59b

Please sign in to comment.