[gcompris] minor fix to avoid an error message if there is no equiv list.



commit dfd23feba4191370f1abad37278cbaaf96722bbf
Author: Bruno Coudoin <bcoudoin rcsmobility com>
Date:   Sun May 5 13:47:47 2013 +0200

    minor fix to avoid an error message if there is no equiv list.

 src/hangman-activity/hangman.py |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/src/hangman-activity/hangman.py b/src/hangman-activity/hangman.py
index 41ebe0c..bd7926d 100644
--- a/src/hangman-activity/hangman.py
+++ b/src/hangman-activity/hangman.py
@@ -71,20 +71,21 @@ class Gcompris_hangman:
     # form of a space separated list like: "é=e/E è=e/E sch=S"
     # Letters on the left of the = can be multigraphs and represent the letters on the buttons.
     # Letters on the right are single letters pressed on the keyboard.
-    # If you wish to allow different key presses for the same letter, separate the letters on the right with 
/
-    # Keep the word NONE if not available in your language
-    self.keyequivs = unicode(_("a=a"), encoding="utf8")
-    if self.keyequivs == "a=a":
-      self.keyequivs = ""
+    # If you wish to allow different key presses for the same letter, separate the letters
+    # on the right with /
+    keyequivs = unicode(_("a=a"), encoding="utf8")
+    if keyequivs == "a=a":
+      keyequivs = None
     
     # Create equivs list
     self.keyequivList = {}
-    for keyequiv in self.keyequivs.split(' '):
-      try:
+    if keyequivs:
+      for keyequiv in keyequivs.split(' '):
+        try:
           (k, v) = keyequiv.split('=')
           self.keyequivList[k]=v
-      except:
-        print ("ERROR: Bad key equivalence list '%s' for hangman: " %(self.keyequivs, ))
+        except:
+          print ("ERROR: Bad key equivalence list '%s' for hangman: " %(keyequivs, ))
 
 
     # Letters equivalence for the hangman activity. It has the


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