Image handling improvements

svn: r1289
This commit is contained in:
Don Allingham 2003-02-08 19:16:12 +00:00
parent d2ef898a2d
commit 159bc7c44b
3 changed files with 5 additions and 8 deletions

View File

@ -161,6 +161,7 @@ class ImageSelect:
description = os.path.basename(filename) description = os.path.basename(filename)
mobj.setDescription(description) mobj.setDescription(description)
mobj.setMimeType(type) mobj.setMimeType(type)
self.savephoto(mobj)
if type[0:5] == "image": if type[0:5] == "image":
if self.external.get_active() == 0: if self.external.get_active() == 0:
@ -177,7 +178,6 @@ class ImageSelect:
mobj.getId()) mobj.getId())
mobj.setLocal(1) mobj.setLocal(1)
mobj.setPath(name) mobj.setPath(name)
self.savephoto(mobj)
self.parent.lists_changed = 1 self.parent.lists_changed = 1
Utils.destroy_passed_object(obj) Utils.destroy_passed_object(obj)
@ -316,7 +316,6 @@ class Gallery(ImageSelect):
oref = RelLib.ObjectRef() oref = RelLib.ObjectRef()
oref.setReference(photo) oref.setReference(photo)
self.dataobj.addPhoto(oref) self.dataobj.addPhoto(oref)
self.add_thumbnail(oref)
def add_thumbnail(self, photo): def add_thumbnail(self, photo):
"""Scale the image and add it to the IconList.""" """Scale the image and add it to the IconList."""
@ -331,6 +330,7 @@ class Gallery(ImageSelect):
import gobject import gobject
name = Utils.thumb_path(self.db.getSavePath(),object) name = Utils.thumb_path(self.db.getSavePath(),object)
description = object.getDescription() description = object.getDescription()
if len(description) > 20: if len(description) > 20:
description = "%s..." % description[0:20] description = "%s..." % description[0:20]
@ -527,9 +527,7 @@ class Gallery(ImageSelect):
menu of the available actions.""" menu of the available actions."""
menu = gtk.Menu() menu = gtk.Menu()
item = gtk.TearoffMenuItem() menu.set_title(_("Media Object"))
item.show()
menu.append(item)
object = photo.getReference() object = photo.getReference()
mtype = object.getMimeType() mtype = object.getMimeType()
progname = grampslib.default_application_name(mtype) progname = grampslib.default_application_name(mtype)

View File

@ -163,9 +163,7 @@ class MediaView:
ImageSelect.GlobalMediaProperties(self.db,object,self.load_media) ImageSelect.GlobalMediaProperties(self.db,object,self.load_media)
elif event.button == 3: elif event.button == 3:
menu = gtk.Menu() menu = gtk.Menu()
item = gtk.TearoffMenuItem() menu.set_title(_("Media Object"))
item.show()
menu.append(item)
self.obj = object self.obj = object
Utils.add_menuitem(menu,_("View in the default viewer"),None,self.popup_view_photo) Utils.add_menuitem(menu,_("View in the default viewer"),None,self.popup_view_photo)
if object.getMimeType()[0:5] == "image": if object.getMimeType()[0:5] == "image":

View File

@ -399,6 +399,7 @@ def birthday(person):
def thumb_path(dir,mobj): def thumb_path(dir,mobj):
type = mobj.getMimeType() type = mobj.getMimeType()
if type[0:5] == "image": if type[0:5] == "image":
thumb = "%s/.thumb/%s.jpg" % (dir,mobj.getId()) thumb = "%s/.thumb/%s.jpg" % (dir,mobj.getId())
try: try: