[gcompris] electricity, now the bulb can be reparaired with a click



commit d1fdfc3e5b0b38672082e51ad32ce9c58aea042e
Author: Bruno Coudoin <bcoudoin gcompris net>
Date:   Sun Oct 6 02:20:25 2013 +0200

    electricity, now the bulb can be reparaired with a click
    
    There was a bug which made the bulb being repared only if moved.
    Changed the dubug trice back to false.

 src/electric-activity/electric.py |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/electric-activity/electric.py b/src/electric-activity/electric.py
index cf3baf1..9ef1f14 100644
--- a/src/electric-activity/electric.py
+++ b/src/electric-activity/electric.py
@@ -30,7 +30,7 @@ import os
 import tempfile
 
 # Set to True to debug
-debug = True
+debug = False
 
 from gcompris import gcompris_gettext as _
 
@@ -1567,18 +1567,19 @@ class Bulb(Component):
     return True
 
   # Callback event to move the component
-  # We override it to repair the Bulb
   def component_move(self, widget, target, event, component):
     # If the Bulb is blown and we get a click repair it
     # If the bulb is not blown, you can blown it by right clicking on it
-    if (event.state & gtk.gdk.BUTTON1_MASK) \
+    if event.type & gtk.gdk.BUTTON_PRESS and event.button == 1 \
           and self.electric.get_current_tools() == "SELECT":
       if self.is_blown:
         self.is_blown = False
         self.gnucap_value = self.internal_resistor
         self.electric.run_simulation()
 
-    elif (event.state & gtk.gdk.BUTTON3_MASK) and self.electric.get_current_tools()=="SELECT":
+    elif event.type & gtk.gdk.BUTTON_PRESS \
+          and event.button == 3 \
+          and self.electric.get_current_tools()=="SELECT":
       if not self.is_blown:
         # Blown us with arbitrate high value
         self.set_voltage_intensity(True, 100, 10)


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