* src/EditPerson.py, src/AddMedia.py, src/ImageSelect.py, src/ReportUtils.py, src/SelectObject.py, src/plugins/Ancestors.py, src/plugins/IndivComplete.py, src/plugins/IndivSummary.py, src/plugins/WebPage.py, src/plugins/WriteCD.py: Dont crash with "note only" media object.
svn: r4594
This commit is contained in:
parent
8e7e8155f7
commit
fbefcf1eca
@ -8,7 +8,11 @@
|
||||
* src/RelLib.py: Add GRAMPS ID to get_text_data_list so this field is
|
||||
usable in full text search; Dont crash if get_text_data_list contains
|
||||
None values instead of empty strings.
|
||||
* src/EditPerson.py: Dont crash with "note only" media object.
|
||||
|
||||
* src/EditPerson.py, src/AddMedia.py, src/ImageSelect.py, src/ReportUtils.py,
|
||||
src/SelectObject.py, src/plugins/Ancestors.py, src/plugins/IndivComplete.py,
|
||||
src/plugins/IndivSummary.py, src/plugins/WebPage.py, src/plugins/WriteCD.py:
|
||||
Dont crash with "note only" media object.
|
||||
|
||||
2005-05-13 Don Allingham <don@gramps-project.org>
|
||||
* src/plugins/ScratchPad.py: fix GdkAtom index problem with pygtk2.4
|
||||
|
@ -159,8 +159,7 @@ class AddMediaObject:
|
||||
|
||||
if os.path.isfile(filename):
|
||||
mtype = GrampsMime.get_type(filename)
|
||||
|
||||
if mtype[0:5] == "image":
|
||||
if mtype and mtype.startswith("image"):
|
||||
image = RelImage.scale_image(filename,const.thumbScale)
|
||||
else:
|
||||
image = Utils.find_mime_type_pixbuf(mtype)
|
||||
|
@ -571,7 +571,7 @@ class EditPerson:
|
||||
if progname and len(progname) > 1:
|
||||
Utils.add_menuitem(menu,_("Open in %s") % progname[1],
|
||||
photo,self.popup_view_photo)
|
||||
if mtype[0:5] == "image":
|
||||
if mtype and mtype.startswith("image"):
|
||||
Utils.add_menuitem(menu,_("Edit with the GIMP"),
|
||||
photo,self.popup_edit_photo)
|
||||
Utils.add_menuitem(menu,_("Edit Object Properties"),photo,
|
||||
|
@ -154,7 +154,7 @@ class ImageSelect:
|
||||
|
||||
if os.path.isfile(filename):
|
||||
mtype = GrampsMime.get_type(filename)
|
||||
if mtype[0:5] == "image":
|
||||
if mtype and mtype.startswith("image"):
|
||||
image = RelImage.scale_image(filename,const.thumbScale)
|
||||
self.image.set_from_pixbuf(image)
|
||||
else:
|
||||
@ -381,7 +381,7 @@ class Gallery(ImageSelect):
|
||||
try:
|
||||
media_obj = self.db.get_object_from_handle(oid)
|
||||
mtype = media_obj.get_mime_type()
|
||||
if mtype[0:5] == "image":
|
||||
if mtype and mtype.startswith("image"):
|
||||
image = ImgManip.get_thumbnail_image(media_obj.get_path())
|
||||
else:
|
||||
image = Utils.find_mime_type_pixbuf(mtype)
|
||||
@ -614,7 +614,7 @@ class Gallery(ImageSelect):
|
||||
if progname and len(progname) > 1:
|
||||
Utils.add_menuitem(menu,_("Open in %s") % progname[1],
|
||||
photo,self.popup_view_photo)
|
||||
if mtype[0:5] == "image":
|
||||
if mtype and mtype.startswith("image"):
|
||||
Utils.add_menuitem(menu,_("Edit with the GIMP"),
|
||||
photo,self.popup_edit_photo)
|
||||
Utils.add_menuitem(menu,_("Edit Object Properties"),photo,
|
||||
|
@ -416,7 +416,8 @@ def insert_images(database, doc, person, w_cm=4.0, h_cm=4.0):
|
||||
for photo in photos :
|
||||
object_handle = photo.get_reference_handle()
|
||||
media_object = database.get_object_from_handle(object_handle)
|
||||
if media_object.get_mime_type()[0:5] == "image":
|
||||
mime_type = media_object.get_mime_type()
|
||||
if mime_type and mime_type.startswith("image"):
|
||||
filename = media_object.get_path()
|
||||
doc.add_media_object(filename,"row",w_cm,h_cm)
|
||||
|
||||
@ -1807,4 +1808,4 @@ def old_calc_age(database,person):
|
||||
if age == 0:
|
||||
age = death.get_day() + 31 - birth.get_day() # calc age in days
|
||||
units = 3 # day
|
||||
return (age,units)
|
||||
return (age,units)
|
||||
|
@ -116,7 +116,7 @@ class SelectObject:
|
||||
the_type = Utils.get_mime_description(obj.get_mime_type())
|
||||
path = obj.get_path()
|
||||
|
||||
if the_type[0:5] == "image":
|
||||
if the_type and the_type[0:5] == "image":
|
||||
image = ImgManip.get_thumbnail_image(obj.get_path())
|
||||
self.preview.set_from_pixbuf(image)
|
||||
else:
|
||||
|
@ -370,7 +370,8 @@ class ComprehensiveAncestorsReport (Report.Report):
|
||||
for media_ref in partner.get_media_list ()[:1]:
|
||||
object_handle = media_ref.get_reference_handle()
|
||||
mobject = self.database.get_object_from_handle(object_handle)
|
||||
if mobject.get_mime_type()[0:5] == "image":
|
||||
mime_type = mobject.get_mime_type()
|
||||
if mime_type and mime_type.startswith("image"):
|
||||
spouse.append ((self.doc.add_media_object,
|
||||
[mobject.get_path (),
|
||||
'right', 2, 2]))
|
||||
@ -403,7 +404,8 @@ class ComprehensiveAncestorsReport (Report.Report):
|
||||
for media_ref in photos[:1]:
|
||||
object_handle = media_ref.get_reference_handle()
|
||||
mobject = self.database.get_object_from_handle(object_handle)
|
||||
if mobject.get_mime_type()[0:5] == "image":
|
||||
mime_type = mobject.get_mime_type()
|
||||
if mime_type and mime_type.startswith("image"):
|
||||
ret.append ((self.doc.add_media_object,
|
||||
[mobject.get_path (), 'left', 2, 2]))
|
||||
ret.append ((self.doc.end_cell, []))
|
||||
|
@ -392,7 +392,8 @@ class IndivCompleteReport(Report.Report):
|
||||
if len(media_list) > 0:
|
||||
object_handle = media_list[0].get_reference_handle()
|
||||
object = self.database.get_object_from_handle(object_handle)
|
||||
if object.get_mime_type()[0:5] == "image":
|
||||
mime_type = object.get_mime_type()
|
||||
if mime_type and mime_type.startswith("image"):
|
||||
file = object.get_path()
|
||||
self.doc.start_paragraph("IDS-Normal")
|
||||
self.doc.add_media_object(file,"row",4.0,4.0)
|
||||
|
@ -211,7 +211,8 @@ class IndivSummary(Report.Report):
|
||||
if len(media_list) > 0:
|
||||
object_handle = media_list[0].get_reference_handle()
|
||||
object = self.database.get_object_from_handle(object_handle)
|
||||
if object.get_mime_type()[0:5] == "image":
|
||||
mime_type = object.get_mime_type()
|
||||
if mime_type and mime_type.startswith("image"):
|
||||
file = object.get_path()
|
||||
self.doc.start_paragraph("IVS-Normal")
|
||||
self.doc.add_media_object(file,"row",4.0,4.0)
|
||||
|
@ -294,7 +294,8 @@ class IndividualPage:
|
||||
if self.photos and len(media_list) > 0:
|
||||
object_handle = media_list[0].get_reference_handle()
|
||||
object = self.db.get_object_from_handle(object_handle)
|
||||
if object.get_mime_type()[0:5] == "image":
|
||||
mime_type = object.get_mime_type()
|
||||
if mime_type and mime_type.startswith("image"):
|
||||
src = object.get_path()
|
||||
junk,ext = os.path.splitext(src)
|
||||
base = '%s%s' % (object.get_gramps_id(),ext)
|
||||
@ -390,7 +391,8 @@ class IndividualPage:
|
||||
for object_ref in self.person.get_media_list():
|
||||
obj_id = object_ref.get_reference_handle()
|
||||
obj = self.db.get_object_from_handle(obj_id)
|
||||
if obj.get_mime_type()[0:5] != "image":
|
||||
mime_type = obj.get_mime_type()
|
||||
if not mime_type or not mime_type.startswith("image"):
|
||||
continue
|
||||
if object_ref.get_privacy():
|
||||
continue
|
||||
|
@ -121,7 +121,8 @@ class PackageWriter:
|
||||
root = os.path.basename(oldfile)
|
||||
if os.path.isfile(oldfile):
|
||||
self.copy_file(oldfile,'burn:///%s/%s' % (base,root))
|
||||
if obj.get_mime_type()[0:5] == "image":
|
||||
mime_type = obj.get_mime_type()
|
||||
if mime_type and mime_type.startswith("image"):
|
||||
self.make_thumbnail(base,root,obj.get_path())
|
||||
else:
|
||||
print "Warning: media file %s was not found," % root,\
|
||||
@ -223,7 +224,7 @@ class PackageWriter:
|
||||
if os.path.isfile(newfile):
|
||||
self.copy_file(newfile,'burn:///%s/%s' % (base,obase))
|
||||
ntype = GrampsMime.get_type(newfile)
|
||||
if ntype[0:5] == "image":
|
||||
if ntype and ntype.startswith("image"):
|
||||
self.make_thumbnail(base,obase,newfile)
|
||||
|
||||
fs_top = gtk.FileSelection("%s - GRAMPS" % _("Select file"))
|
||||
@ -244,7 +245,8 @@ class PackageWriter:
|
||||
root = os.path.basename(oldfile)
|
||||
if os.path.isfile(oldfile):
|
||||
self.copy_file(oldfile,'burn:///%s/%s' % (base,root))
|
||||
if obj.get_mime_type()[0:5] == "image":
|
||||
mime_type = obj.get_mime_type()
|
||||
if mime_type and mime_type.startswith("image"):
|
||||
self.make_thumbnail(base,root,obj.get_path())
|
||||
else:
|
||||
# File is lost => ask what to do
|
||||
|
Loading…
x
Reference in New Issue
Block a user