Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions photocollage/gtkgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,12 @@ def update_photolist(self, new_images):

def choose_images(self, button):
dialog = PreviewFileChooserDialog(title=_("Choose images"),
parent=button.get_toplevel(),
action=Gtk.FileChooserAction.OPEN,
select_multiple=True,
modal=True)

if dialog.run() == Gtk.ResponseType.OK:
result = dialog.run()
if result == Gtk.ResponseType.ACCEPT:
files = dialog.get_filenames()
dialog.destroy()
self.update_photolist(files)
Expand Down Expand Up @@ -401,13 +401,12 @@ def save_poster(self, button):
enlargement = float(self.opts.out_w) / collage.page.w
collage.page.scale(enlargement)

dialog = Gtk.FileChooserDialog(_("Save image"), button.get_toplevel(),
Gtk.FileChooserAction.SAVE)
dialog.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)
dialog.add_button(Gtk.STOCK_OK, Gtk.ResponseType.OK)
dialog = Gtk.FileChooserNative(title=_("Save image"),
action=Gtk.FileChooserAction.SAVE)

dialog.set_do_overwrite_confirmation(True)
set_save_image_filters(dialog)
if dialog.run() != Gtk.ResponseType.OK:
if dialog.run() != Gtk.ResponseType.ACCEPT:
dialog.destroy()
return
savefile = dialog.get_filename()
Expand Down Expand Up @@ -784,14 +783,14 @@ def __init__(self, parent, message):
self.show_all()


class PreviewFileChooserDialog(Gtk.FileChooserDialog):
class PreviewFileChooserDialog(Gtk.FileChooserNative):
PREVIEW_MAX_SIZE = 256

def __init__(self, **kw):
super().__init__(**kw)

self.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)
self.add_button(Gtk.STOCK_OK, Gtk.ResponseType.OK)
# self.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)
# self.add_button(Gtk.STOCK_OK, Gtk.ResponseType.OK)

set_open_image_filters(self)

Expand Down Expand Up @@ -823,6 +822,7 @@ def update_preview_cb(self, file_chooser):


def main():
os.environ["GTK_USE_PORTAL"] = '1'
# Enable threading. Without that, threads hang!
GObject.threads_init()

Expand Down