I want to add to the review made from James:<br><br>* the text tool from Paint is in bad state. I want to change it to support text styles and the actual approach don't allow it.<br>* there are variables with names in portuguese like janela and estadoTexto.  estadoTexto means text_status :(<br>
* estadoTexto use values like 1 and 0, like you did. I agree with James, it makes the code difficult to read and is a bad practice. <br><br>Then I propose:<br><br>* Create the constants and replace in the use with estadoTexto.<br>
* rename estadoTexto to text_status.<br>* put the part of Desenho.text where the text is printed in the image in a new method. At the start of OficinaActivity.write_file, verify the text_status and call the new method if necessary.<br>
<br>Regards<br><br>Gonzalo<br><br><br><div class="gmail_quote">On Sun, Oct 17, 2010 at 5:47 AM, Ishan Bansal <span dir="ltr"><<a href="mailto:ishan@seeta.in">ishan@seeta.in</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
New variable text_status defined which could keep the track of the status of<br>
text being entered and save it when activity is stopped.<br>
<br>
Signed-off-by: Ishan Bansal<<a href="mailto:ishan@seeta.in">ishan@seeta.in</a>>, Anubhav Aggarwal<<a href="mailto:anubhav@seeta.in">anubhav@seeta.in</a>><br>
---<br>
 Area.py |   11 +++++++++++<br>
 1 files changed, 11 insertions(+), 0 deletions(-)<br>
<br>
v1->v2: Patch updated<br>
<br>
diff --git a/Area.py b/Area.py<br>
index 2dca7da..a2db51b 100644<br>
--- a/Area.py<br>
+++ b/Area.py<br>
@@ -113,6 +113,8 @@ class Area(gtk.DrawingArea):<br>
         self.connect("leave_notify_event", self.mouseleave)<br>
         self.connect("enter_notify_event", self.mouseenter)<br>
<br>
+        self.text_status = -1<br>
+<br>
         target = [('text/uri-list', 0, TARGET_URI)]<br>
         self.drag_dest_set(gtk.DEST_DEFAULT_ALL, target,<br>
                 gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_MOVE)<br>
@@ -303,6 +305,7 @@ class Area(gtk.DrawingArea):<br>
         # text<br>
         if self.tool['name'] == 'text':<br>
             self.d.text(widget,event)<br>
+            self.text_status = 0<br>
<br>
         # This fixes a bug that made the text viewer get stuck in the canvas<br>
         elif self.estadoTexto is 1:<br>
@@ -473,6 +476,10 @@ class Area(gtk.DrawingArea):<br>
                 self.configure_line(self.line_size)<br>
                 self.d.polygon(widget,coords,True,self.tool['fill'],"moving")<br>
<br>
+        if self.tool['name'] == 'text':<br>
+           if self.text_status == 0:<br>
+              self.text_status = 1<br>
+<br>
         gtk.gdk.event_request_motions (event)<br>
<br>
     def mouseup(self,widget,event):<br>
@@ -571,6 +578,10 @@ class Area(gtk.DrawingArea):<br>
             size = self.tool['line size']<br>
             widget.queue_draw_area(self.x_cursor-size, self.y_cursor-size, size*2, size*2)<br>
<br>
+        if self.tool['name'] == 'text':<br>
+           if self.text_status == 1:<br>
+                  self.d.text(widget,event)<br>
+<br>
     def mouseenter(self, widget, event):<br>
         if self.tool['name'] in ['pencil','eraser','brush','rainbow']:<br>
             self.drawing = False<br>
<font color="#888888">--<br>
1.7.0.4<br>
<br>
_______________________________________________<br>
Sugar-devel mailing list<br>
<a href="mailto:Sugar-devel@lists.sugarlabs.org">Sugar-devel@lists.sugarlabs.org</a><br>
<a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a><br>
</font></blockquote></div><br>