>From 3ac11e0be2adc0c805788c38ab90b3226d625a89 Mon Sep 17 00:00:00 2001<br>From: Gonzalo Odiard &lt;<a href="mailto:godiard@gmail.com">godiard@gmail.com</a>&gt;<br>Date: Wed, 2 Jun 2010 20:01:10 -0300<br>Subject: [PATCH] hide brush when mouse leave area<br>
<br>---<br> Area.py |   15 ++++++++++++++-<br> 1 files changed, 14 insertions(+), 1 deletions(-)<br><br>diff --git a/Area.py b/Area.py<br>index 8a5e523..c83f38f 100644<br>--- a/Area.py<br>+++ b/Area.py<br>@@ -97,11 +97,15 @@ class Area(gtk.DrawingArea):<br>
                 gtk.gdk.BUTTON_PRESS_MASK |<br>                 gtk.gdk.BUTTON_RELEASE_MASK|<br>                 gtk.gdk.EXPOSURE_MASK |<br>+                gtk.gdk.LEAVE_NOTIFY_MASK|<br>+                gtk.gdk.ENTER_NOTIFY_MASK|<br>
                 gtk.gdk.KEY_PRESS_MASK) <br> <br>         self.connect(&quot;expose_event&quot;,self.expose)<br>         self.connect(&quot;motion_notify_event&quot;, self.mousemove)<br>         self.connect(&quot;button_press_event&quot;, self.mousedown)<br>
+        self.connect(&quot;leave_notify_event&quot;, self.mouseleave)<br>+        self.connect(&quot;enter_notify_event&quot;, self.mouseenter)<br>         self.connect(&quot;button_release_event&quot;, self.mouseup)<br>
         self.connect(&quot;key_press_event&quot;, self.key_press)<br> <br>@@ -353,8 +357,17 @@ class Area(gtk.DrawingArea):<br>             self.desenha = True<br>         widget.queue_draw()<br> <br>-<br>+    def mouseleave(self,widget,event):<br>
+        if self.tool[&#39;name&#39;] in [&#39;pencil&#39;,&#39;eraser&#39;,&#39;brush&#39;,&#39;rainbow&#39;]:<br>+            self.drawing = True<br>+            widget.queue_draw_area(self.x_cursor-size, self.y_cursor-size, size*2, size*2)<br>
 <br>+    def mouseenter(self,widget,event):<br>+        if self.tool[&#39;name&#39;] in [&#39;pencil&#39;,&#39;eraser&#39;,&#39;brush&#39;,&#39;rainbow&#39;]:<br>+            self.drawing = False<br>+            widget.queue_draw_area(self.x_cursor-size, self.y_cursor-size, size*2, size*2)<br>
+<br>+<br>     def mousemove(self,widget,event):<br>         &quot;&quot;&quot;Make the Area object (GtkDrawingArea) recognize that the mouse is moving.<br> <br>-- <br>1.6.6.1<br><br clear="all"><br>-- <br>Gonzalo Odiard<br>
Responsable de Desarrollo<br>Sistemas Australes<br><br>