[orca] Force focus mode when composing messages in Thunderbird



commit 0ca0317ad4711f7288544229aaba8fdfd4ee3582
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Sat Aug 9 12:10:55 2014 -0400

    Force focus mode when composing messages in Thunderbird

 src/orca/scripts/apps/Thunderbird/script.py |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/scripts/apps/Thunderbird/script.py b/src/orca/scripts/apps/Thunderbird/script.py
index aca1863..bcb24b9 100644
--- a/src/orca/scripts/apps/Thunderbird/script.py
+++ b/src/orca/scripts/apps/Thunderbird/script.py
@@ -28,7 +28,9 @@ __license__   = "LGPL"
 import pyatspi
 
 import orca.orca as orca
+import orca.cmdnames as cmdnames
 import orca.debug as debug
+import orca.input_event as input_event
 import orca.scripts.default as default
 import orca.settings_manager as settings_manager
 import orca.orca_state as orca_state
@@ -69,6 +71,14 @@ class Script(Gecko.Script):
 
         Gecko.Script.__init__(self, app)
 
+    def setupInputEventHandlers(self):
+        Gecko.Script.setupInputEventHandlers(self)
+
+        self.inputEventHandlers["togglePresentationModeHandler"] = \
+            input_event.InputEventHandler(
+                Script.togglePresentationMode,
+                cmdnames.TOGGLE_PRESENTATION_MODE)
+
     def getFormatting(self):
         """Returns the formatting strings for this script."""
         return Formatting(self)
@@ -121,6 +131,18 @@ class Script(Gecko.Script):
 
         Gecko.Script.doWhereAmI(self,inputEvent, basicOnly)
 
+    def _useFocusMode(self, obj):
+        if self.isEditableMessage(obj):
+            return True
+
+        return Gecko.Script._useFocusMode(self, obj)
+
+    def togglePresentationMode(self, inputEvent):
+        if self._inFocusMode and self.isEditableMessage(orca_state.locusOfFocus):
+            return
+
+        Gecko.Script.togglePresentationMode(self, inputEvent)
+
     def useStructuralNavigationModel(self):
         """Returns True if structural navigation should be enabled here."""
 


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