<br><br><div class="gmail_quote">On Fri, Jun 11, 2010 at 9:04 PM, James Cameron <span dir="ltr"><<a href="mailto:quozl@laptop.org">quozl@laptop.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On Fri, Jun 11, 2010 at 01:25:06AM -0300, Gonzalo Odiard wrote:<br>
> I think it works, but i don't know if the right thing to do.<br>
><br>
> From 97fb2adb1ea97a472e020244ae7a2d22c7a94db3 Mon Sep 17 00:00:00 2001<br>
> From: Gonzalo Odiard <<a href="mailto:godiard@gmail.com">godiard@gmail.com</a>><br>
> Date: Fri, 11 Jun 2010 01:22:36 -0300<br>
> Subject: [PATCH] fix #1771 - paint overwrites file type instead of creating new file<br>
><br>
<br>
</div>Your patch was missing an explanation in the commit message, but during<br>
review I tried to make an explanation. I'll put the explanation here<br>
and ask you to review it:<br>
<br>
"Paint only writes type image/png. It can load other types, but<br>
overwrites as image/png. This patch detects reading a type that is not<br>
image/png, and forgets the association between the image being edited<br>
and the journal entry that was read, so that the original journal entry<br>
is not overwritten."<br>
<br>
Does that match your understanding?<br></blockquote><div><br>Yes, it's ok. <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im"><br>
> <a href="http://bugs.sugarlabs.org/ticket/1771" target="_blank">http://bugs.sugarlabs.org/ticket/1771</a><br>
> ---<br>
> OficinaActivity.py | 5 ++++-<br>
> 1 files changed, 4 insertions(+), 1 deletions(-)<br>
><br>
> diff --git a/OficinaActivity.py b/OficinaActivity.py<br>
> index c72576a..78bc8cf 100644<br>
> --- a/OficinaActivity.py<br>
> +++ b/OficinaActivity.py<br>
> @@ -140,8 +140,8 @@ class OficinaActivity(activity.Activity):<br>
><br>
> def read_file(self, file_path):<br>
> '''Read file from Sugar Journal.'''<br>
> + print 'reading file', file_path, "mime_type", self.metadata<br>
> ['mime_type']<br>
><br>
> - logging.debug('reading file %s', file_path)<br>
<br>
</div>Why did you change this to print? If it was only temporary, change it<br>
back. If it is of use, change the logging.debug line.<br>
<br>
Hint: since the logging level can't be changed once Sugar is started, I<br>
change "debug" to "error" while I am testing code, and then change it<br>
back to "debug" before committing the patch.<br>
<div class="im"><br></div></blockquote><div>Was temporary, but your idea is better for debugging. <br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">
><br>
> pixbuf = gtk.gdk.pixbuf_new_from_file(file_path)<br>
><br>
> @@ -155,6 +155,9 @@ class OficinaActivity(activity.Activity):<br>
> self._setup_handle = self.fixed.connect('size_allocate',<br>
> size_allocate_cb)<br>
><br>
> + if self.metadata['mime_type'] != "image/png":<br>
> + self._jobject.object_id = None<br>
> +<br>
<br>
</div>A comment would be useful here, because reading the code doesn't explain<br>
why it is happening. Something like:<br>
<br>
# disassociate with journal entry to avoid overwrite (SL #1771)<br>
<div><div></div><div class="h5"><br>
> def write_file(self, file_path):<br>
> '''Save file on Sugar Journal. '''<br>
><br>
> --<br>
> 1.6.6.1<br>
<br></div></div></blockquote><div>I was thinking change the title also, because is unclear when you see two inputs in the journal with the same name but there are two different files.<br>May be changing the extension or setting the title empty. I don't know what it's better.<br>
<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div class="h5">
--<br>
</div></div><font color="#888888">James Cameron<br>
<a href="http://quozl.linux.org.au/" target="_blank">http://quozl.linux.org.au/</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Gonzalo Odiard<br>Responsable de Desarrollo<br>Sistemas Australes<br><br>