[orca] Add command line option to bring up GUI prefs



commit 0bb90ec019fd307b5c7d7fffb23b64ade71cfe5b
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Oct 6 13:06:50 2014 -0400

    Add command line option to bring up GUI prefs

 src/orca/messages.py                |    4 ++++
 src/orca/orca_bin.py.in             |    6 ++++++
 src/orca/orca_gui_prefs.py          |    5 ++++-
 src/orca/speechdispatcherfactory.py |    7 ++++++-
 4 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/src/orca/messages.py b/src/orca/messages.py
index b8f7476..c910019 100644
--- a/src/orca/messages.py
+++ b/src/orca/messages.py
@@ -272,6 +272,10 @@ CLI_DEBUG_FILE_NAME = _("FILE")
 # Orca will need to be run from a terminal window.
 CLI_SETUP = _("Set up user preferences (text version)")
 
+# Translators: This is the description of command line option '-s, --setup'
+# that will place the user in Orca's GUI preferences dialog.
+CLI_GUI_SETUP = _("Set up user preferences (GUI version)")
+
 # Translators: This text is the description displayed when Orca is launched
 # from the command line and the help text is displayed.
 CLI_EPILOG = _("Report bugs to orca-list gnome org ")
diff --git a/src/orca/orca_bin.py.in b/src/orca/orca_bin.py.in
index 2f7af07..3033601 100644
--- a/src/orca/orca_bin.py.in
+++ b/src/orca/orca_bin.py.in
@@ -93,6 +93,8 @@ class Parser(argparse.ArgumentParser):
         self.add_argument(
             "-r", "--replace", action="store_true", help=messages.CLI_REPLACE)
         self.add_argument(
+            "-s", "--setup", action="store_true", help=messages.CLI_GUI_SETUP)
+        self.add_argument(
             "-t", "--text-setup", action="store_true", help=messages.CLI_SETUP)
         self.add_argument(
             "-l", "--list-apps", action=ListApps, nargs=0,
@@ -241,6 +243,10 @@ def main():
             print(messages.CLI_LOAD_PROFILE_ERROR % args.profile)
             manager.setProfile()
 
+    if args.setup:
+        cleanup(signal.SIGKILL)
+        orca.showPreferencesGUI()
+
     if otherOrcas():
         print(messages.CLI_OTHER_ORCAS_ERROR)
         return 1
diff --git a/src/orca/orca_gui_prefs.py b/src/orca/orca_gui_prefs.py
index 4657735..59e96ef 100644
--- a/src/orca/orca_gui_prefs.py
+++ b/src/orca/orca_gui_prefs.py
@@ -1679,7 +1679,10 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
                                    modifierMask,
                                    0)
 
-        ts = orca_state.lastInputEvent.timestamp
+        try:
+            ts = orca_state.lastInputEvent.timestamp
+        except:
+            ts = 0
         if ts == 0:
             ts = Gtk.get_current_event_time()
         orcaSetupWindow.present_with_time(ts)
diff --git a/src/orca/speechdispatcherfactory.py b/src/orca/speechdispatcherfactory.py
index 1e7e5f2..786dd02 100644
--- a/src/orca/speechdispatcherfactory.py
+++ b/src/orca/speechdispatcherfactory.py
@@ -188,6 +188,8 @@ class SpeechServer(speechserver.SpeechServer):
                               "Trying to reconnect.")
                 self.reset()
                 return command(*args, **kwargs)
+            except:
+                pass
         else:
             # It is not possible tho catch the error with older SD versions. 
             return command(*args, **kwargs)
@@ -383,7 +385,10 @@ class SpeechServer(speechserver.SpeechServer):
         except AttributeError:
             pass
         else:
-            voices += self._send_command(list_synthesis_voices)
+            try:
+                voices += self._send_command(list_synthesis_voices)
+            except:
+                pass
         families = [speechserver.VoiceFamily({ \
               speechserver.VoiceFamily.NAME: name,
               #speechserver.VoiceFamily.GENDER: speechserver.VoiceFamily.MALE,


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