Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/OficinaActivity.py
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2010-06-12 04:14:40 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2010-06-12 04:14:40 (GMT)
commit976b5a4b0e8a4f4769f449d5357e22f04a4b4afd (patch)
tree0c38e43090cf2f3aaa0d86909cf9980b5e43e38f /OficinaActivity.py
parent2157f1c9c2f1b3136e26359d2e2a836778ac3aa4 (diff)
fix #1771 - paint overwrites file type instead of creating new file
Paint only writes type image/png. It can load other types, but overwrites as image/png. This patch detects reading a type that is not image/png, and forgets the association between the image being edited and the journal entry that was read, so that the original journal entry is not overwritten. http://bugs.sugarlabs.org/ticket/1771
Diffstat (limited to 'OficinaActivity.py')
-rw-r--r--OficinaActivity.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/OficinaActivity.py b/OficinaActivity.py
index c72576a..21ccc04 100644
--- a/OficinaActivity.py
+++ b/OficinaActivity.py
@@ -140,8 +140,7 @@ class OficinaActivity(activity.Activity):
def read_file(self, file_path):
'''Read file from Sugar Journal.'''
-
- logging.debug('reading file %s', file_path)
+ logging.debug('reading file %s, mimetype: %s, title: %s', file_path, self.metadata['mime_type'],self.metadata['title'])
pixbuf = gtk.gdk.pixbuf_new_from_file(file_path)
@@ -155,6 +154,14 @@ class OficinaActivity(activity.Activity):
self._setup_handle = self.fixed.connect('size_allocate',
size_allocate_cb)
+ # disassociate with journal entry to avoid overwrite (SL #1771)
+ if self.metadata['mime_type'] != "image/png":
+ self._jobject.object_id = None
+ last_point_posi = self.metadata['title'].rfind('.')
+ if last_point_posi > -1:
+ self.metadata['title'] = self.metadata['title'][0:last_point_posi] + '.png'
+ logging.error('title: %s', self.metadata['title'])
+
def write_file(self, file_path):
'''Save file on Sugar Journal. '''