[orca] Move setting usePronunciationDictionary to the gui code



commit 4165236c27a8d161050b20efff9fc54a7b2e5edd
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Sat Nov 2 13:57:08 2013 -0400

    Move setting usePronunciationDictionary to the gui code
    
    The only time we don't want to use it is when we are in Orca's
    pronunciation dictionary tree. Checking every time the locusofFocus
    changes is both stupid and non-performant, not to mention in danger
    of false positives.

 src/orca/orca_gui_prefs.py  |   10 ++++++++++
 src/orca/scripts/default.py |   19 -------------------
 2 files changed, 10 insertions(+), 19 deletions(-)
---
diff --git a/src/orca/orca_gui_prefs.py b/src/orca/orca_gui_prefs.py
index 958f71d..0e4faa8 100644
--- a/src/orca/orca_gui_prefs.py
+++ b/src/orca/orca_gui_prefs.py
@@ -1177,6 +1177,11 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
         thisIter = model.get_iter(path)
         model.set(thisIter, REPLACEMENT, new_text)
 
+    def pronunciationFocusChange(self, widget, event, isFocused):
+        """Callback for the pronunciation tree's focus-{in,out}-event signal."""
+
+        orca_state.usePronunciationDictionary = not isFocused
+
     def pronunciationCursorChanged(self, widget):
         """Set the search column in the pronunciation dictionary tree view
         depending upon which column the user currently has the cursor in.
@@ -1264,6 +1269,11 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
         self.pronunciationView.connect("cursor_changed",
                                        self.pronunciationCursorChanged)
 
+        self.pronunciationView.connect(
+            "focus_in_event", self.pronunciationFocusChange, True)
+        self.pronunciationView.connect(
+            "focus_out_event", self.pronunciationFocusChange, False)
+
     def _initGUIState(self):
         """Adjust the settings of the various components on the
         configuration GUI depending upon the users preferences.
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index 0734505..03b274f 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -770,25 +770,6 @@ class Script(script.Script):
         if newLocusOfFocus:
             self.updateBraille(newLocusOfFocus)
 
-            # Check to see if we are in the Pronunciation Dictionary in the
-            # Orca Preferences dialog. If so, then we do not want to use the
-            # pronunciation dictionary to replace the actual words in the
-            # first column of this table.
-            #
-            # [[[TODO: WDW - this should be pushed into script_utilities'
-            # adjustForPronunciation method.]]]
-            #
-            rolesList = [pyatspi.ROLE_TABLE_CELL, \
-                         pyatspi.ROLE_TABLE, \
-                         pyatspi.ROLE_SCROLL_PANE, \
-                         pyatspi.ROLE_PANEL, \
-                         pyatspi.ROLE_PANEL]
-            if self.utilities.hasMatchingHierarchy(newLocusOfFocus, rolesList) \
-               and newLocusOfFocus.getApplication().name == "orca":
-                orca_state.usePronunciationDictionary = False
-            else:
-                orca_state.usePronunciationDictionary = True
-
             # We might be automatically speaking the unbound labels
             # in a dialog box as the result of the dialog box suddenly
             # appearing.  If so, don't interrupt this because of a


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