* 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: if source:
self.path = source.path self.path = source.path
self.mime = source.mime self.mime = source.mime
self.local = source.local
self.desc = source.desc self.desc = source.desc
self.id = source.id self.id = source.id
self.thumb = source.thumb
for attr in source.attrlist: for attr in source.attrlist:
self.attrlist.append(Attribute(attr)) self.attrlist.append(Attribute(attr))
else: else:
self.id = "" self.id = ""
self.local = 0
self.path = "" self.path = ""
self.mime = "" self.mime = ""
self.desc = "" self.desc = ""
self.thumb = None
def serialize(self): 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) self.source_list, self.note)
def unserialize(self,data): 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 self.source_list, self.note) = data
def set_local(self,val): def set_thumbnail(self,thumb):
"""set or clear the local flag""" """set the thumbnail"""
self.local = val self.thumb = thumb
def get_local(self): def get_thumbnail(self):
"""return the local flag""" """return the thumbnail"""
return self.local return self.thumb
def set_id(self,id): def set_id(self,id):
"""Sets the gramps ID for the place object""" """Sets the gramps ID for the place object"""

View File

@ -98,15 +98,12 @@ class SelectObject:
self.object_model.clear() self.object_model.clear()
self.object_model.new_model() 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) object = self.db.get_object(key)
title = object.get_description() title = object.get_description()
the_id = object.get_id() the_id = object.get_id()
the_type = Utils.get_mime_description(object.get_mime_type()) the_type = Utils.get_mime_description(object.get_mime_type())
if object.get_local(): path = object.get_path()
path = "<local copy>"
else:
path = object.get_path()
self.object_model.add([title,the_id,the_type,path],key) self.object_model.add([title,the_id,the_type,path],key)
self.object_model.connect_model() self.object_model.connect_model()

View File

@ -792,22 +792,7 @@ class Gramps:
can delete any thumbnail images. The thumbnails may or may not exist, depending can delete any thumbnail images. The thumbnails may or may not exist, depending
on if the image was previewed. on if the image was previewed.
""" """
for obj in self.db.get_added_media_objects(): pass
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): def on_about_activate(self,obj):
"""Displays the about box. Called from Help menu""" """Displays the about box. Called from Help menu"""
@ -1095,7 +1080,7 @@ class Gramps:
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
for ObjectId in self.db.get_object_keys(): for ObjectId in self.db.get_object_keys():
object = self.db.find_object_from_id(ObjectId) object = self.db.find_object_from_id(ObjectId)
if object.get_local(): if 0:
oldfile = object.get_path() oldfile = object.get_path()
(base,ext) = os.path.splitext(os.path.basename(oldfile)) (base,ext) = os.path.splitext(os.path.basename(oldfile))
newfile = os.path.join(filename,os.path.basename(oldfile)) newfile = os.path.join(filename,os.path.basename(oldfile))