4881: Convert bottombar gramplets to use the thumbnailer
svn: r17400
This commit is contained in:
@@ -61,8 +61,8 @@ class Gallery(Gramplet):
|
||||
full_path = Utils.media_path_full(self.dbstate.db, media.get_path())
|
||||
mime_type = media.get_mime_type()
|
||||
if mime_type and mime_type.startswith("image"):
|
||||
photo = Photo(180.0)
|
||||
photo.set_image(full_path, media_ref.get_rectangle())
|
||||
photo = Photo()
|
||||
photo.set_image(full_path, mime_type, media_ref.get_rectangle())
|
||||
self.image_list.append(photo)
|
||||
self.top.pack_start(photo, expand=False, fill=False)
|
||||
self.top.show_all()
|
||||
|
@@ -20,9 +20,7 @@
|
||||
#
|
||||
|
||||
from gen.plug import Gramplet
|
||||
from gui.utils import open_file_with_default_application
|
||||
import ThumbNails
|
||||
import const
|
||||
from gui.widgets import Photo
|
||||
import Utils
|
||||
import gtk
|
||||
|
||||
@@ -40,13 +38,8 @@ class MediaPreview(Gramplet):
|
||||
Build the GUI interface.
|
||||
"""
|
||||
self.top = gtk.HBox()
|
||||
self.thumbnail = gtk.Image()
|
||||
ebox = gtk.EventBox()
|
||||
ebox.add(self.thumbnail)
|
||||
ebox.connect('button-press-event', self.display_image)
|
||||
ebox.set_tooltip_text(
|
||||
_('Double click image to view in an external viewer'))
|
||||
self.top.pack_start(ebox, fill=True, expand=False, padding=5)
|
||||
self.photo = Photo()
|
||||
self.top.pack_start(self.photo, fill=True, expand=False, padding=5)
|
||||
self.top.show_all()
|
||||
return self.top
|
||||
|
||||
@@ -68,7 +61,7 @@ class MediaPreview(Gramplet):
|
||||
self.load_image(media)
|
||||
self.set_has_data(True)
|
||||
else:
|
||||
self.thumbnail.clear()
|
||||
self.photo.set_image(None)
|
||||
self.set_has_data(False)
|
||||
self.top.show()
|
||||
|
||||
@@ -79,13 +72,4 @@ class MediaPreview(Gramplet):
|
||||
self.full_path = Utils.media_path_full(self.dbstate.db,
|
||||
media.get_path())
|
||||
mime_type = media.get_mime_type()
|
||||
pixbuf = ThumbNails.get_thumbnail_image(self.full_path, mime_type)
|
||||
self.thumbnail.set_from_pixbuf(pixbuf)
|
||||
|
||||
def display_image(self, widget, event):
|
||||
"""
|
||||
Display the image with the default external viewer.
|
||||
"""
|
||||
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
|
||||
open_file_with_default_application(self.full_path)
|
||||
|
||||
self.photo.set_image(self.full_path, mime_type)
|
||||
|
@@ -45,7 +45,7 @@ class PersonDetails(Gramplet):
|
||||
"""
|
||||
self.top = gtk.HBox()
|
||||
vbox = gtk.VBox()
|
||||
self.photo = Photo(190.0)
|
||||
self.photo = Photo()
|
||||
self.photo.show()
|
||||
self.name = gtk.Label()
|
||||
self.name.set_alignment(0, 0)
|
||||
@@ -227,7 +227,8 @@ class PersonDetails(Gramplet):
|
||||
full_path = Utils.media_path_full(self.dbstate.db, obj.get_path())
|
||||
mime_type = obj.get_mime_type()
|
||||
if mime_type and mime_type.startswith("image"):
|
||||
self.photo.set_image(full_path, media_ref.get_rectangle())
|
||||
self.photo.set_image(full_path, mime_type,
|
||||
media_ref.get_rectangle())
|
||||
else:
|
||||
self.photo.set_image(None)
|
||||
else:
|
||||
|
@@ -42,7 +42,7 @@ class PlaceDetails(Gramplet):
|
||||
"""
|
||||
self.top = gtk.HBox()
|
||||
vbox = gtk.VBox()
|
||||
self.photo = Photo(190.0)
|
||||
self.photo = Photo()
|
||||
self.title = gtk.Label()
|
||||
self.title.set_alignment(0, 0)
|
||||
self.title.modify_font(pango.FontDescription('sans bold 12'))
|
||||
@@ -157,7 +157,8 @@ class PlaceDetails(Gramplet):
|
||||
full_path = Utils.media_path_full(self.dbstate.db, obj.get_path())
|
||||
mime_type = obj.get_mime_type()
|
||||
if mime_type and mime_type.startswith("image"):
|
||||
self.photo.set_image(full_path, media_ref.get_rectangle())
|
||||
self.photo.set_image(full_path, mime_type,
|
||||
media_ref.get_rectangle())
|
||||
else:
|
||||
self.photo.set_image(None)
|
||||
else:
|
||||
|
@@ -113,6 +113,8 @@ class RepositoryDetails(Gramplet):
|
||||
|
||||
self.display_url(repo, UrlType(UrlType.EMAIL))
|
||||
self.display_url(repo, UrlType(UrlType.WEB_HOME))
|
||||
self.display_url(repo, UrlType(UrlType.WEB_SEARCH))
|
||||
self.display_url(repo, UrlType(UrlType.WEB_FTP))
|
||||
|
||||
def display_address(self, address):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user