[orca] Fix for bug 616847 - Only perform braille functions when braille is enabled
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Fix for bug 616847 - Only perform braille functions when braille is enabled
- Date: Mon, 2 Sep 2013 20:20:59 +0000 (UTC)
commit 8f490b3fe769f0965bc058664bd23e9f2e1458cb
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Mon Sep 2 16:19:56 2013 -0400
Fix for bug 616847 - Only perform braille functions when braille is enabled
src/orca/braille_generator.py | 6 +++
src/orca/orca.py | 4 +-
src/orca/scripts/default.py | 61 +++++++++++++++++--------
src/orca/scripts/toolkits/Gecko/script.py | 5 ++
src/orca/scripts/toolkits/WebKitGtk/script.py | 6 +++
5 files changed, 61 insertions(+), 21 deletions(-)
---
diff --git a/src/orca/braille_generator.py b/src/orca/braille_generator.py
index 345756f..adf5e16 100644
--- a/src/orca/braille_generator.py
+++ b/src/orca/braille_generator.py
@@ -29,6 +29,7 @@ import pyatspi
from gi.repository import Atspi, Atk
from . import braille
+from . import debug
from . import generator
from . import messages
from . import orca_state
@@ -72,6 +73,11 @@ class BrailleGenerator(generator.Generator):
globalsDict['asString'] = self.asString
def generateBraille(self, obj, **args):
+ if not _settingsManager.getSetting('enableBraille') \
+ and not _settingsManager.getSetting('enableBrailleMonitor'):
+ debug.println(debug.LEVEL_INFO, "BRAILLE: generation disabled")
+ return [[], None]
+
if obj == orca_state.locusOfFocus \
and not args.get('formatType', None):
args['formatType'] = 'focused'
diff --git a/src/orca/orca.py b/src/orca/orca.py
index 225fc5a..4a6662f 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -751,7 +751,9 @@ def main():
message = messages.START_ORCA
if not _settingsManager.getSetting('onlySpeakDisplayedText'):
speech.speak(message, settings.voices.get(settings.SYSTEM_VOICE))
- braille.displayMessage(message)
+ if _settingsManager.getSetting('enableBraille') \
+ or _settingsManager.getSetting('enableBrailleMonitor'):
+ braille.displayMessage(message)
except:
debug.printException(debug.LEVEL_SEVERE)
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index bf28772..d96fa12 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -949,6 +949,11 @@ class Script(script.Script):
- extra: extra Region to add to the end
"""
+ if not _settingsManager.getSetting('enableBraille') \
+ and not _settingsManager.getSetting('enableBrailleMonitor'):
+ debug.println(debug.LEVEL_INFO, "BRAILLE: update disabled")
+ return
+
if not obj:
return
@@ -3083,21 +3088,7 @@ class Script(script.Script):
obj = otherObj or event.source
text = obj.queryText()
- # Update the Braille display - if we can just reposition
- # the cursor, then go for it.
- #
- brailleNeedsRepainting = True
- line = braille.getShowingLine()
- for region in line.regions:
- if isinstance(region, braille.Text) \
- and (region.accessible == obj):
- if region.repositionCursor():
- self.refreshBraille(True)
- brailleNeedsRepainting = False
- break
-
- if brailleNeedsRepainting:
- self.updateBraille(obj)
+ self.updateBrailleForNewCaretPosition(obj)
if not orca_state.lastInputEvent:
return
@@ -3975,6 +3966,11 @@ class Script(script.Script):
at that cell. Otherwise, we will pan in display-sized increments
to show the review cursor."""
+ if not _settingsManager.getSetting('enableBraille') \
+ and not _settingsManager.getSetting('enableBrailleMonitor'):
+ debug.println(debug.LEVEL_INFO, "BRAILLE: update review disabled")
+ return
+
context = self.getFlatReviewContext()
[regions, regionWithFocus] = context.getCurrentBrailleRegions()
@@ -4665,11 +4661,6 @@ class Script(script.Script):
braille.displayMessage(message, flashTime=duration)
- # [[[TODO - JD: Soon I'll add a check to only do the braille
- # presentation if the user has braille or the braille monitor
- # enabled. For now, the easiest way to regression test these
- # changes is to always present braille.]]]
-
@staticmethod
def addBrailleRegionToLine(region, line):
"""Adds the braille region to the line.
@@ -4746,6 +4737,11 @@ class Script(script.Script):
a cursor routing key.
"""
+ if not _settingsManager.getSetting('enableBraille') \
+ and not _settingsManager.getSetting('enableBrailleMonitor'):
+ debug.println(debug.LEVEL_INFO, "BRAILLE: display message disabled")
+ return
+
braille.displayMessage(message, cursor, flashTime)
@staticmethod
@@ -4765,6 +4761,11 @@ class Script(script.Script):
a cursor routing key.
"""
+ if not _settingsManager.getSetting('enableBraille') \
+ and not _settingsManager.getSetting('enableBrailleMonitor'):
+ debug.println(debug.LEVEL_INFO, "BRAILLE: display regions disabled")
+ return
+
braille.displayRegions(regionInfo, flashTime)
def displayBrailleForObject(self, obj):
@@ -4920,6 +4921,26 @@ class Script(script.Script):
braille.refresh()
+ def updateBrailleForNewCaretPosition(self, obj):
+ """Try to reposition the cursor without having to do a full update."""
+
+ if not _settingsManager.getSetting('enableBraille') \
+ and not _settingsManager.getSetting('enableBrailleMonitor'):
+ debug.println(debug.LEVEL_INFO, "BRAILLE: update caret disabled")
+ return
+
+ brailleNeedsRepainting = True
+ line = braille.getShowingLine()
+ for region in line.regions:
+ if isinstance(region, braille.Text) and region.accessible == obj:
+ if region.repositionCursor():
+ self.refreshBraille(True)
+ brailleNeedsRepainting = False
+ break
+
+ if brailleNeedsRepainting:
+ self.updateBraille(obj)
+
@staticmethod
def refreshBraille(panToCursor=True, targetCursorCell=0, getLinkMask=True,
stopFlash=True):
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index ca0c159..7e84aa0 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -1867,6 +1867,11 @@ class Script(default.Script):
- extra: extra Region to add to the end
"""
+ if not _settingsManager.getSetting('enableBraille') \
+ and not _settingsManager.getSetting('enableBrailleMonitor'):
+ debug.println(debug.LEVEL_INFO, "BRAILLE: update disabled")
+ return
+
if not self.inDocumentContent():
default.Script.updateBraille(self, obj, extraRegion)
return
diff --git a/src/orca/scripts/toolkits/WebKitGtk/script.py b/src/orca/scripts/toolkits/WebKitGtk/script.py
index 0ec8d09..db146b1 100644
--- a/src/orca/scripts/toolkits/WebKitGtk/script.py
+++ b/src/orca/scripts/toolkits/WebKitGtk/script.py
@@ -32,6 +32,7 @@ import pyatspi.utils as utils
import orca.scripts.default as default
import orca.cmdnames as cmdnames
+import orca.debug as debug
import orca.guilabels as guilabels
import orca.input_event as input_event
import orca.messages as messages
@@ -678,6 +679,11 @@ class Script(default.Script):
- extra: extra Region to add to the end
"""
+ if not _settingsManager.getSetting('enableBraille') \
+ and not _settingsManager.getSetting('enableBrailleMonitor'):
+ debug.println(debug.LEVEL_INFO, "BRAILLE: update disabled")
+ return
+
if not obj:
return
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]