I have uploaded the icon file at <meta http-equiv="content-type" content="text/html; charset=utf-8"><a href="https://dev.laptop.org/ticket/4170">https://dev.laptop.org/ticket/4170</a> needed for the patch.<br><br><div class="gmail_quote">
On Thu, Oct 21, 2010 at 3:02 AM, Anurag Chowdhury <span dir="ltr"><<a href="mailto:anurag@seeta.in">anurag@seeta.in</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
In the paint activity's shape tool we were able to make only horizontal arrows,<br>
so now we have added a new tool which makes vertical arrows.<br>
<br>
---<br>
Area.py | 8 ++++++++<br>
Desenho.py | 31 +++++++++++++++++++++++++++++++<br>
toolbox.py | 21 +++++++++++++++++++++<br>
3 files changed, 60 insertions(+), 0 deletions(-)<br>
<br>
diff --git a/Area.py b/Area.py<br>
index 2dca7da..56c4267 100644<br>
--- a/Area.py<br>
+++ b/Area.py<br>
@@ -438,6 +438,10 @@ class Area(gtk.DrawingArea):<br>
elif self.tool['name'] == 'arrow':<br>
self.configure_line(self.line_size)<br>
self.d.arrow(widget,coords,True,self.tool['fill'])<br>
+<br>
+ elif self.tool['name'] == 'vertical arrow':<br>
+ self.d.arrow_vertical(widget,coords,False,\<br>
+ self.tool['fill'])<br>
+ self.enableUndo(widget)<br>
<br>
elif self.tool['name'] == 'parallelogram':<br>
self.configure_line(self.line_size)<br>
@@ -541,6 +545,10 @@ class Area(gtk.DrawingArea):<br>
elif self.tool['name'] == 'arrow':<br>
self.d.arrow(widget,coords,False,self.tool['fill'])<br>
self.enableUndo(widget)<br>
+<br>
+ elif self.tool['name'] == 'vertical arrow':<br>
+ self.d.arrow_vertical(widget,coords,False,self.tool['fill'])<br>
+ self.enableUndo(widget)<br>
<br>
elif self.tool['name'] == 'parallelogram':<br>
self.d.parallelogram(widget,coords,False,self.tool['fill'])<br>
diff --git a/Desenho.py b/Desenho.py<br>
index c9a134b..e90a45c 100644<br>
--- a/Desenho.py<br>
+++ b/Desenho.py<br>
@@ -298,6 +298,37 @@ class Desenho:<br>
pixmap.draw_polygon(widget.gc_line,False,points)<br>
widget.queue_draw()<br>
<br>
+ def arrow_vertical(self, widget, coords, temp, fill):<br>
+ """Draw a arrow.<br>
+<br>
+ @param self -- Desenho.Desenho instance<br>
+ @param widget -- Area object (GtkDrawingArea)<br>
+ @param coords -- Two value tuple<br>
+ @param temp -- switch between pixmap and pixmap_temp<br>
+ @param fill -- Fill object<br>
+<br>
+ """<br>
+ if temp == True:<br>
+ pixmap = widget.pixmap_temp<br>
+ else:<br>
+ pixmap = widget.pixmap<br>
+ width, height = widget.window.get_size()<br>
+<br>
+ x = widget.oldx - coords[0]<br>
+ y = widget.oldy - coords[1]<br>
+ points = [(widget.oldx,widget.oldy),\<br>
+(widget.oldx+x,widget.oldy-int(y/6)),\<br>
+(widget.oldx+int(x/2),widget.oldy-int(y/6)),\<br>
+(widget.oldx+int(x/2),widget.oldy-y),\<br>
+(widget.oldx-int(x/2),widget.oldy-y),\<br>
+(widget.oldx-int(x/2),widget.oldy-int(y/6)),\<br>
+(widget.oldx-x,widget.oldy-int(y/6))]<br>
+ pixmap.draw_drawable(widget.gc,widget.pixmap,0,0,0,0,width,height)<br>
+ if fill == True:<br>
+ pixmap.draw_polygon(widget.gc,True,points)<br>
+ pixmap.draw_polygon(widget.gc_line,False,points)<br>
+ widget.queue_draw()<br>
+<br>
<br>
def parallelogram(self, widget, coords, temp, fill):<br>
"""Draw a parallelogram.<br>
diff --git a/toolbox.py b/toolbox.py<br>
index 299181b..520e5f0 100644<br>
--- a/toolbox.py<br>
+++ b/toolbox.py<br>
@@ -613,6 +613,15 @@ class ShapesToolbar(gtk.Toolbar):<br>
'fill' : True,<br>
'vertices' : 5<br>
}<br>
+ _SHAPE_ARROW_VERTICAL= {<br>
+ 'name' : 'vertical arrow',<br>
+ 'line size' : 5,<br>
+ 'fill color' : None,<br>
+ 'stroke color' : None,<br>
+ 'line shape' : 'circle',<br>
+ 'fill' : True,<br>
+ 'vertices' : 5<br>
+ }<br>
_SHAPE_CURVE = {<br>
'name' : 'curve',<br>
'line size' : 2,<br>
@@ -795,6 +804,13 @@ class ShapesToolbar(gtk.Toolbar):<br>
self._configure_palette_shape_arrow()<br>
except:<br>
logging.debug('Could not create palette for Shape Arrow')<br>
+<br>
+ self._shape_arrow_vertical = DrawToolButton\<br>
+ ('tool-shape-arrow-vertical',activity.tool_group,_('Arrow-Vertical'))<br>
+ self.insert(self._shape_arrow_vertical, -1)<br>
+ try:<br>
+ self._configure_palette_shape_arrow_vertical()<br>
+ except:<br>
+ logging.debug('Could not create palette for Shape Vertical Arrow')<br>
<br>
self._shape_star = DrawToolButton('tool-shape-star', activity.tool_group,_('Star'))<br>
self.insert(self._shape_star, -1)<br>
@@ -819,6 +835,7 @@ class ShapesToolbar(gtk.Toolbar):<br>
<br>
<br>
self._shape_arrow.connect('clicked', self.set_tool, self._SHAPE_ARROW)<br>
+ self._shape_arrow_vertical.connect('clicked', self.set_tool,\<br>
+ self._SHAPE_ARROW_VERTICAL)<br>
self._shape_ellipse.connect('clicked', self.set_tool, self._SHAPE_ELLIPSE)<br>
self._shape_freeform.connect('clicked', self.set_tool, self._SHAPE_FREEFORM)<br>
self._shape_heart.connect('clicked', self.set_tool, self._SHAPE_HEART)<br>
@@ -908,6 +925,10 @@ class ShapesToolbar(gtk.Toolbar):<br>
logging.debug('Creating palette to shape arrow')<br>
self._create_simple_palette(self._shape_arrow, self._SHAPE_ARROW)<br>
<br>
+ def _configure_palette_shape_arrow_vertical(self):<br>
+ logging.debug('Creating palette to shape Vertical arrow')<br>
+ self._create_simple_palette(self._shape_arrow_vertical,\<br>
+ self._SHAPE_ARROW_VERTICAL)<br>
+<br>
def _configure_palette_shape_star(self):<br>
logging.debug('Creating palette to shape star')<br>
<font color="#888888"><br>
--<br>
1.7.2.3<br>
</font></blockquote></div><br>