diff options
author | Walter Bender <walter.bender@gmail.com> | 2012-07-26 02:04:54 (GMT) |
---|---|---|
committer | Walter Bender <walter.bender@gmail.com> | 2012-07-26 02:04:54 (GMT) |
commit | 5175cc49ecd4e4562c508e96fc485761184a0f08 (patch) | |
tree | fcfebe551cf3e594ed270b27aa3f63340303cf6e | |
parent | 76cc48897a2bfb423241d4f5dc9acf771a283218 (diff) |
add description to PDF output
-rw-r--r-- | PortfolioActivity.py | 37 | ||||
-rw-r--r-- | exportpdf.py | 5 |
2 files changed, 10 insertions, 32 deletions
diff --git a/PortfolioActivity.py b/PortfolioActivity.py index 673dcfb..0da6d4f 100644 --- a/PortfolioActivity.py +++ b/PortfolioActivity.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -#Copyright (c) 2011 Walter Bender +#Copyright (c) 2011, 2012 Walter Bender # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -460,34 +460,14 @@ class PortfolioActivity(activity.Activity): self._timeout_id = gobject.timeout_add(int(self._rate * 1000), self._loop) - def _bump_test(self): - ''' Test for accelerometer event (XO 1.75 only). ''' - if self._thumbnail_mode: - return - - self._bump_id = None - - fh = open('/sys/devices/platform/lis3lv02d/position') - string = fh.read() - fh.close() - xyz = string[1:-2].split(',') - dx = int(xyz[0]) - - if dx > 250: - if self.i < self._nobjects - 2: - self.i += 1 - self._show_slide() - elif dx < -250: - if self.i > 0: - self.i -= 1 - self._show_slide() - else: - self._bump_id = gobject.timeout_add(int(100), self._bump_test) - def _save_as_pdf_cb(self, button=None): ''' Export an PDF version of the slideshow to the Journal. ''' _logger.debug('saving to PDF...') - tmp_file = save_pdf(self, profile.get_nick_name()) + if 'description' in self.metadata: + tmp_file = save_pdf(self, profile.get_nick_name(), + description=self.metadata['description']) + else: + tmp_file = save_pdf(self, profile.get_nick_name()) _logger.debug('copying PDF file to Journal...') dsobject = datastore.create() @@ -611,11 +591,6 @@ class PortfolioActivity(activity.Activity): self._playback_button.set_icon('media-playback-start-insensitive') self._playback_button.set_tooltip(_('Nothing to play')) - if self._hw == XO175: - if hasattr(self, '_bump_id') and self._bump_id is not None: - gobject.source_remove(self._bump_id) - self._bump_id = gobject.timeout_add(1000, self._bump_test) - def _slides_cb(self, button=None): if self._thumbnail_mode: self._thumbnail_mode = False diff --git a/exportpdf.py b/exportpdf.py index 0650858..e01a788 100644 --- a/exportpdf.py +++ b/exportpdf.py @@ -33,7 +33,7 @@ LEFT_MARGIN = 10 TOP_MARGIN = 20 -def save_pdf(activity, nick): +def save_pdf(activity, nick, description=None): ''' Output a PDF document from the title, pictures, and descriptions ''' if len(activity.dsobjects) == 0: @@ -49,6 +49,9 @@ def save_pdf(activity, nick): show_text(cr, fd, nick, HEAD, LEFT_MARGIN, TOP_MARGIN) show_text(cr, fd, time.strftime('%x', time.localtime()), BODY, LEFT_MARGIN, TOP_MARGIN + 3 * HEAD) + if description is not None: + show_text(cr, fd, description, + BODY, LEFT_MARGIN, TOP_MARGIN + 4 * HEAD) cr.show_page() for i, dsobj in enumerate(activity.dsobjects): |