[gcompris] Fixed wartercycle and hydroelectric activity click event



commit b663a2000a3d963b7be179f5c9ef8383303ffd28
Author: Hans de Goede <hdegoede redhat com>
Date:   Sun Dec 1 23:36:44 2013 +0100

    Fixed wartercycle and hydroelectric activity click event
    
    1) various svg objects which should not be clickable were missing
    pointer_events = goocanvas.EVENTS_NONE
    in their construction code, causing them to be clickable and steal
    events from objects which should be clickable such as the sun.
    I've attached a patch fixing this.
    
    2) For some reason the bounding box of the windfarm in hydropower.py
    level 2 and 3 is way too big, causing it to steal events from other
    objects, like the cloud on which the user should click to generate
    wind. I've tried various changes to the svg in inkscape, but failed
    to fix this. In the end I ended up just flattening the 3 objects
    with the 3 different positions of the windmills to bitmaps
    inside inkscape, I've left the original drawn objects in the svg
    with WIND_FARM_#_bak as object names. I've also attached the
    resulting (work around) svg.

 src/hydroelectric-activity/hydroelectric.py        |   11 ++++++++++-
 .../resources/hydroelectric/hydroelectric.svgz     |  Bin 85885 -> 100082 bytes
 src/watercycle-activity/watercycle.py              |    7 ++++++-
 3 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/hydroelectric-activity/hydroelectric.py b/src/hydroelectric-activity/hydroelectric.py
index fb06cb3..8955d3c 100644
--- a/src/hydroelectric-activity/hydroelectric.py
+++ b/src/hydroelectric-activity/hydroelectric.py
@@ -150,6 +150,7 @@ class Gcompris_hydroelectric:
       parent = self.rootitem,
       svg_handle = self.svghandle,
       svg_id = "#RESERVOIR1",
+      pointer_events = goocanvas.EVENTS_NONE,
       visibility = goocanvas.ITEM_INVISIBLE
       )
 
@@ -237,7 +238,8 @@ class Gcompris_hydroelectric:
     self.boatitem = goocanvas.Svg(
       parent = self.rootitem,
       svg_handle = self.svghandle,
-      svg_id = "#BOAT"
+      svg_id = "#BOAT",
+      pointer_events = goocanvas.EVENTS_NONE
       )
     self.boatitem.translate(-100, 0);
     self.boatitem_bounds = self.boatitem.get_bounds()
@@ -246,6 +248,7 @@ class Gcompris_hydroelectric:
       parent = self.rootitem,
       svg_handle = self.svghandle,
       svg_id = "#BOAT_PARKED",
+      pointer_events = goocanvas.EVENTS_NONE,
       visibility = goocanvas.ITEM_INVISIBLE
       )
 
@@ -254,6 +257,7 @@ class Gcompris_hydroelectric:
       parent = self.rootitem,
       svg_handle = self.svghandle,
       svg_id = "#SALOON",
+      pointer_events = goocanvas.EVENTS_NONE,
       visibility = goocanvas.ITEM_INVISIBLE
       )
 
@@ -819,6 +823,7 @@ class Consumer:
       parent = rootitem,
       svg_handle = svghandle,
       svg_id = target_on,
+      pointer_events = goocanvas.EVENTS_NONE,
       visibility = goocanvas.ITEM_INVISIBLE
       )
     if target_off:
@@ -826,6 +831,7 @@ class Consumer:
         parent = rootitem,
         svg_handle = svghandle,
         svg_id = target_off,
+        pointer_events = goocanvas.EVENTS_NONE,
         visibility = goocanvas.ITEM_INVISIBLE
         )
     else:
@@ -940,6 +946,7 @@ class Producer:
       parent = rootitem,
       svg_handle = svghandle,
       svg_id = prod_item_on,
+      pointer_events = goocanvas.EVENTS_NONE,
       visibility = goocanvas.ITEM_INVISIBLE
       )
 
@@ -960,6 +967,7 @@ class Producer:
       parent = rootitem,
       svg_handle = svghandle,
       svg_id = transformer_on,
+      pointer_events = goocanvas.EVENTS_NONE,
       visibility = goocanvas.ITEM_INVISIBLE
       )
 
@@ -1086,6 +1094,7 @@ class Counter:
       parent = rootitem,
       svg_handle = svghandle,
       svg_id = svg_id,
+      pointer_events = goocanvas.EVENTS_NONE,
       tooltip = "\n\n\n" + tooltip
       )
     self.text = goocanvas.Text(
diff --git a/src/hydroelectric-activity/resources/hydroelectric/hydroelectric.svgz 
b/src/hydroelectric-activity/resources/hydroelectric/hydroelectric.svgz
index 3815c11..c77706d 100644
Binary files a/src/hydroelectric-activity/resources/hydroelectric/hydroelectric.svgz and 
b/src/hydroelectric-activity/resources/hydroelectric/hydroelectric.svgz differ
diff --git a/src/watercycle-activity/watercycle.py b/src/watercycle-activity/watercycle.py
index 9ed954d..6977c17 100644
--- a/src/watercycle-activity/watercycle.py
+++ b/src/watercycle-activity/watercycle.py
@@ -191,13 +191,15 @@ class Gcompris_watercycle:
     self.boatitem = goocanvas.Svg(
       parent = self.rootitem,
       svg_handle = svghandle,
-      svg_id = "#BOAT"
+      svg_id = "#BOAT",
+      pointer_events = goocanvas.EVENTS_NONE
       )
     self.boatitem.translate(-100, 0);
     self.boatitem_parked = goocanvas.Svg(
       parent = self.rootitem,
       svg_handle = svghandle,
       svg_id = "#BOAT_PARKED",
+      pointer_events = goocanvas.EVENTS_NONE,
       visibility = goocanvas.ITEM_INVISIBLE
       )
 
@@ -206,6 +208,7 @@ class Gcompris_watercycle:
       parent = self.rootitem,
       svg_handle = svghandle,
       svg_id = "#SHOWER",
+      pointer_events = goocanvas.EVENTS_NONE,
       visibility = goocanvas.ITEM_INVISIBLE
       )
 
@@ -213,6 +216,7 @@ class Gcompris_watercycle:
       parent = self.rootitem,
       svg_handle = svghandle,
       svg_id = "#SHOWER_TUX",
+      pointer_events = goocanvas.EVENTS_NONE,
       visibility = goocanvas.ITEM_INVISIBLE
       )
 
@@ -221,6 +225,7 @@ class Gcompris_watercycle:
       parent = self.rootitem,
       svg_handle = svghandle,
       svg_id = "#SHOWER_ON",
+      pointer_events = goocanvas.EVENTS_NONE,
       visibility = goocanvas.ITEM_INVISIBLE
       )
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]