[pitivi: 3/4] previewer: use the appointment-soon icon as the default thumb icon.
- From: Edward Hervey <edwardrv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi: 3/4] previewer: use the appointment-soon icon as the default thumb icon.
- Date: Wed, 14 Jul 2010 09:21:44 +0000 (UTC)
commit cb1eccc2db0b6d86a1c18e205b7dd78a3c2e1508
Author: Andrew Higginson <rugby471 gmail com>
Date: Mon Jul 12 12:17:18 2010 +0200
previewer: use the appointment-soon icon as the default thumb icon.
pitivi/ui/previewer.py | 23 +++++++++++++++++++++--
1 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/pitivi/ui/previewer.py b/pitivi/ui/previewer.py
index 971912c..d4be972 100644
--- a/pitivi/ui/previewer.py
+++ b/pitivi/ui/previewer.py
@@ -28,6 +28,8 @@ import gobject
import gst
import cairo
import os
+import gtk
+import rsvg
from gettext import gettext as _
import pitivi.utils as utils
from pitivi.configure import get_pixmap_dir
@@ -150,8 +152,25 @@ class Previewer(Signallable, Loggable):
def __init__(self, instance, factory, stream_):
Loggable.__init__(self)
# create default thumbnail
- path = os.path.join(get_pixmap_dir(), self.__DEFAULT_THUMB__)
- self.default_thumb = cairo.ImageSurface.create_from_png(path)
+ icon_theme = gtk.icon_theme_get_default()
+ icon = icon_theme.lookup_icon("appointment-soon", 48, ())
+ # If we can't find the appointment-soon icon, use our own
+ if icon is None:
+ path = os.path.join(get_pixmap_dir(), self.__DEFAULT_THUMB__)
+ else:
+ path = icon.get_filename()
+
+ # If it is an SVG, we have to render to cairo using librsvg
+ if path.endswith(".svg"):
+ handle = rsvg.Handle(file=path)
+ (width, height, width_fl, height_fl) = handle.get_dimension_data()
+ surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height)
+ cr = cairo.Context(surface)
+ handle.render_cairo(cr)
+ self.default_thumb = surface
+ else:
+ # Easy for PNGs
+ self.default_thumb = cairo.ImageSurface.create_from_png(path)
self._connectSettings(instance.settings)
def render_cairo(self, cr, bounds, element, y1):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]