[orca] Ensure we call the default braille generators for non-content objects
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Ensure we call the default braille generators for non-content objects
- Date: Fri, 24 Jan 2020 15:27:24 +0000 (UTC)
commit 611fec3462b269f42678417051a15f2e392cc50c
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date: Fri Jan 24 10:26:47 2020 -0500
Ensure we call the default braille generators for non-content objects
src/orca/formatting.py | 1 +
src/orca/scripts/web/braille_generator.py | 37 +++++++++++++++++++++++++++++--
2 files changed, 36 insertions(+), 2 deletions(-)
---
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index a4aeb0530..ef03201cb 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -645,6 +645,7 @@ formatting = {
asString(labelAndName + value + roleName + required))]',
},
pyatspi.ROLE_LABEL: {
+ 'focused': '[Text(obj, asString(labelAndName))]',
'unfocused': '[Text(obj, asString(labelAndName))]'
},
pyatspi.ROLE_LINK: {
diff --git a/src/orca/scripts/web/braille_generator.py b/src/orca/scripts/web/braille_generator.py
index 78e2aadef..facec8f51 100644
--- a/src/orca/scripts/web/braille_generator.py
+++ b/src/orca/scripts/web/braille_generator.py
@@ -31,6 +31,7 @@ import pyatspi
from orca import braille
from orca import braille_generator
+from orca import debug
from orca import messages
from orca import object_properties
from orca import orca_state
@@ -54,6 +55,9 @@ class BrailleGenerator(braille_generator.BrailleGenerator):
def _generateRoleName(self, obj, **args):
"""Prevents some roles from being displayed."""
+ if not self._script.utilities.inDocumentContent(obj):
+ return super()._generateRoleName(obj, **args)
+
roledescription = self._script.utilities.getRoleDescription(obj)
if roledescription:
return [roledescription]
@@ -107,10 +111,13 @@ class BrailleGenerator(braille_generator.BrailleGenerator):
return result
def _generateLabelOrName(self, obj, **args):
+ if not self._script.utilities.inDocumentContent(obj):
+ return super()._generateLabelOrName(obj, **args)
+
if self._script.utilities.isTextBlockElement(obj):
return []
- if self._script.utilities.inDocumentContent(obj) and obj.name:
+ if obj.name:
name = obj.name
if not self._script.utilities.hasExplicitName(obj):
name = name.strip()
@@ -119,6 +126,9 @@ class BrailleGenerator(braille_generator.BrailleGenerator):
return super()._generateLabelOrName(obj, **args)
def _generateLabel(self, obj, **args):
+ if not self._script.utilities.inDocumentContent(obj):
+ return super()._generateLabel(obj, **args)
+
label, objects = self._script.utilities.inferLabelFor(obj)
if label:
return [label]
@@ -126,6 +136,9 @@ class BrailleGenerator(braille_generator.BrailleGenerator):
return super()._generateLabel(obj, **args)
def _generateLabelAndName(self, obj, **args):
+ if not self._script.utilities.inDocumentContent(obj):
+ return super()._generateLabelAndName(obj, **args)
+
if self._script.utilities.isTextBlockElement(obj):
return []
@@ -136,12 +149,18 @@ class BrailleGenerator(braille_generator.BrailleGenerator):
return super()._generateLabelAndName(obj, **args)
def _generateDescription(self, obj, **args):
+ if not self._script.utilities.inDocumentContent(obj):
+ return super()._generateDescription(obj, **args)
+
if self._script.utilities.preferDescriptionOverName(obj):
return []
return super()._generateDescription(obj, **args)
def _generateName(self, obj, **args):
+ if not self._script.utilities.inDocumentContent(obj):
+ return super()._generateName(obj, **args)
+
if self._script.utilities.preferDescriptionOverName(obj):
return [obj.description]
@@ -156,8 +175,11 @@ class BrailleGenerator(braille_generator.BrailleGenerator):
def _generateExpandedEOCs(self, obj, **args):
"""Returns the expanded embedded object characters for an object."""
- result = []
+ if not self._script.utilities.inDocumentContent(obj):
+ return super()._generateExpandedEOCs(obj, **args)
+
+ result = []
startOffset = args.get('startOffset', 0)
endOffset = args.get('endOffset', -1)
text = self._script.utilities.expandEOCs(obj, startOffset, endOffset)
@@ -173,6 +195,9 @@ class BrailleGenerator(braille_generator.BrailleGenerator):
return self._generateDisplayedText(obj, **args)
def _generateTableCellRow(self, obj, **args):
+ if not self._script.utilities.inDocumentContent(obj):
+ return super()._generateTableCellRow(obj, **args)
+
if not self._script.inFocusMode():
return super()._generateTableCellRow(obj, **args)
@@ -187,6 +212,14 @@ class BrailleGenerator(braille_generator.BrailleGenerator):
return super()._generateTableCellRow(obj, **args)
def generateBraille(self, obj, **args):
+ if not self._script.utilities.inDocumentContent(obj):
+ msg = "WEB: %s is not in document content. Calling default braille generator." % obj
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return super().generateBraille(obj, **args)
+
+ msg = "WEB: Generating braille for document object %s" % obj
+ debug.println(debug.LEVEL_INFO, msg, True)
+
result = []
args['includeContext'] = not self._script.utilities.inDocumentContent(obj)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]