* 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.


svn: r2783
This commit is contained in:
Alex Roitman 2004-02-06 20:57:01 +00:00
parent 3546fae555
commit 50332acbfd
7 changed files with 42 additions and 14 deletions

View File

@ -1,3 +1,11 @@
2004-02-06 Alex Roitman <shura@alex.neuro.umn.edu>
* 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 <shura@alex.neuro.umn.edu>
* src/plugins/Merge.py (gen_key,name_compare):
Fall back to not using soundex if the charset can't be latin-1 encoded.

View File

@ -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):

View File

@ -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):
@ -319,6 +320,7 @@ class EditPlace:
self.place.setNoteFormat(format)
Utils.modified()
self.gallery_ok = 1
self.update_lists()
if self.callback:

View File

@ -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:

View File

@ -247,6 +247,7 @@ class Gallery(ImageSelect):
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
@ -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):
"""

View File

@ -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,6 +485,7 @@ class Marriage:
self.cancel_callback,
self.save)
else:
self.gallery.close(0)
Utils.destroy_passed_object(obj)
def on_delete_event(self,obj,b):
@ -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:

View File

@ -6107,6 +6107,7 @@
<property name="label" translatable="yes">_Edit...</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<signal name="clicked" handler="on_editphoto_clicked" object="sourceEditor" last_modification_time="Fri, 06 Feb 2004 20:06:09 GMT"/>
</widget>
<packing>
<property name="padding">0</property>