diff options
author | Pootle daemon <pootle@pootle.sugarlabs.org> | 2012-07-13 23:06:20 (GMT) |
---|---|---|
committer | Pootle daemon <pootle@pootle.sugarlabs.org> | 2012-07-13 23:06:20 (GMT) |
commit | f6ab25459ad1301860690afc59f52a045f034c61 (patch) | |
tree | 1ce95fc534fbc4cae16263e4c7e9823e1312c079 | |
parent | 5902db4acd8f442fd429a16709002ba27b462a18 (diff) | |
parent | 76cc48897a2bfb423241d4f5dc9acf771a283218 (diff) |
Merge branch 'master' of git.sugarlabs.org:portfolio/portfolio
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | PortfolioActivity.py | 12 | ||||
-rw-r--r-- | activity/activity.info | 2 | ||||
-rw-r--r-- | utils.py | 27 |
4 files changed, 42 insertions, 4 deletions
@@ -1,3 +1,8 @@ +26 + +ENHANCEMENTS: +* New translations, including Aymara and Quechua + 25 BUG FIX: diff --git a/PortfolioActivity.py b/PortfolioActivity.py index cf0ac21..673dcfb 100644 --- a/PortfolioActivity.py +++ b/PortfolioActivity.py @@ -39,7 +39,8 @@ from sugar.graphics.alert import Alert from sprites import Sprites, Sprite from exportpdf import save_pdf from utils import get_path, lighter_color, svg_str_to_pixbuf, \ - play_audio_from_file, get_pixbuf_from_journal, genblank, get_hardware + play_audio_from_file, get_pixbuf_from_journal, genblank, get_hardware, \ + svg_rectangle from toolbar_utils import radio_factory, \ button_factory, separator_factory, combo_factory, label_factory from grecord import Grecord @@ -564,12 +565,15 @@ class PortfolioActivity(activity.Activity): # _logger.debug('Showing slide %d', self.i) pixbuf = None media_object = False - try: + mimetype = None + if 'mime_type' in self.dsobjects[self.i].metadata: + mimetype = self.dsobjects[self.i].metadata['mime_type'] + if mimetype[0:5] == 'image': pixbuf = gtk.gdk.pixbuf_new_from_file_at_size( self.dsobjects[self.i].file_path, int(PREVIEWW * self._scale), int(PREVIEWH * self._scale)) media_object = True - except: + else: pixbuf = get_pixbuf_from_journal(self.dsobjects[self.i], 300, 225) if pixbuf is not None: @@ -671,6 +675,8 @@ class PortfolioActivity(activity.Activity): self.colors)) self._thumbs.append([Sprite(self._sprites, x, y, pixbuf_thumb), x, y, self.i]) + self._thumbs[-1][0].set_image(svg_str_to_pixbuf( + svg_rectangle(int(w), int(h), self.colors)), i=1) self._thumbs[-1][0].set_label(str(self.i + 1)) self._thumbs[self.i][0].set_layer(TOP) diff --git a/activity/activity.info b/activity/activity.info index a133acb..bb69dbc 100644 --- a/activity/activity.info +++ b/activity/activity.info @@ -1,6 +1,6 @@ [Activity] name = Portfolio -activity_version = 25 +activity_version = 26 license = GPLv3 bundle_id = org.sugarlabs.PortfolioActivity exec = sugar-activity PortfolioActivity.PortfolioActivity @@ -95,6 +95,33 @@ def svg_str_to_pixbuf(svg_string): return pixbuf +def svg_rectangle(width, height, colors): + ''' Generate a rectangle frame in two colors ''' + return \ +'<?xml version="1.0" encoding="UTF-8" standalone="no"?>\ +<svg\ + version="1.1"\ + width="%f"\ + height="%f">\ + <g>\ + <rect\ + width="%f"\ + height="%f"\ + x="2.5"\ + y="2.5"\ + style="fill:none;stroke:%s;stroke-width:5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />\ + <rect\ + width="%f"\ + height="%f"\ + x="7.5"\ + y="7.5"\ + style="fill:none;stroke:%s;stroke-width:5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />\ + </g>\ +</svg>' % (width, height, + width - 5, height - 5, colors[1], + width - 15, height - 15, colors[0]) + + def load_svg_from_file(file_path, width, height): '''Create a pixbuf from SVG in a file. ''' return gtk.gdk.pixbuf_new_from_file_at_size(file_path, width, height) |