[orca] Add custom localized role names for ARIA feed and figure roles



commit b06861cb00b1edc89bef54b34c08ce16c46ba8b1
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Jul 21 12:44:05 2017 +0200

    Add custom localized role names for ARIA feed and figure roles

 src/orca/generator.py                    |    6 ++++++
 src/orca/messages.py                     |   12 ++++++++++++
 src/orca/object_properties.py            |   14 ++++++++++++++
 src/orca/script_utilities.py             |    6 ++++++
 src/orca/scripts/web/script_utilities.py |   10 ++++++++++
 src/orca/speech_generator.py             |    9 +++++++--
 6 files changed, 55 insertions(+), 2 deletions(-)
---
diff --git a/src/orca/generator.py b/src/orca/generator.py
index 27bd38f..97a4980 100644
--- a/src/orca/generator.py
+++ b/src/orca/generator.py
@@ -1241,6 +1241,12 @@ class Generator:
                 if isVertical:
                     return object_properties.ROLE_SPLITTER_HORIZONTAL
 
+        if self._script.utilities.isFeed(obj):
+            return object_properties.ROLE_FEED
+
+        if self._script.utilities.isFigure(obj):
+            return object_properties.ROLE_FIGURE
+
         if self._script.utilities.isMenuButton(obj):
             return object_properties.ROLE_MENU_BUTTON
 
diff --git a/src/orca/messages.py b/src/orca/messages.py
index 7473dcc..9c778eb 100644
--- a/src/orca/messages.py
+++ b/src/orca/messages.py
@@ -1053,6 +1053,18 @@ LEARN_MODE_START_SPEECH = \
 # blockquote and then navigates out of it.
 LEAVING_BLOCKQUOTE = _("leaving blockquote.")
 
+# Translators: This message is presented when a user is navigating within
+# an object and then navigates out of it. The word or phrase that follows
+# "leaving" should be consistent with the translation provided for the
+# corresponding term with context "role" found in object_properties.py
+LEAVING_FEED = C_("role", "leaving feed.")
+
+# Translators: This message is presented when a user is navigating within
+# an object and then navigates out of it. The word or phrase that follows
+# "leaving" should be consistent with the translation provided for the
+# corresponding term with context "role" found in object_properties.py
+LEAVING_FIGURE = C_("role", "leaving figure.")
+
 # Translators: This message is presented when a user is navigating within a
 # form and then navigates out of it.
 LEAVING_FORM = _("leaving form.")
diff --git a/src/orca/object_properties.py b/src/orca/object_properties.py
index ae50377..8faf1dd 100644
--- a/src/orca/object_properties.py
+++ b/src/orca/object_properties.py
@@ -74,6 +74,20 @@ ROLE_EDITABLE_COMBO_BOX = _("editable combo box")
 
 # Translators: This string should be treated as a role describing an object.
 # Examples of roles include "checkbox", "radio button", "paragraph", and "link."
+# The feed role is a scrollable list of articles where scrolling may cause
+# articles to be added to or removed from either end of the list.
+# http://rawgit.com/w3c/aria/master/aria/aria.html#feed
+ROLE_FEED = C_("role", "feed")
+
+# Translators: This string should be treated as a role describing an object.
+# Examples of roles include "checkbox", "radio button", "paragraph", and "link."
+# The figure role is a perceivable section of content that typically contains a
+# graphical document, images, code snippets, or example text.
+# http://rawgit.com/w3c/aria/master/aria/aria.html#figure
+ROLE_FIGURE = C_("role", "figure")
+
+# Translators: This string should be treated as a role describing an object.
+# Examples of roles include "checkbox", "radio button", "paragraph", and "link."
 # This role refers to the abstract in a digitally-published document.
 # https://rawgit.com/w3c/aria/master/aria/dpub.html#doc-abstract
 ROLE_ABSTRACT = C_("role", "abstract")
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 8f0a43f..4f0db51 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -764,6 +764,12 @@ class Utilities:
     def isDPubToc(self, obj):
         return False
 
+    def isFeed(self, obj):
+        return False
+
+    def isFigure(self, obj):
+        return False
+
     def isLandmark(self, obj):
         return False
 
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 0adb65a..9836c27 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -2155,6 +2155,10 @@ class Utilities(script_utilities.Utilities):
             rv = False
         elif self.isDPub(obj):
             rv = False
+        elif self.isFeed(obj):
+            rv = False
+        elif self.isFigure(obj):
+            rv = False
         else:
             rv = super().isLayoutOnly(obj)
 
@@ -2540,6 +2544,12 @@ class Utilities(script_utilities.Utilities):
     def isDPubToc(self, obj):
         return 'doc-toc' in self._getXMLRoles(obj)
 
+    def isFeed(self, obj):
+        return 'feed' in self._getXMLRoles(obj)
+
+    def isFigure(self, obj):
+        return 'figure' in self._getXMLRoles(obj)
+
     def isLandmark(self, obj):
         if not (obj and self.inDocumentContent(obj)):
             return False
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index ee9b33c..8e0df33 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -1548,8 +1548,13 @@ class SpeechGenerator(generator.Generator):
                 result.append(messages.leavingNLists(count))
             else:
                 result.append(messages.LEAVING_LIST)
-        elif role == pyatspi.ROLE_PANEL and self._script.utilities.isDocumentPanel(obj):
-            result.append(messages.LEAVING_PANEL)
+        elif role == pyatspi.ROLE_PANEL:
+            if self._script.utilities.isFeed(obj):
+                result.append(messages.LEAVING_FEED)
+            elif self._script.utilities.isFigure(obj):
+                result.append(messages.LEAVING_FIGURE)
+            elif self._script.utilities.isDocumentPanel(obj):
+                result.append(messages.LEAVING_PANEL)
         elif role == pyatspi.ROLE_TABLE and self._script.utilities.isTextDocumentTable(obj):
             result.append(messages.LEAVING_TABLE)
         elif role == 'ROLE_DPUB_LANDMARK':


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