[orca] Make spoken presentation of accessible description optional



commit cb00d12c4677629a15ce9e498ca70f28f4885bed
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Sat Jan 21 06:49:24 2017 -0500

    Make spoken presentation of accessible description optional

 help/C/preferences_speech.page                    |   12 +++++++
 src/orca/orca-setup.ui                            |   34 ++++++++++++++++-----
 src/orca/orca_gui_prefs.py                        |    2 +
 src/orca/scripts/apps/soffice/speech_generator.py |    3 ++
 src/orca/settings.py                              |    2 +
 src/orca/speech_generator.py                      |   19 +++++++++++
 6 files changed, 64 insertions(+), 8 deletions(-)
---
diff --git a/help/C/preferences_speech.page b/help/C/preferences_speech.page
index dc814f8..c498de1 100644
--- a/help/C/preferences_speech.page
+++ b/help/C/preferences_speech.page
@@ -184,6 +184,18 @@
         Default value: not checked
       </p>
     </section>
+    <section id="speak_description">
+      <title>Speak description</title>
+      <p>
+        If the <gui>Speak description</gui> checkbox is checked, as
+        you move amongst objects in an interface, <app>Orca</app> will
+        speak the accessible description in addition to the accessible
+        name of the object.
+      </p>
+      <p>
+        Default value: checked
+      </p>
+    </section>
     <section id="system_messages_are_detailed">
       <title>System messages are detailed</title>
       <p>
diff --git a/src/orca/orca-setup.ui b/src/orca/orca-setup.ui
index 4bc3c67..7bed54d 100644
--- a/src/orca/orca-setup.ui
+++ b/src/orca/orca-setup.ui
@@ -1878,7 +1878,7 @@
                                           </object>
                                           <packing>
                                             <property name="left_attach">0</property>
-                                            <property name="top_attach">6</property>
+                                            <property name="top_attach">7</property>
                                           </packing>
                                         </child>
                                         <child>
@@ -1896,7 +1896,7 @@
                                           </object>
                                           <packing>
                                             <property name="left_attach">0</property>
-                                            <property name="top_attach">7</property>
+                                            <property name="top_attach">8</property>
                                           </packing>
                                         </child>
                                         <child>
@@ -1914,7 +1914,7 @@
                                           </object>
                                           <packing>
                                             <property name="left_attach">0</property>
-                                            <property name="top_attach">8</property>
+                                            <property name="top_attach">9</property>
                                           </packing>
                                         </child>
                                         <child>
@@ -1932,7 +1932,7 @@
                                           </object>
                                           <packing>
                                             <property name="left_attach">0</property>
-                                            <property name="top_attach">11</property>
+                                            <property name="top_attach">12</property>
                                           </packing>
                                         </child>
                                         <child>
@@ -1950,7 +1950,7 @@
                                           </object>
                                           <packing>
                                             <property name="left_attach">0</property>
-                                            <property name="top_attach">13</property>
+                                            <property name="top_attach">14</property>
                                           </packing>
                                         </child>
                                         <child>
@@ -1986,7 +1986,7 @@
                                           </object>
                                           <packing>
                                             <property name="left_attach">0</property>
-                                            <property name="top_attach">12</property>
+                                            <property name="top_attach">13</property>
                                           </packing>
                                         </child>
                                         <child>
@@ -2004,7 +2004,7 @@
                                           </object>
                                           <packing>
                                             <property name="left_attach">0</property>
-                                            <property name="top_attach">10</property>
+                                            <property name="top_attach">11</property>
                                           </packing>
                                         </child>
                                         <child>
@@ -2022,7 +2022,25 @@
                                           </object>
                                           <packing>
                                             <property name="left_attach">0</property>
-                                            <property name="top_attach">9</property>
+                                            <property name="top_attach">10</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkCheckButton" id="speakDescriptionCheckButton">
+                                            <property name="label" translatable="yes" comments="Translators: 
If this checkbox is checked, Orca will speak the accessible description of an object. Whereas the accessible 
name of an object tends to be short and typically corresponds to what is displayed on screen, the contents of 
the accessible description tend to be longer, e.g. matching the text of the tooltip, and are sometimes 
redundant to the accessible name. Therefore, we allow the user to opt out of this additional 
information.">Speak _description</property>
+                                            <property name="use_action_appearance">False</property>
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="receives_default">False</property>
+                                            <property name="use_underline">True</property>
+                                            <property name="xalign">0</property>
+                                            <property name="active">True</property>
+                                            <property name="draw_indicator">True</property>
+                                            <signal name="toggled" handler="checkButtonToggled" 
swapped="no"/>
+                                          </object>
+                                          <packing>
+                                            <property name="left_attach">0</property>
+                                            <property name="top_attach">6</property>
                                           </packing>
                                         </child>
                                       </object>
diff --git a/src/orca/orca_gui_prefs.py b/src/orca/orca_gui_prefs.py
index 73f5526..24ba2f4 100644
--- a/src/orca/orca_gui_prefs.py
+++ b/src/orca/orca_gui_prefs.py
@@ -1324,6 +1324,8 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
             prefs["enableMnemonicSpeaking"])
         self.get_widget("speakMisspelledIndicatorCheckButton").set_active(
             prefs.get("speakMisspelledIndicator", settings.speakMisspelledIndicator))
+        self.get_widget("speakDescriptionCheckButton").set_active(
+            prefs.get("speakDescription", settings.speakDescription))
         self.get_widget("speakContextBlockquoteCheckButton").set_active(
             prefs.get("speakContextBlockquote", settings.speakContextList))
         self.get_widget("speakContextLandmarkCheckButton").set_active(
diff --git a/src/orca/scripts/apps/soffice/speech_generator.py 
b/src/orca/scripts/apps/soffice/speech_generator.py
index c05e90f..a4453c3 100644
--- a/src/orca/scripts/apps/soffice/speech_generator.py
+++ b/src/orca/scripts/apps/soffice/speech_generator.py
@@ -207,6 +207,9 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
         if _settingsManager.getSetting('onlySpeakDisplayedText'):
             return []
 
+        if not _settingsManager.getSetting('speakDescription'):
+            return []
+
         if not args.get('formatType', '').endswith('WhereAmI'):
             return []
 
diff --git a/src/orca/settings.py b/src/orca/settings.py
index 4574201..3257f11 100644
--- a/src/orca/settings.py
+++ b/src/orca/settings.py
@@ -131,6 +131,7 @@ userCustomizableSettings = [
     "layoutMode",
     "rewindAndFastForwardInSayAll",
     "structNavInSayAll",
+    "speakDescription",
     "speakContextBlockquote",
     "speakContextPanel",
     "speakContextLandmark",
@@ -243,6 +244,7 @@ verbalizePunctuationStyle    = PUNCTUATION_STYLE_MOST
 speechVerbosityLevel         = VERBOSITY_LEVEL_VERBOSE
 messagesAreDetailed          = True
 enablePauseBreaks            = True
+speakDescription             = True
 speakContextBlockquote       = True
 speakContextPanel            = True
 speakContextNonLandmarkForm  = True
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index 3d1e910..f9c1cf0 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -209,6 +209,9 @@ class SpeechGenerator(generator.Generator):
         if _settingsManager.getSetting('onlySpeakDisplayedText'):
             return []
 
+        if not _settingsManager.getSetting('speakDescription'):
+            return []
+
         priorObj = args.get('priorObj')
         if priorObj and priorObj.getRole() == pyatspi.ROLE_TOOL_TIP:
             return []
@@ -219,6 +222,22 @@ class SpeechGenerator(generator.Generator):
             result.extend(acss)
         return result
 
+    def _generateImageDescription(self, obj, **args ):
+        """Returns an array of strings for use by speech and braille that
+        represent the description of the image on the object."""
+
+        if _settingsManager.getSetting('onlySpeakDisplayedText'):
+            return []
+
+        if not _settingsManager.getSetting('speakDescription'):
+            return []
+
+        acss = self.voice(SYSTEM)
+        result = generator.Generator._generateImageDescription(self, obj, **args)
+        if result:
+            result.extend(acss)
+        return result
+
     def _generateReadOnly(self, obj, **args):
         """Returns an array of strings for use by speech and braille that
         represent the read only state of this object, but only if it


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