FYI<br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Gonzalo Odiard</b> <span dir="ltr"><<a href="mailto:gonzalo@laptop.org">gonzalo@laptop.org</a>></span><br>
Date: Fri, Oct 22, 2010 at 11:56 PM<br>Subject: Re: [Dextrose] [PATCH v3 PaintActivity] New suggestion for arrow drawing in Paint<br>To: Anurag Chowdhury <<a href="mailto:anurag@seeta.in">anurag@seeta.in</a>><br>Cc: Manusheel Gupta <<a href="mailto:manu@seeta.in">manu@seeta.in</a>><br>
<br><br>Change commited.<br><font color="#888888"><br>Gonzalo</font><div><div></div><div class="h5"><br><br><div class="gmail_quote">On Fri, Oct 22, 2010 at 1:49 PM, Anurag Chowdhury <span dir="ltr"><<a href="mailto:anurag@seeta.in" target="_blank">anurag@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">
I have added the patch to the ticket . <div>Also, can you tell  me if there is any thing more to be added or improved in the patch.</div><div>And can I add you to the Reviewed-By tag in the patch?</div><div><br></div><div>


Regards</div><div>Anurag<div><div></div><div><br><br><div class="gmail_quote">On Fri, Oct 22, 2010 at 4:13 PM, Gonzalo Odiard <span dir="ltr"><<a href="mailto:gonzalo@laptop.org" target="_blank">gonzalo@laptop.org</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">
Please, add the patch to the ticket </blockquote><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex"><font color="#888888"><br>Gonzalo<br><br></font><div class="gmail_quote">


<div><div></div><div>On Fri, Oct 22, 2010 at 12:12 AM, Anurag Chowdhury <span dir="ltr"><<a href="mailto:anurag@seeta.in" target="_blank">anurag@seeta.in</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex"><div><div></div><div><div>In the paint activity's shape tool we were able to make only horizontal arrows,<br>




so now we have modified the arrow tool which will now make arrows in all<br>
directions.<br>
---<br>
</div> Desenho.py |   31 ++++++++++++++++++++++---------<br>
 1 files changed, 22 insertions(+), 9 deletions(-)<br>
<div><br>
v1->v2 :Removed the vertical-arrow tool and modified the arrow tool to enable<br>
drawing arrows in all directions.<br>
</div>v2->v3 :Fixed the error of two extra lines when made the arrow with a different<br>
colour border<br>
<div><br>
diff --git a/Desenho.py b/Desenho.py<br>
</div>index 3be1910..1b16ccd 100644<br>
<div>--- a/Desenho.py<br>
+++ b/Desenho.py<br>
</div>@@ -294,18 +294,31 @@ class Desenho:<br>
<div><br>
         x = coords[0] - widget.oldx<br>
         y = coords[1] - widget.oldy<br>
-        points = [(widget.oldx, widget.oldy),\<br>
-            (widget.oldx + int(x / 6), widget.oldy + y), \<br>
-            (widget.oldx + int(x / 6), widget.oldy + int(y / 3)), \<br>
-            (widget.oldx + x, widget.oldy + int(y / 3)), \<br>
-            (widget.oldx + x, widget.oldy - int(y / 3)), \<br>
-            (widget.oldx + int(x / 6), widget.oldy - int(y / 3)),\<br>
-            (widget.oldx + int(x / 6), widget.oldy - y)]<br>
+        A = math.atan2(y, x)<br>
+        dA = 2 * math.pi / 2<br>
+        r = math.hypot(y, x)<br>
+        m = math.sin(A)<br>
</div>+        p = [(widget.oldx, widget.oldy)]<br>
+        p.append((widget.oldx + int(r * math.cos(A)),\<br>
+                  widget.oldy + int(r * math.sin(A))))<br>
<div>+        p.append((widget.oldx + int(0.74 * r * math.cos(A + dA / 6)),\<br>
+                  widget.oldy + int(0.74 * r * math.sin(A + dA / 6))))<br>
+        p.append((widget.oldx + int(2 * r * math.cos(A + dA / 6 + dA / 20)),\<br>
+                  widget.oldy + int(2 * r * math.sin(A + dA / 6 + dA / 20))))<br>
+        p.append((widget.oldx +\<br>
+                  int(2 * r * math.cos(A + dA / 6 - dA / 20 + dA / 6)),\<br>
+                  widget.oldy +\<br>
+                  int(2 * r * math.sin(A + dA / 6 - dA / 20 + dA / 6))))<br>
+        p.append((widget.oldx + int(0.74 * r * math.cos(A + dA / 6 + dA / 6)),\<br>
+                  widget.oldy + int(0.74 * r * math.sin(A + dA / 6 + dA / 6))))<br>
</div>+        p.append((widget.oldx + int(r * math.cos(A + dA / 2)),\<br>
</div></div><div><div></div><div><div><div></div><div>+                  widget.oldy + int(r * math.sin(A + dA / 2))))<br>
         pixmap.draw_drawable(widget.gc, widget.pixmap, 0, 0, 0, 0,<br>
             width, height)<br>
+        tp = tuple(p)<br>
         if fill == True:<br>
-            pixmap.draw_polygon(widget.gc, True, points)<br>
-        pixmap.draw_polygon(widget.gc_line, False, points)<br>
+            pixmap.draw_polygon(widget.gc, True, tp)<br>
+        pixmap.draw_polygon(widget.gc_line, False, tp)<br>
         widget.queue_draw()<br>
<br>
     def parallelogram(self, widget, coords, temp, fill):<br>
--<br>
1.7.2.3<br>
<br></div></div><div>
_______________________________________________<br>
Dextrose mailing list<br>
<a href="mailto:Dextrose@lists.sugarlabs.org" target="_blank">Dextrose@lists.sugarlabs.org</a><br>
<a href="http://lists.sugarlabs.org/listinfo/dextrose" target="_blank">http://lists.sugarlabs.org/listinfo/dextrose</a><br>
</div></div></div></blockquote></div><br>
</blockquote></div><br></div></div></div>
</blockquote></div><br>
</div></div></div><br>