[orca] Add GUI option to configure capitalization style



commit 0d6b4049d36f10e07c44607f85d7eed770dca858
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu Nov 26 07:13:35 2015 -0500

    Add GUI option to configure capitalization style

 help/C/preferences_voice.page |   25 +++++++++++++++++++++++
 src/orca/guilabels.py         |   24 ++++++++++++++++++++++
 src/orca/orca-setup.ui        |   44 +++++++++++++++++++++++++++++++++++-----
 src/orca/orca_gui_prefs.py    |   22 ++++++++++++++++++++
 src/orca/scripts/default.py   |    1 +
 src/orca/settings.py          |    1 +
 6 files changed, 111 insertions(+), 6 deletions(-)
---
diff --git a/help/C/preferences_voice.page b/help/C/preferences_voice.page
index f2c6922..d8bf485 100644
--- a/help/C/preferences_voice.page
+++ b/help/C/preferences_voice.page
@@ -60,6 +60,31 @@
       </p>
     </section>
     <section>
+      <title>Capitalization style</title>
+      <p>
+       This combo box allows you to choose which Speech Dispatcher capitalization
+       indication styles you wish to use in addition to <app>Orca</app>'s
+       capitalization voice. The options, which are named using Speech Dispatcher's
+       terminology, are:
+     </p>
+     <list>
+       <item><p><gui>icon</gui>: Plays a tone</p></item>
+       <item><p><gui>spell</gui>: Speaks the word "capital"</p></item>
+       <item><p><gui>none</gui></p></item>
+    </list>
+    <note style="tip">
+      <title>This setting can be toggled on the fly</title>
+      <p>
+        <app>Orca</app> also has a command to cycle through the available
+        capitalization styles. See <link xref="commands_speech_settings">
+        Speech Settings Commands</link> for more information.
+      </p>
+    </note>
+    <p>
+      Default value: none
+    </p>
+    </section>
+    <section>
       <title>Rate, Pitch, and Volume</title>
       <p>
         These three left-right sliders allow you to further customize the sound
diff --git a/src/orca/guilabels.py b/src/orca/guilabels.py
index fbb258b..6818ea5 100644
--- a/src/orca/guilabels.py
+++ b/src/orca/guilabels.py
@@ -102,6 +102,30 @@ BTN_JUMP_TO = _("_Jump to")
 # Translators: This is the label for a button in a dialog.
 BTN_OK = _("_OK")
 
+# Translators: Orca uses Speech Dispatcher to present content to users via
+# text-to-speech. Speech Dispatcher has a feature to control how capital
+# letters are presented: Do nothing at all, say the word 'capital' prior to
+# presenting a capital letter (which Speech Dispatcher refers to as 'spell'),
+# or play a tone (which Speech Dispatcher refers to as a sound 'icon'.) This
+# string to be translated appears as a combo box item in Orca's Preferences.
+CAPITALIZATION_STYLE_ICON = C_("capitalization style", "icon")
+
+# Translators: Orca uses Speech Dispatcher to present content to users via
+# text-to-speech. Speech Dispatcher has a feature to control how capital
+# letters are presented: Do nothing at all, say the word 'capital' prior to
+# presenting a capital letter (which Speech Dispatcher refers to as 'spell'),
+# or play a tone (which Speech Dispatcher refers to as a sound 'icon'.) This
+# string to be translated appears as a combo box item in Orca's Preferences.
+CAPITALIZATION_STYLE_NONE = C_("capitalization style", "none")
+
+# Translators: Orca uses Speech Dispatcher to present content to users via
+# text-to-speech. Speech Dispatcher has a feature to control how capital
+# letters are presented: Do nothing at all, say the word 'capital' prior to
+# presenting a capital letter (which Speech Dispatcher refers to as 'spell'),
+# or play a tone (which Speech Dispatcher refers to as a sound 'icon'.) This
+# string to be translated appears as a combo box item in Orca's Preferences.
+CAPITALIZATION_STYLE_SPELL = C_("capitalization style", "spell")
+
 # Translators: If this checkbox is checked, then Orca will tell you when one of
 # your buddies is typing a message.
 CHAT_ANNOUNCE_BUDDY_TYPING = _("Announce when your _buddies are typing")
diff --git a/src/orca/orca-setup.ui b/src/orca/orca-setup.ui
index 59a0819..1706c18 100644
--- a/src/orca/orca-setup.ui
+++ b/src/orca/orca-setup.ui
@@ -1004,7 +1004,7 @@
                               </object>
                               <packing>
                                 <property name="left_attach">0</property>
-                                <property name="top_attach">6</property>
+                                <property name="top_attach">7</property>
                                 <property name="width">1</property>
                                 <property name="height">1</property>
                               </packing>
@@ -1021,7 +1021,7 @@
                               </object>
                               <packing>
                                 <property name="left_attach">1</property>
-                                <property name="top_attach">6</property>
+                                <property name="top_attach">7</property>
                                 <property name="width">1</property>
                                 <property name="height">1</property>
                               </packing>
@@ -1038,7 +1038,7 @@
                               </object>
                               <packing>
                                 <property name="left_attach">1</property>
-                                <property name="top_attach">5</property>
+                                <property name="top_attach">6</property>
                                 <property name="width">1</property>
                                 <property name="height">1</property>
                               </packing>
@@ -1055,7 +1055,7 @@
                               </object>
                               <packing>
                                 <property name="left_attach">0</property>
-                                <property name="top_attach">5</property>
+                                <property name="top_attach">6</property>
                                 <property name="width">1</property>
                                 <property name="height">1</property>
                               </packing>
@@ -1073,7 +1073,7 @@
                               </object>
                               <packing>
                                 <property name="left_attach">1</property>
-                                <property name="top_attach">4</property>
+                                <property name="top_attach">5</property>
                                 <property name="width">1</property>
                                 <property name="height">1</property>
                               </packing>
@@ -1090,7 +1090,7 @@
                               </object>
                               <packing>
                                 <property name="left_attach">0</property>
-                                <property name="top_attach">4</property>
+                                <property name="top_attach">5</property>
                                 <property name="width">1</property>
                                 <property name="height">1</property>
                               </packing>
@@ -1222,6 +1222,38 @@
                                 <property name="height">1</property>
                               </packing>
                             </child>
+                            <child>
+                              <object class="GtkLabel" id="capitalizationStyleLabel">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes" comments="Translators: Orca uses 
Speech Dispatcher to present content to users via text-to-speech. Speech Dispatcher has a feature to control 
how capital letters are presented: Do nothing at all; say the word 'capital' prior to presenting a capital 
letter (which Speech Dispatcher refers to as 'spell'), or play a tone (which Speech Dispatcher refers to as a 
sound 'icon'). Orca refers to these things as 'capitalization style'. This string is the text of the label 
through which users can choose which of style they would prefer.">_Capitalization style:</property>
+                                <property name="use_underline">True</property>
+                                <property name="justify">right</property>
+                                <property name="mnemonic_widget">capitalizationStyle</property>
+                                <property name="xalign">1</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">0</property>
+                                <property name="top_attach">4</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkComboBox" id="capitalizationStyle">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <signal name="changed" handler="capitalizationStyleChanged" swapped="no"/>
+                                <child>
+                                  <object class="GtkCellRendererText" id="renderer3"/>
+                                  <attributes>
+                                    <attribute name="text">0</attribute>
+                                  </attributes>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">4</property>
+                              </packing>
+                            </child>
                           </object>
                         </child>
                       </object>
diff --git a/src/orca/orca_gui_prefs.py b/src/orca/orca_gui_prefs.py
index 39d640f..17eda26 100644
--- a/src/orca/orca_gui_prefs.py
+++ b/src/orca/orca_gui_prefs.py
@@ -1334,6 +1334,16 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
         enable = prefs.get("useColorNames", settings.useColorNames)
         self.get_widget("useColorNamesCheckButton").set_active(enable)
 
+        style = prefs.get("capitalizationStyle", settings.capitalizationStyle)
+        combobox = self.get_widget("capitalizationStyle")
+        options = [guilabels.CAPITALIZATION_STYLE_NONE,
+                   guilabels.CAPITALIZATION_STYLE_ICON,
+                   guilabels.CAPITALIZATION_STYLE_SPELL]
+        self.populateComboBox(combobox, options)
+        if style not in options:
+            style = guilabels.CAPITALIZATION_STYLE_NONE
+        combobox.set_active(options.index(style))
+
         combobox2 = self.get_widget("dateFormatCombo")
         sdtime = time.strftime
         ltime = time.localtime
@@ -2380,6 +2390,18 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
             self.prefsDict["progressBarVerbosity"] = \
                 settings.PROGRESS_BAR_APPLICATION
 
+    def capitalizationStyleChanged(self, widget):
+        model = widget.get_model()
+        myIter = widget.get_active_iter()
+        capitalizationStyle = model[myIter][0]
+        if capitalizationStyle == guilabels.CAPITALIZATION_STYLE_ICON:
+            self.prefsDict["capitalizationStyle"] = settings.CAPITALIZATION_STYLE_ICON
+        elif capitalizationStyle == guilabels.CAPITALIZATION_STYLE_SPELL:
+            self.prefsDict["capitalizationStyle"] = settings.CAPITALIZATION_STYLE_SPELL
+        else:
+            self.prefsDict["capitalizationStyle"] = settings.CAPITALIZATION_STYLE_NONE
+        speech.updateCapitalizationStyle()
+
     def sayAllStyleChanged(self, widget):
         """Signal handler for the "changed" signal for the sayAllStyle
            GtkComboBox widget. Set the 'sayAllStyle' preference to the
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index 2d654b9..7d89067 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -843,6 +843,7 @@ class Script(script.Script):
         _settingsManager.loadAppSettings(self)
         braille.setupKeyRanges(list(self.brailleBindings.keys()))
         speech.updatePunctuationLevel()
+        speech.updateCapitalizationStyle()
 
     def updateBraille(self, obj, **args):
         """Updates the braille display to show the give object.
diff --git a/src/orca/settings.py b/src/orca/settings.py
index be8060a..34486aa 100644
--- a/src/orca/settings.py
+++ b/src/orca/settings.py
@@ -113,6 +113,7 @@ userCustomizableSettings = [
     "spellcheckSpellSuggestion",
     "spellcheckPresentContext",
     "useColorNames",
+    "capitalizationStyle",
     "findResultsVerbosity",
     "findResultsMinimumLength",
     "structNavTriggersFocusMode",


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