[orca] Fix for bgo#621469 - The chat-only-if-focused options aren't respected when another script is active



commit 1e7bc3eea2add619f588e189ed73ec79f395bf0a
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Mon Jun 14 23:07:49 2010 -0400

    Fix for bgo#621469 - The chat-only-if-focused options aren't respected when another script is active

 src/orca/chat.py   |    8 +++-----
 src/orca/script.py |   20 ++++++++++++++++++++
 2 files changed, 23 insertions(+), 5 deletions(-)
---
diff --git a/src/orca/chat.py b/src/orca/chat.py
index 274e717..2749545 100644
--- a/src/orca/chat.py
+++ b/src/orca/chat.py
@@ -643,13 +643,11 @@ class Chat:
         # Only speak/braille the new message if it matches how the user
         # wants chat messages spoken.
         #
+        verbosity = self._script.getSettings().chatMessageVerbosity
         if orca_state.activeScript.name != self._script.name \
-           and settings.chatMessageVerbosity == \
-                settings.CHAT_SPEAK_ALL_IF_FOCUSED:
+           and verbosity == settings.CHAT_SPEAK_ALL_IF_FOCUSED:
             return
-        elif not focused \
-           and settings.chatMessageVerbosity == \
-           settings.CHAT_SPEAK_FOCUSED_CHANNEL:
+        elif not focused and verbosity == settings.CHAT_SPEAK_FOCUSED_CHANNEL:
             return
 
         text = ""
diff --git a/src/orca/script.py b/src/orca/script.py
index c7a4036..04c5cbc 100644
--- a/src/orca/script.py
+++ b/src/orca/script.py
@@ -326,6 +326,26 @@ class Script:
 
         return orca_state.clickCount
 
+    def getSettings(self):
+        """Returns the settings associated with this script, regardless of
+        whether or not the script is active.
+        """
+
+        scriptSettings = settings
+        if orca_state.activeScript != self:
+            name = settings.getScriptModuleName(self.app)
+            if name:
+                for package in settings.settingsPackages:
+                    name = package + "." + name
+                    try:
+                        module = __import__(name, globals(), locals(), [''])
+                        reload(module)
+                        scriptSettings = module.orca.settings
+                    except:
+                        pass
+
+        return scriptSettings
+
     # [[[WDW - There is a circular reference going on somewhere (see
     # bug 333168).  In the presence of this reference, the existence
     # of a __del__ method prevents the garbage collector from



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