From eeae5d011f696b68a16e9b6a35451cda3308a381 Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Fri, 5 Oct 2007 22:39:45 +0200 Subject: [PATCH] Save activity previews to the datastore as binary png images. --- NEWS | 2 ++ sugar/activity/activity.py | 6 ++---- sugar/datastore/dbus_helpers.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 4c076b86..3b6b15ba 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ +* Save activity previews to the datastore as binary png images. (tomeu) + Snapshot acca55e861 * #3905 Wait 3 seconds, rather than 3000, if NetworkManager doesn't respond diff --git a/sugar/activity/activity.py b/sugar/activity/activity.py index b3bbcba6..ca711109 100644 --- a/sugar/activity/activity.py +++ b/sugar/activity/activity.py @@ -449,9 +449,7 @@ class Activity(Window, gtk.Container): f.close() os.remove(file_path) - # TODO: Take this out when the datastore accepts binary data. - import base64 - return base64.b64encode(preview_data) + return preview_data def _get_buddies(self): if self._shared_activity is not None: @@ -481,7 +479,7 @@ class Activity(Window, gtk.Container): if self._preview is None: self.metadata['preview'] = '' else: - self.metadata['preview'] = self._preview + self.metadata['preview'] = dbus.ByteArray(self._preview) try: if self._jobject.file_path: diff --git a/sugar/datastore/dbus_helpers.py b/sugar/datastore/dbus_helpers.py index a10feec8..752b0cc6 100644 --- a/sugar/datastore/dbus_helpers.py +++ b/sugar/datastore/dbus_helpers.py @@ -67,7 +67,7 @@ def delete(uid): def get_properties(uid): logging.debug('dbus_helpers.get_properties: %s' % uid) - return _get_data_store().get_properties(uid) + return _get_data_store().get_properties(uid, byte_arrays=True) def get_filename(uid): filename = _get_data_store().get_filename(uid)