[orca/gnome-2-28] Fix for bgo#596340 - Exception if no selection is given when choosing a language



commit 2f0e63595b2b8a61d12966075c8aebe045ca7526
Author: Willie Walker <william walker sun com>
Date:   Mon Oct 19 12:25:12 2009 -0400

    Fix for bgo#596340 - Exception if no selection is given when choosing a language

 src/orca/orca_console_prefs.py |   43 +++++++++++++++++++++++++++------------
 1 files changed, 30 insertions(+), 13 deletions(-)
---
diff --git a/src/orca/orca_console_prefs.py b/src/orca/orca_console_prefs.py
index d841e3d..de54b3d 100644
--- a/src/orca/orca_console_prefs.py
+++ b/src/orca/orca_console_prefs.py
@@ -171,7 +171,12 @@ def setupSpeech(prefsDict):
 
         # Translators: this is prompting for a numerical choice.
         #
-        choice = int(sayAndPrint(_("Enter choice: "), False, True))
+        while True:
+            try:
+                choice = int(sayAndPrint(_("Enter choice: "), False, True))
+                break
+            except:
+                pass
         if (choice <= 0) or (choice >= i):
             # Translators: this means speech synthesis will not be used.
             #
@@ -203,7 +208,12 @@ def setupSpeech(prefsDict):
 
         # Translators: this is prompting for a numerical choice.
         #
-        choice = int(sayAndPrint(_("Enter choice: "), False, True))
+        while True:
+            try:
+                choice = int(sayAndPrint(_("Enter choice: "), False, True))
+                break
+            except:
+                pass
         if (choice <= 0) or (choice >= i):
             # Translators: this means speech synthesis will not be used.
             #
@@ -250,10 +260,15 @@ def setupSpeech(prefsDict):
 
         # Translators: this is prompting for a numerical choice.
         #
-        choice = int(sayAndPrint(_("Enter choice: "),
-                                 False,               # stop
-                                 True,                # getInput
-                                 speechServerChoice)) # speech server
+        while True:
+            try:
+                choice = int(sayAndPrint(_("Enter choice: "),
+                                         False,               # stop
+                                         True,                # getInput
+                                         speechServerChoice)) # speech server
+                break
+            except:
+                pass
         if (choice <= 0) or (choice >= i):
             # Translators: this means speech synthesis will not be used.
             #
@@ -396,13 +411,15 @@ def setupSpeech(prefsDict):
     sayAndPrint(_("2. Laptop"),
                 False, False, speechServerChoice, speechVoiceChoice)
 
-    try:
-        # Translators: this is prompting for a numerical choice.
-        #
-        choice = int(sayAndPrint(_("Enter choice: "),
-                     False, True, speechServerChoice, speechVoiceChoice))
-    except:
-        choice = -1
+    while True:
+        try:
+            # Translators: this is prompting for a numerical choice.
+            #
+            choice = int(sayAndPrint(_("Enter choice: "),
+                         False, True, speechServerChoice, speechVoiceChoice))
+            break
+        except:
+            pass
     if choice == 2:
         prefsDict["keyboardLayout"] = settings.GENERAL_KEYBOARD_LAYOUT_LAPTOP
         prefsDict["orcaModifierKeys"] = settings.LAPTOP_MODIFIER_KEYS



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