[orca] Attempt to update state when Gecko windows get new accessible objects



commit 3c628985bc0d39d42cc63b34b6e6017c425e47d6
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Feb 20 06:10:31 2017 -0500

    Attempt to update state when Gecko windows get new accessible objects

 src/orca/script.py                       |    3 +++
 src/orca/scripts/web/script.py           |    5 +++++
 src/orca/scripts/web/script_utilities.py |   18 ++++++++++++++++++
 3 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/script.py b/src/orca/script.py
index 30ebeac..b1feb19 100644
--- a/src/orca/script.py
+++ b/src/orca/script.py
@@ -551,3 +551,6 @@ class Script:
     def deactivate(self):
         """Called when this script is deactivated."""
         pass
+
+    def getTransferableAttributes(self):
+        return {}
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index 72a176a..7f844f0 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -1982,3 +1982,8 @@ class Script(default.Script):
         self._lastCommandWasStructNav = False
         self._lastCommandWasMouseButton = False
         return False
+
+    def getTransferableAttributes(self):
+        return {"_lastCommandWasCaretNav": self._lastCommandWasCaretNav,
+                "_lastCommandWasStructNav": self._lastCommandWasStructNav,
+                "_lastCommandWasMouseButton": self._lastCommandWasMouseButton}
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 6ee0302..48e8b77 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -35,9 +35,11 @@ from orca import messages
 from orca import orca
 from orca import orca_state
 from orca import script_utilities
+from orca import script_manager
 from orca import settings
 from orca import settings_manager
 
+_scriptManager = script_manager.getManager()
 _settingsManager = settings_manager.getManager()
 
 
@@ -229,6 +231,22 @@ class Utilities(script_utilities.Utilities):
         else:
             msg = "WARNING: %s is not in %s" % (orca_state.activeWindow, app)
             debug.println(debug.LEVEL_INFO, msg, True)
+
+            try:
+                script = _scriptManager.getScript(app, orca_state.activeWindow)
+                msg = "WEB: Script for active Window is %s" % script
+                debug.println(debug.LEVEL_INFO, msg, True)
+            except:
+                msg = "ERROR: Exception getting script for active window"
+                debug.println(debug.LEVEL_INFO, msg, True)
+            else:
+                if type(script) == type(self._script):
+                    attrs = script.getTransferableAttributes()
+                    for attr, value in attrs.items():
+                        msg = "WEB: Setting %s to %s" % (attr, value)
+                        debug.println(debug.LEVEL_INFO, msg, True)
+                        setattr(self._script, attr, value)
+
             window = self.activeWindow(app)
             try:
                 self._script.app = window.getApplication()


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