Fixed SaveDate when date is None

svn: r495
This commit is contained in:
Don Allingham 2001-10-19 14:52:39 +00:00
parent 8de449b106
commit 9466349afb
3 changed files with 6 additions and 5 deletions

View File

@ -262,6 +262,7 @@ class Gallery(ImageSelect):
GnomeErrorDialog("%s\n%s %d" % (t,msg[0],msg[1])) GnomeErrorDialog("%s\n%s %d" % (t,msg[0],msg[1]))
return return
mime = utils.get_mime_type(tfile) mime = utils.get_mime_type(tfile)
print mime
photo = Photo() photo = Photo()
photo.setMimeType(mime) photo.setMimeType(mime)
photo.setDescription(d) photo.setDescription(d)

View File

@ -35,8 +35,10 @@ _ = intl.gettext
try: try:
import PIL.Image import PIL.Image
no_pil = 0 no_pil = 0
print "pil ok"
except: except:
no_pil = 1 no_pil = 1
print "pil bad"
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -61,10 +63,6 @@ def import_media_object(filename,path,base):
except: except:
GnomeErrorDialog(_("Could not create %s") % thumb) GnomeErrorDialog(_("Could not create %s") % thumb)
path = "%s/%s" % (thumb,base)
mk_thumb(filename,path,const.thumbScale)
try: try:
path = "%s/%s" % (thumb,base) path = "%s/%s" % (thumb,base)
@ -129,11 +127,13 @@ def mk_thumb(source,dest,size):
if no_pil: if no_pil:
cmd = "%s -geometry %dx%d '%s' '%s'" % (const.convert,size,size,source,dest) cmd = "%s -geometry %dx%d '%s' '%s'" % (const.convert,size,size,source,dest)
print cmd
os.system(cmd) os.system(cmd)
else: else:
try: try:
im = PIL.Image.open(source) im = PIL.Image.open(source)
im.thumbnail((size,size)) im.thumbnail((size,size))
print "save",source,dest
im.save(dest,"JPEG") im.save(dest,"JPEG")
except: except:
pass pass

View File

@ -1105,7 +1105,7 @@ class Event(DataObj):
def getSaveDate(self) : def getSaveDate(self) :
"""returns the date of the Event in the form wanted by gramps XML save""" """returns the date of the Event in the form wanted by gramps XML save"""
if not self.date: if self.date:
return self.date.getSaveDate() return self.date.getSaveDate()
return "" return ""