Can you test with pep8 (missing whitespace after ',' ;missing whitespace around operator, etc) and attach to the ticket?<br><br>Gonzalo<br><br><div class="gmail_quote">On Thu, Oct 21, 2010 at 2:20 PM, Anurag Chowdhury <span dir="ltr"><<a href="mailto:anurag@seeta.in">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;">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>
 Desenho.py |   27 ++++++++++++++++++---------<br>
 1 files changed, 18 insertions(+), 9 deletions(-)<br>
<br>
v1->v2 :Removed the vertical-arrow tool and modified the arrow tool to enable<br>
drawing arrows in all directions.<br>
<br>
diff --git a/Desenho.py b/Desenho.py<br>
index 3be1910..5057a27 100644<br>
--- a/Desenho.py<br>
+++ b/Desenho.py<br>
@@ -294,18 +294,27 @@ class Desenho:<br>
<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>
+        p = [(widget.oldx,widget.oldy),\<br>
+            (widget.oldx+int(r*math.cos(A)),widget.oldy+int(r*math.sin(A))),\<br>
+            (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,widget.oldy))<br>
+        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+int(2*r*math.cos(A+dA/6-dA/20+dA/6)),\<br>
+                  widget.oldy+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>
+        p.append((widget.oldx,widget.oldy))<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>
+        p.append((widget.oldx+int(r*math.cos(A+dA/2)),\<br>
+                  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>
<font color="#888888">--<br>
1.7.2.3<br>
<br>
_______________________________________________<br>
Dextrose mailing list<br>
<a href="mailto:Dextrose@lists.sugarlabs.org">Dextrose@lists.sugarlabs.org</a><br>
<a href="http://lists.sugarlabs.org/listinfo/dextrose" target="_blank">http://lists.sugarlabs.org/listinfo/dextrose</a><br>
</font></blockquote></div><br>