diff --git a/ChangeLog b/ChangeLog index b22b274bc..13a060037 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-02-06 Alex Roitman + * src/gramps.glade: Define handler for the gallery's Edit button. + * src/EditSource.py: Connect callback to the gallery's Edit button. + * src/ImageSelect.py: Remember old photo list. + * src/EditPlace.py: Revert photos on Cancel. + * src/EditPerson.py: Revert photos on Cancel. + * src/Marriage.py: Revert photos on Cancel. + 2004-02-05 Alex Roitman * src/plugins/Merge.py (gen_key,name_compare): Fall back to not using soundex if the charset can't be latin-1 encoded. diff --git a/src/EditPerson.py b/src/EditPerson.py index 95675de86..69c092cc7 100644 --- a/src/EditPerson.py +++ b/src/EditPerson.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2003 Donald N. Allingham +# Copyright (C) 2000-2004 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 @@ -967,7 +967,7 @@ class EditPerson: self.cancel_callback, self.save) else: - self.gallery.close() + self.gallery.close(0) self.window.destroy() def save(self): @@ -985,13 +985,13 @@ class EditPerson: self.save) return 1 else: - self.gallery.close() + self.gallery.close(0) self.window.destroy() return 0 def cancel_callback(self): """If the user answered yes to abandoning changes, close the window""" - self.gallery.close() + self.gallery.close(0) self.window.destroy() def did_data_change(self): @@ -1530,7 +1530,7 @@ class EditPerson: if self.callback: self.callback(self) - self.gallery.close() + self.gallery.close(1) self.window.destroy() def get_place(self,field,makenew=0): diff --git a/src/EditPlace.py b/src/EditPlace.py index 2907f9fab..804896110 100644 --- a/src/EditPlace.py +++ b/src/EditPlace.py @@ -73,6 +73,7 @@ class EditPlace: self.not_loaded = 1 self.ref_not_loaded = 1 self.lists_changed = 0 + self.gallery_ok = 0 if place: self.srcreflist = place.getSourceRefList() else: @@ -209,7 +210,7 @@ class EditPlace: self.val = self.top.run() if self.val == gtk.RESPONSE_OK: self.on_place_apply_clicked() - self.glry.close() + self.glry.close(self.gallery_ok) self.top.destroy() def on_help_clicked(self,obj): @@ -307,7 +308,7 @@ class EditPlace: self.set(self.latitude,self.place.get_latitude, self.place.set_latitude) - if self.lists_changed: + if self.lists_changed: self.place.setSourceRefList(self.srcreflist) Utils.modified() @@ -319,6 +320,7 @@ class EditPlace: self.place.setNoteFormat(format) Utils.modified() + self.gallery_ok = 1 self.update_lists() if self.callback: diff --git a/src/EditSource.py b/src/EditSource.py index 7e72df40b..b9d537078 100644 --- a/src/EditSource.py +++ b/src/EditSource.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2003 Donald N. Allingham +# Copyright (C) 2000-2004 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 @@ -56,6 +56,8 @@ class EditSource: self.path = db.getSavePath() self.not_loaded = 1 self.ref_not_loaded = 1 + self.lists_changed = 0 + self.gallery_ok = 0 self.top_window = gtk.glade.XML(const.gladeFile,"sourceEditor","gramps") self.top = self.top_window.get_widget("sourceEditor") @@ -100,6 +102,7 @@ class EditSource: "on_addphoto_clicked" : self.gallery.on_add_photo_clicked, "on_selectphoto_clicked" : self.gallery.on_select_photo_clicked, "on_deletephoto_clicked" : self.gallery.on_delete_photo_clicked, + "on_editphoto_clicked" : self.gallery.on_edit_photo_clicked, "on_edit_properties_clicked": self.gallery.popup_change_description, "on_sourceEditor_help_clicked" : self.on_help_clicked, }) @@ -124,7 +127,7 @@ class EditSource: self.val = self.top.run() def close(self,obj): - self.gallery.close() + self.gallery.close(self.gallery_ok) self.top.destroy() def display_references(self): @@ -266,6 +269,10 @@ class EditSource: self.source.setNoteFormat(format) Utils.modified() + if self.lists_changed: + Utils.modified() + + self.gallery_ok = 1 self.close(None) if self.callback: diff --git a/src/ImageSelect.py b/src/ImageSelect.py index 58679dbf6..5473b7864 100644 --- a/src/ImageSelect.py +++ b/src/ImageSelect.py @@ -241,13 +241,14 @@ class Gallery(ImageSelect): _iconlist_refs.append(icon_list) self.in_event = 0 - + # Remember arguments self.path = path; self.dataobj = dataobj; self.iconlist = icon_list; self.root = self.iconlist.root() - + self.old_photo_list = self.dataobj.getPhotoList()[:] + # Local object variables self.y = 0 self.remember_x = -1 @@ -257,7 +258,7 @@ class Gallery(ImageSelect): self.sel = None self.photo = None - def close(self): + def close(self,ok=0): self.iconlist.hide() for a in self.canvas_list.values(): a[0].destroy() @@ -265,6 +266,12 @@ class Gallery(ImageSelect): a[2].destroy() self.p_map = None self.canvas_list = None + # restore old photo list, in case we removed some and then + # hit cancel button or closed the window + if not ok: + if self.old_photo_list is not None: + self.dataobj.setPhotoList(self.old_photo_list) + def on_canvas1_event(self,obj,event): """ diff --git a/src/Marriage.py b/src/Marriage.py index efe464722..4a01815d6 100644 --- a/src/Marriage.py +++ b/src/Marriage.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2003 Donald N. Allingham +# Copyright (C) 2000-2004 Donald N. Allingham # # This program is free software; you can redistribute it and/or modiy # it under the terms of the GNU General Public License as published by @@ -471,6 +471,7 @@ class Marriage: return changed def cancel_callback(self): + self.gallery.close(0) Utils.destroy_passed_object(self.quit) def on_cancel_edit(self,obj): @@ -484,7 +485,8 @@ class Marriage: self.cancel_callback, self.save) else: - Utils.destroy_passed_object(obj) + self.gallery.close(0) + Utils.destroy_passed_object(obj) def on_delete_event(self,obj,b): self.on_cancel_edit(obj) @@ -575,6 +577,7 @@ class Marriage: ord.setPlace(place) Utils.modified() + self.gallery.close(1) Utils.destroy_passed_object(self.get_widget("marriageEditor")) if self.lists_changed: diff --git a/src/gramps.glade b/src/gramps.glade index 0f5a79181..5257e58e7 100644 --- a/src/gramps.glade +++ b/src/gramps.glade @@ -6107,6 +6107,7 @@ _Edit... True GTK_RELIEF_NORMAL + 0