From 8a3bd40f52401c91e30e609201839929fc2dd38c Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Mon, 15 Sep 2003 04:16:12 +0000 Subject: [PATCH] * src/ImageSelect.py (ImageSelect.__init__): Make dialog transient for its parent; (Gallery.__init__): Accept parent_window and pass it on. svn: r2132 --- gramps2/ChangeLog | 2 ++ gramps2/src/ImageSelect.py | 21 +++++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index a988dc0d3..27c135579 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -14,6 +14,8 @@ * src/Witness.py: Make WittnessEditor dialog modal and transient for its parent. Call SelectPerson with itself as a parent. * src/SelectPerson.py (__init__): Make dialog transient for its parent. + * src/ImageSelect.py (ImageSelect.__init__): Make dialog transient for + its parent; (Gallery.__init__): Accept parent_window and pass it on. * src/imagesel.glade: Define proper responses and delete unneeded handlers for buttons. Make gtkFileEntry modal. * src/dialog.glade (all dialogs): Define proper responses for buttons. diff --git a/gramps2/src/ImageSelect.py b/gramps2/src/ImageSelect.py index cff193060..653a29089 100644 --- a/gramps2/src/ImageSelect.py +++ b/gramps2/src/ImageSelect.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000, 2003 Donald N. Allingham +# Copyright (C) 2000-2003 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -67,12 +67,13 @@ _iconlist_refs = [] #------------------------------------------------------------------------- class ImageSelect: - def __init__(self, path, db, parent): + def __init__(self, path, db, parent, parent_window=None): """Creates an edit window. Associates a person with the window.""" self.path = path; self.db = db self.dataobj = None self.parent = parent + self.parent_window = parent_window self.canvas_list = {} self.p_map = {} self.canvas = None @@ -106,16 +107,21 @@ class ImageSelect: _('Select a media object')) self.glade.signal_autoconnect({ - "on_savephoto_clicked" : self.on_savephoto_clicked, "on_name_changed" : self.on_name_changed, - "destroy_passed_object" : Utils.destroy_passed_object }) if os.path.isdir(_last_path): self.photosel.set_default_path(_last_path) self.photosel.set_filename(_last_path) self.photosel.gtk_entry().set_position(len(_last_path)) + + if self.parent_window: + window.set_transient_for(self.parent_window) window.show() + val = window.run() + if val == gtk.RESPONSE_OK: + self.on_savephoto_clicked() + window.destroy() def on_name_changed(self, obj): """The filename has changed. Verify it and load the picture.""" @@ -138,7 +144,7 @@ class ImageSelect: i = gtk.gdk.pixbuf_new_from_file(Utils.find_icon(type)) self.image.set_from_pixbuf(i) - def on_savephoto_clicked(self, obj): + def on_savephoto_clicked(self): """Save the photo in the dataobj object. (Required function)""" global _last_path @@ -190,7 +196,6 @@ class ImageSelect: mobj.setPath(name) self.parent.lists_changed = 1 - Utils.destroy_passed_object(obj) self.load_images() def savephoto(self, photo): @@ -211,8 +216,8 @@ _drag_targets = [ # #------------------------------------------------------------------------- class Gallery(ImageSelect): - def __init__(self, dataobj, path, icon_list, db, parent): - ImageSelect.__init__(self, path, db, parent) + def __init__(self, dataobj, path, icon_list, db, parent, parent_window=None): + ImageSelect.__init__(self, path, db, parent, parent_window) if path: icon_list.drag_dest_set(gtk.DEST_DEFAULT_ALL, _drag_targets,