* src/gramps_main.py: remove local media concept

* src/RelLib.py: remove local media concept
* src/SelectObject.py: remove local media concept


svn: r2941
This commit is contained in:
Don Allingham 2004-03-01 04:33:36 +00:00
parent 795884a4b9
commit 1dc949b752
3 changed files with 14 additions and 32 deletions

View File

@ -597,33 +597,33 @@ class MediaObject(SourceNote):
if source:
self.path = source.path
self.mime = source.mime
self.local = source.local
self.desc = source.desc
self.id = source.id
self.thumb = source.thumb
for attr in source.attrlist:
self.attrlist.append(Attribute(attr))
else:
self.id = ""
self.local = 0
self.path = ""
self.mime = ""
self.desc = ""
self.thumb = None
def serialize(self):
return (self.id, self.local, self.path, self.mime, self.desc, self.attrlist,
return (self.id, self.path, self.mime, self.desc, self.attrlist,
self.source_list, self.note)
def unserialize(self,data):
(self.id, self.local, self.path, self.mime, self.desc, self.attrlist,
(self.id, self.thumb, self.path, self.mime, self.desc, self.attrlist,
self.source_list, self.note) = data
def set_local(self,val):
"""set or clear the local flag"""
self.local = val
def set_thumbnail(self,thumb):
"""set the thumbnail"""
self.thumb = thumb
def get_local(self):
"""return the local flag"""
return self.local
def get_thumbnail(self):
"""return the thumbnail"""
return self.thumb
def set_id(self,id):
"""Sets the gramps ID for the place object"""

View File

@ -98,14 +98,11 @@ class SelectObject:
self.object_model.clear()
self.object_model.new_model()
for key in self.db.get_object_map().keys():
for key in self.db.get_object_keys():
object = self.db.get_object(key)
title = object.get_description()
the_id = object.get_id()
the_type = Utils.get_mime_description(object.get_mime_type())
if object.get_local():
path = "<local copy>"
else:
path = object.get_path()
self.object_model.add([title,the_id,the_type,path],key)

View File

@ -792,22 +792,7 @@ class Gramps:
can delete any thumbnail images. The thumbnails may or may not exist, depending
on if the image was previewed.
"""
for obj in self.db.get_added_media_objects():
if obj.get_local():
try:
os.unlink(obj.get_path())
except IOError:
pass
except:
DisplayTrace.DisplayTrace()
thumb = "%s/.thumb/%s.jpg" % (self.db.get_save_path(),obj.get_id())
if os.path.isfile(thumb):
try:
os.unlink(thumb)
except IOError:
pass
except:
DisplayTrace.DisplayTrace()
def on_about_activate(self,obj):
"""Displays the about box. Called from Help menu"""
@ -1095,7 +1080,7 @@ class Gramps:
#-------------------------------------------------------------------------
for ObjectId in self.db.get_object_keys():
object = self.db.find_object_from_id(ObjectId)
if object.get_local():
if 0:
oldfile = object.get_path()
(base,ext) = os.path.splitext(os.path.basename(oldfile))
newfile = os.path.join(filename,os.path.basename(oldfile))