Handle deleting of images
svn: r1101
This commit is contained in:
parent
684191d168
commit
1572cd1a89
@ -94,7 +94,7 @@ class EditPerson:
|
|||||||
self.load_obj = None
|
self.load_obj = None
|
||||||
self.top = libglade.GladeXML(const.editPersonFile, "editPerson")
|
self.top = libglade.GladeXML(const.editPersonFile, "editPerson")
|
||||||
gwidget = self.top.get_widget("photolist")
|
gwidget = self.top.get_widget("photolist")
|
||||||
self.gallery = ImageSelect.Gallery(person, self.path, gwidget, self.db)
|
self.gallery = ImageSelect.Gallery(person, self.path, gwidget, self.db, self)
|
||||||
|
|
||||||
self.name_update_btn = self.top.get_widget('aka_update')
|
self.name_update_btn = self.top.get_widget('aka_update')
|
||||||
self.name_delete_btn = self.top.get_widget('aka_delete')
|
self.name_delete_btn = self.top.get_widget('aka_delete')
|
||||||
@ -780,12 +780,8 @@ class EditPerson:
|
|||||||
text = self.notes_field.get_chars(0,-1)
|
text = self.notes_field.get_chars(0,-1)
|
||||||
idval = self.gid.get_text()
|
idval = self.gid.get_text()
|
||||||
|
|
||||||
# self.pmap = {}
|
|
||||||
# for key in db.getPlaceKeys():
|
|
||||||
# p = db.getPlaceDisplay(key)
|
|
||||||
# self.pmap[p[0]] = key
|
|
||||||
|
|
||||||
changed = 0
|
changed = 0
|
||||||
|
print self.lists_changed
|
||||||
name = self.person.getPrimaryName()
|
name = self.person.getPrimaryName()
|
||||||
|
|
||||||
if self.person.getId() != idval:
|
if self.person.getId() != idval:
|
||||||
|
@ -78,7 +78,7 @@ class EditPlace:
|
|||||||
|
|
||||||
self.top_window = libglade.GladeXML(const.placesFile,"placeEditor")
|
self.top_window = libglade.GladeXML(const.placesFile,"placeEditor")
|
||||||
plwidget = self.top_window.get_widget("photolist")
|
plwidget = self.top_window.get_widget("photolist")
|
||||||
self.glry = ImageSelect.Gallery(place, self.path, plwidget, db)
|
self.glry = ImageSelect.Gallery(place, self.path, plwidget, db, self)
|
||||||
self.title = self.top_window.get_widget("place_title")
|
self.title = self.top_window.get_widget("place_title")
|
||||||
self.city = self.top_window.get_widget("city")
|
self.city = self.top_window.get_widget("city")
|
||||||
self.parish = self.top_window.get_widget("parish")
|
self.parish = self.top_window.get_widget("parish")
|
||||||
|
@ -58,7 +58,7 @@ class EditSource:
|
|||||||
|
|
||||||
self.top_window = libglade.GladeXML(const.gladeFile,"sourceEditor")
|
self.top_window = libglade.GladeXML(const.gladeFile,"sourceEditor")
|
||||||
plwidget = self.top_window.get_widget("photolist")
|
plwidget = self.top_window.get_widget("photolist")
|
||||||
self.gallery = ImageSelect.Gallery(source, self.path, plwidget, db)
|
self.gallery = ImageSelect.Gallery(source, self.path, plwidget, db, self)
|
||||||
self.title = self.top_window.get_widget("source_title")
|
self.title = self.top_window.get_widget("source_title")
|
||||||
self.author = self.top_window.get_widget("author")
|
self.author = self.top_window.get_widget("author")
|
||||||
self.pubinfo = self.top_window.get_widget("pubinfo")
|
self.pubinfo = self.top_window.get_widget("pubinfo")
|
||||||
|
@ -65,12 +65,13 @@ _ = gettext
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class ImageSelect:
|
class ImageSelect:
|
||||||
|
|
||||||
def __init__(self, path, db):
|
def __init__(self, path, db, parent):
|
||||||
"""Creates an edit window. Associates a person with the window."""
|
"""Creates an edit window. Associates a person with the window."""
|
||||||
self.path = path;
|
self.path = path;
|
||||||
self.db = db
|
self.db = db
|
||||||
self.dataobj = None
|
self.dataobj = None
|
||||||
self.icon_cache = []
|
self.icon_cache = []
|
||||||
|
self.parent = parent
|
||||||
|
|
||||||
def add_thumbnail(self, photo):
|
def add_thumbnail(self, photo):
|
||||||
"should be overrridden"
|
"should be overrridden"
|
||||||
@ -169,7 +170,7 @@ class ImageSelect:
|
|||||||
mobj.setLocal(1)
|
mobj.setLocal(1)
|
||||||
mobj.setPath(name)
|
mobj.setPath(name)
|
||||||
|
|
||||||
Utils.modified()
|
self.parent.lists_changed = 1
|
||||||
Utils.destroy_passed_object(obj)
|
Utils.destroy_passed_object(obj)
|
||||||
self.load_images()
|
self.load_images()
|
||||||
|
|
||||||
@ -185,8 +186,8 @@ class ImageSelect:
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class Gallery(ImageSelect):
|
class Gallery(ImageSelect):
|
||||||
def __init__(self, dataobj, path, icon_list, db):
|
def __init__(self, dataobj, path, icon_list, db, parent):
|
||||||
ImageSelect.__init__(self, path, db)
|
ImageSelect.__init__(self, path, db, parent)
|
||||||
|
|
||||||
t = [
|
t = [
|
||||||
('STRING', 0, 0),
|
('STRING', 0, 0),
|
||||||
@ -272,8 +273,9 @@ class Gallery(ImageSelect):
|
|||||||
name = RelImage.import_media_object(name,self.path,photo.getId())
|
name = RelImage.import_media_object(name,self.path,photo.getId())
|
||||||
photo.setPath(name)
|
photo.setPath(name)
|
||||||
photo.setLocal(1)
|
photo.setLocal(1)
|
||||||
Utils.modified()
|
self.parent.lists_changed = 1
|
||||||
if GrampsCfg.globalprop:
|
if GrampsCfg.globalprop:
|
||||||
|
Utils.modified()
|
||||||
GlobalMediaProperties(self.db,photo,None)
|
GlobalMediaProperties(self.db,photo,None)
|
||||||
elif protocol != "":
|
elif protocol != "":
|
||||||
import urllib
|
import urllib
|
||||||
@ -305,8 +307,9 @@ class Gallery(ImageSelect):
|
|||||||
w.drag_finish(context, 1, 0, time)
|
w.drag_finish(context, 1, 0, time)
|
||||||
return
|
return
|
||||||
self.add_thumbnail(oref)
|
self.add_thumbnail(oref)
|
||||||
Utils.modified()
|
self.parent.lists_changed = 1
|
||||||
if GrampsCfg.globalprop:
|
if GrampsCfg.globalprop:
|
||||||
|
Utils.modified()
|
||||||
GlobalMediaProperties(self.db,photo,None)
|
GlobalMediaProperties(self.db,photo,None)
|
||||||
else:
|
else:
|
||||||
if self.db.getObjectMap().has_key(data.data):
|
if self.db.getObjectMap().has_key(data.data):
|
||||||
@ -328,6 +331,7 @@ class Gallery(ImageSelect):
|
|||||||
nl = nl[0:icon_index] + [item] + nl[icon_index:]
|
nl = nl[0:icon_index] + [item] + nl[icon_index:]
|
||||||
self.dataobj.setPhotoList(nl)
|
self.dataobj.setPhotoList(nl)
|
||||||
Utils.modified()
|
Utils.modified()
|
||||||
|
self.parent.lists_changed = 1
|
||||||
self.load_images()
|
self.load_images()
|
||||||
return
|
return
|
||||||
index = index + 1
|
index = index + 1
|
||||||
@ -335,6 +339,7 @@ class Gallery(ImageSelect):
|
|||||||
oref.setReference(self.db.findObjectNoMap(data.data))
|
oref.setReference(self.db.findObjectNoMap(data.data))
|
||||||
self.dataobj.addPhoto(oref)
|
self.dataobj.addPhoto(oref)
|
||||||
self.add_thumbnail(oref)
|
self.add_thumbnail(oref)
|
||||||
|
self.parent.lists_changed = 1
|
||||||
if GrampsCfg.globalprop:
|
if GrampsCfg.globalprop:
|
||||||
LocalMediaProperties(oref,self.path)
|
LocalMediaProperties(oref,self.path)
|
||||||
Utils.modified()
|
Utils.modified()
|
||||||
@ -361,7 +366,10 @@ class Gallery(ImageSelect):
|
|||||||
icon = self.selectedIcon
|
icon = self.selectedIcon
|
||||||
if icon != -1:
|
if icon != -1:
|
||||||
self.icon_list.remove(icon)
|
self.icon_list.remove(icon)
|
||||||
del self.dataobj.getPhotoList()[icon]
|
list = self.dataobj.getPhotoList()
|
||||||
|
del list[icon]
|
||||||
|
self.dataobj.setPhotoList(list)
|
||||||
|
self.parent.lists_changed = 1
|
||||||
if len(self.dataobj.getPhotoList()) == 0:
|
if len(self.dataobj.getPhotoList()) == 0:
|
||||||
self.selectedIcon = -1
|
self.selectedIcon = -1
|
||||||
else:
|
else:
|
||||||
@ -498,9 +506,11 @@ class LocalMediaProperties:
|
|||||||
if text != note or priv != self.photo.getPrivacy():
|
if text != note or priv != self.photo.getPrivacy():
|
||||||
self.photo.setNote(text)
|
self.photo.setNote(text)
|
||||||
self.photo.setPrivacy(priv)
|
self.photo.setPrivacy(priv)
|
||||||
|
self.parent.lists_changed = 1
|
||||||
Utils.modified()
|
Utils.modified()
|
||||||
if self.lists_changed:
|
if self.lists_changed:
|
||||||
self.photo.setAttributeList(self.alist)
|
self.photo.setAttributeList(self.alist)
|
||||||
|
self.parent.lists_changed = 1
|
||||||
Utils.modified()
|
Utils.modified()
|
||||||
|
|
||||||
def on_ok_clicked(self, obj):
|
def on_ok_clicked(self, obj):
|
||||||
@ -673,9 +683,11 @@ class GlobalMediaProperties:
|
|||||||
if text != note or desc != self.object.getDescription():
|
if text != note or desc != self.object.getDescription():
|
||||||
self.object.setNote(text)
|
self.object.setNote(text)
|
||||||
self.object.setDescription(desc)
|
self.object.setDescription(desc)
|
||||||
|
self.parent.lists_changed = 1
|
||||||
Utils.modified()
|
Utils.modified()
|
||||||
if self.lists_changed:
|
if self.lists_changed:
|
||||||
self.object.setAttributeList(self.alist)
|
self.object.setAttributeList(self.alist)
|
||||||
|
self.parent.lists_changed = 1
|
||||||
Utils.modified()
|
Utils.modified()
|
||||||
if self.update != None:
|
if self.update != None:
|
||||||
self.update()
|
self.update()
|
||||||
|
@ -76,7 +76,7 @@ class Marriage:
|
|||||||
self.top = libglade.GladeXML(const.marriageFile,"marriageEditor")
|
self.top = libglade.GladeXML(const.marriageFile,"marriageEditor")
|
||||||
top_window = self.get_widget("marriageEditor")
|
top_window = self.get_widget("marriageEditor")
|
||||||
plwidget = self.top.get_widget("photolist")
|
plwidget = self.top.get_widget("photolist")
|
||||||
self.gallery = ImageSelect.Gallery(family, self.path, plwidget, db)
|
self.gallery = ImageSelect.Gallery(family, self.path, plwidget, db, self)
|
||||||
self.top.signal_autoconnect({
|
self.top.signal_autoconnect({
|
||||||
"destroy_passed_object" : self.on_cancel_edit,
|
"destroy_passed_object" : self.on_cancel_edit,
|
||||||
"on_up_clicked" : self.on_up_clicked,
|
"on_up_clicked" : self.on_up_clicked,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user