[gcompris] mining: fix LION-bonus for versions <= 12.5



commit 07d67ac72799ca13fa679ad46a544563c97dee11
Author: Peter Albrecht <pa-dev gmx de>
Date:   Sun Sep 23 09:30:27 2012 +0200

    mining: fix LION-bonus for versions <= 12.5
    
    In GCompris version up to and including 12.5, there is a bug with the LION bonus:
    The bonus-constant "LION" does not exist, but had to be called by "GNU".
    
    This fix makes the mining activity work with GCompris version <= 12.5
    and > 12.5.

 src/mining-activity/mining.py |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/mining-activity/mining.py b/src/mining-activity/mining.py
index 3651cb6..0e9f77b 100644
--- a/src/mining-activity/mining.py
+++ b/src/mining-activity/mining.py
@@ -352,7 +352,15 @@ class Gcompris_mining:
       self.tutorial.stop()
 
     self.is_game_won = True;
-    gcompris.bonus.display(gcompris.bonus.WIN, gcompris.bonus.LION)
+
+    # In GCompris version up to and including 12.5, there is a bug with the LION bonus:
+    # The bonus-constant "LION" does not exist, but had to be called by "GNU"
+    try:
+      # try to display bonus with correct constant
+      gcompris.bonus.display(gcompris.bonus.WIN, gcompris.bonus.LION)
+    except AttributeError:
+      # fail back to GCompris version <= 12.5
+      gcompris.bonus.display(gcompris.bonus.WIN, gcompris.bonus.GNU)
 
 
   def pause(self, pause):



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