[orca] Make speech and braille message settings configurable via GUI



commit 089bed5476ca7878f04d4b9053918cd15b632110
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Nov 11 16:18:46 2015 -0500

    Make speech and braille message settings configurable via GUI

 help/C/preferences_braille.page |   58 ++++++++++++++
 help/C/preferences_speech.page  |   13 +++
 src/orca/orca-setup.ui          |  157 +++++++++++++++++++++++++++++++++++++++
 src/orca/orca_gui_prefs.py      |   23 ++++++
 src/orca/scripts/default.py     |    6 +-
 src/orca/settings.py            |    8 +-
 6 files changed, 257 insertions(+), 8 deletions(-)
---
diff --git a/help/C/preferences_braille.page b/help/C/preferences_braille.page
index b75ff7e..3f15c22 100644
--- a/help/C/preferences_braille.page
+++ b/help/C/preferences_braille.page
@@ -110,4 +110,62 @@
       </p>
     </note>
   </section>
+  <section id="flashMessageSettings">
+    <title>Flash Message Settings</title>
+    <p>
+        Flash messages are similar in nature to notifications or announcements:
+        They are shown on your refreshable braille display for a brief time,
+        after which the original contents of the braille display are restored.
+        <app>Orca</app> has several settings you can use to control flash message
+        presentation.
+    </p>
+    <section>
+      <title>Enable flash messages</title>
+      <p>
+        If <gui>Enable flash messages</gui> is checked, <app>Orca</app> will
+        present messages to you in braille. If you prefer to only have
+        <app>Orca</app>'s messages spoken, you should uncheck this checkbox.
+      </p>
+      <p>
+        Default value: checked
+      </p>
+    </section>
+    <section>
+      <title>Messages are detailed</title>
+      <p>
+        If <gui>Messages are detailed</gui> is checked, <app>Orca</app> will
+        present detailed messages to you in braille. For instance, if you
+        use <app>Orca</app>'s command to change key echo, <app>Orca</app> might
+        display "Key echo set to word." If you would prefer shorter messages,
+        such as simply "word," you should uncheck this checkbox.
+      </p>
+      <p>
+        Default value: checked
+      </p>
+    </section>
+    <section>
+      <title>Messages are persistent</title>
+      <p>
+        As stated above, flash messages are only shown for a brief period of time.
+        If you would prefer messages remain displayed until you perform an action
+        which causes your display to be updated, you should check the <gui>Messages
+        are persistent</gui> checkbox.
+      </p>
+      <p>
+        Default value: not checked
+      </p>
+    </section>
+    <section>
+      <title>Message duration (secs)</title>
+      <p>
+        The amount of time <app>Orca</app> will wait before removing the message and
+        restoring the original contents of your display can be set in the <gui>
+        Message duration (secs)</gui> spin button. Note that the value of this
+        setting will be ignored if you have enabled persistent flash messages.
+      </p>
+      <p>
+        Default value: 5
+      </p>
+    </section>
+  </section>
 </page>
diff --git a/help/C/preferences_speech.page b/help/C/preferences_speech.page
index 63cadc8..9c6c9a0 100644
--- a/help/C/preferences_speech.page
+++ b/help/C/preferences_speech.page
@@ -190,6 +190,19 @@
         Default value: not checked
       </p>
     </section>
+    <section id="system_messages_are_detailed">
+      <title>System messages are detailed</title>
+      <p>
+        If <gui>System messages are detailed</gui> is checked, <app>Orca</app> will
+        present detailed messages to you in speech. For instance, if you use
+        <app>Orca</app>'s command to change key echo, <app>Orca</app> might
+        speak "Key echo set to word." If you would prefer shorter messages,
+        such as simply "word," you should uncheck this checkbox.
+      </p>
+      <p>
+        Default value: checked
+      </p>
+    </section>
   </section>
   <section id="progress_bar_updates">
     <title>Progress Bar Updates</title>
diff --git a/src/orca/orca-setup.ui b/src/orca/orca-setup.ui
index 3a7841b..38d9338 100644
--- a/src/orca/orca-setup.ui
+++ b/src/orca/orca-setup.ui
@@ -1639,6 +1639,24 @@
                                             <property name="height">1</property>
                                           </packing>
                                         </child>
+                                        <child>
+                                          <object class="GtkCheckButton" id="messagesAreDetailedCheckButton">
+                                            <property name="label" translatable="yes" comments="Translators: 
Orca's 'system' messages are similar in nature to notifications or announcements. They are most commonly used 
for Orca to communicate Orca-specific information to the user via speech, such as confirming the toggling of 
an Orca setting via command.  In instances where the message to be displayed is long/detailed, Orca provides 
a 'brief' alternative. Users who prefer that brief alternative can uncheck this checkbox.">_System messages 
are detailed</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">5</property>
+                                          </packing>
+                                        </child>
                                       </object>
                                       <packing>
                                         <property name="left_attach">0</property>
@@ -2340,6 +2358,145 @@
                         <property name="height">1</property>
                       </packing>
                     </child>
+                    <child>
+                      <object class="GtkFrame" id="flashMessageSettingsFrame">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label_xalign">0</property>
+                        <property name="shadow_type">none</property>
+                        <child>
+                          <object class="GtkAlignment" id="flashMessageSettingsAlignment">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="left_padding">12</property>
+                            <child>
+                              <object class="GtkGrid" id="flashMessageSettingsGrid">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <child>
+                                  <object class="GtkCheckButton" id="enableFlashMessagesCheckButton">
+                                    <property name="label" translatable="yes" context="FlashMessages" 
comments="Translators: Braille 'flash' messages are similar in nature to notifications or announcements in 
that they are temporarily shown on the user's refreshable braille display. Upon removal of the message, the 
original contents of the braille display are restored. This checkbox allows the user to toggle this 
feature.">Enable flash _messages</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">0</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkGrid" id="flashMessageDurationGrid">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <child>
+                                      <object class="GtkLabel" id="flashMessageDurationLabel">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="label" translatable="yes" context="FlashMessages" 
comments="Translators: Braille 'flash' messages are similar in nature to notifications or announcements. They 
are most commonly used for Orca to communicate Orca-specific information to the user via braille, such as 
confirming the toggling of an Orca setting via command. The reason they are called 'flash' messages by screen 
readers is that they are shown on the refreshable braille display for only a brief time, after which the 
original contents of the display are restored. This label is for the spin button through which a user can 
customize how long (in seconds) these temporary messages should be displayed.">Messa_ge duration 
(secs):</property>
+                                        <property name="use_underline">True</property>
+                                        <property 
name="mnemonic_widget">brailleFlashTimeSpinButton</property>
+                                        <property name="xalign">0</property>
+                                      </object>
+                                      <packing>
+                                        <property name="left_attach">0</property>
+                                        <property name="top_attach">0</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkSpinButton" id="brailleFlashTimeSpinButton">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="invisible_char">●</property>
+                                        <property name="adjustment">adjustment4</property>
+                                        <property name="climb_rate">1</property>
+                                        <property name="numeric">True</property>
+                                        <property name="value">5</property>
+                                        <signal name="value-changed" handler="brailleFlashTimeValueChanged" 
swapped="no"/>
+                                      </object>
+                                      <packing>
+                                        <property name="left_attach">1</property>
+                                        <property name="top_attach">0</property>
+                                      </packing>
+                                    </child>
+                                  </object>
+                                  <packing>
+                                    <property name="left_attach">0</property>
+                                    <property name="top_attach">3</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="flashIsPersistentCheckButton">
+                                    <property name="label" translatable="yes" context="FlashMessages" 
comments="Translators: Braille 'flash' messages are similar in nature to notifications or announcements. They 
are most commonly used for Orca to communicate Orca-specific information to the user via braille, such as 
confirming the toggling of an Orca setting via command. The reason they are called 'flash' messages by screen 
readers is that they are shown on the refreshable braille display for only a brief time, after which the 
original contents of the display are restored. Some users, however, would prefer to have the message remain 
displayed until they explicitly dismiss it. This can be accomplished by making flash messages 'persistent' by 
checking this checkbox.">Messages are _persistent</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="flashPersistenceToggled" swapped="no"/>
+                                  </object>
+                                  <packing>
+                                    <property name="left_attach">0</property>
+                                    <property name="top_attach">2</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkCheckButton" id="flashIsDetailedCheckButton">
+                                    <property name="label" translatable="yes" context="FlashMessages" 
comments="Translators: Braille 'flash' messages are similar in nature to notifications or announcements. They 
are most commonly used for Orca to communicate Orca-specific information to the user via braille, such as 
confirming the toggling of an Orca setting via command. The reason they are called 'flash' messages by screen 
readers is that they are shown on the refreshable braille display for only a brief time, after which the 
original contents of the display are restored. In instances where the message to be displayed is 
long/detailed, Orca provides a 'brief' alternative. Users who prefer the brief alternative can uncheck this 
checkbox.">Messages are _detailed</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">1</property>
+                                  </packing>
+                                </child>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
+                        <child type="label">
+                          <object class="GtkLabel" id="flashMessageSettingsLabel">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes" context="FlashMessages" 
comments="Translators: Braille 'flash' messages are similar in nature to notifications or announcements. They 
are most commonly used for Orca to communicate Orca-specific information to the user via braille, such as 
confirming the toggling of an Orca setting via command. The reason they are called 'flash' messages by screen 
readers is that they are shown on the refreshable braille display for only a brief time, after which the 
original contents of the display are restored.">Flash Message Settings</property>
+                            <property name="ellipsize">end</property>
+                            <attributes>
+                              <attribute name="weight" value="bold"/>
+                            </attributes>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
diff --git a/src/orca/orca_gui_prefs.py b/src/orca/orca_gui_prefs.py
index 0f3716d..ac911b6 100644
--- a/src/orca/orca_gui_prefs.py
+++ b/src/orca/orca_gui_prefs.py
@@ -974,6 +974,11 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
         model = combobox.get_model()
         myIter = combobox.get_active_iter()
         self.prefsDict["brailleContractionTable"] = model[myIter][1]
+
+    def flashPersistenceToggled(self, checkbox):
+        grid = self.get_widget('flashMessageDurationGrid')
+        grid.set_sensitive(not checkbox.get_active())
+        self.prefsDict["flashIsPersistent"] = checkbox.get_active()
         
     def textAttributeSpokenToggled(self, cell, path, model):
         """The user has toggled the state of one of the text attribute
@@ -1323,6 +1328,9 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
         self.get_widget("enableMnemonicSpeakingCheckButton").set_active(\
             prefs["enableMnemonicSpeaking"])
 
+        enable = prefs.get("messagesAreDetailed", settings.messagesAreDetailed)
+        self.get_widget("messagesAreDetailedCheckButton").set_active(enable)
+
         combobox = self.get_widget("sayAllStyle")
         self.populateComboBox(combobox, [guilabels.SAY_ALL_STYLE_LINE,
                                          guilabels.SAY_ALL_STYLE_SENTENCE])
@@ -1503,6 +1511,18 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
         else:
             self.get_widget("brailleLinkNoneButton").set_active(True)
 
+        enable = prefs.get("enableFlashMessages", settings.enableFlashMessages)
+        self.get_widget("enableFlashMessagesCheckButton").set_active(enable)
+
+        enable = prefs.get("flashIsPersistent", settings.flashIsPersistent)
+        self.get_widget("flashIsPersistentCheckButton").set_active(enable)
+
+        enable = prefs.get("flashIsDetailed", settings.flashIsDetailed)
+        self.get_widget("flashIsDetailedCheckButton").set_active(enable)
+
+        duration = prefs["brailleFlashTime"]
+        self.get_widget("speakProgressBarSpinButton").set_value(duration / 1000)
+
         # Key Echo pane.
         #
         self.get_widget("keyEchoCheckButton").set_active( \
@@ -2507,6 +2527,9 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
 
         self.prefsDict["progressBarUpdateInterval"] = widget.get_value_as_int()
 
+    def brailleFlashTimeValueChanged(self, widget):
+        self.prefsDict["brailleFlashTime"] = widget.get_value_as_int() * 1000
+
     def abbrevRolenamesChecked(self, widget):
         """Signal handler for the "toggled" signal for the abbrevRolenames
            GtkCheckButton widget. The user has [un]checked the 'Abbreviated
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index d21fccf..7da859b 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -4147,8 +4147,7 @@ class Script(script.Script):
                 'capitalizationStyle', settings.CAPITALIZATION_STYLE_NONE)
             speech.updateCapitalizationStyle()
 
-            if _settingsManager.getSetting('messageVerbosityLevel') \
-                    == settings.VERBOSITY_LEVEL_BRIEF:
+            if not _settingsManager.getSetting('messagesAreDetailed'):
                 message = briefMessage
             else:
                 message = fullMessage
@@ -4162,8 +4161,7 @@ class Script(script.Script):
         if (_settingsManager.getSetting('enableBraille') \
              or _settingsManager.getSetting('enableBrailleMonitor')) \
            and _settingsManager.getSetting('enableFlashMessages'):
-            if _settingsManager.getSetting('flashVerbosityLevel') \
-                    == settings.VERBOSITY_LEVEL_BRIEF:
+            if not _settingsManager.getSetting('flashIsDetailed'):
                 message = briefMessage
             else:
                 message = fullMessage
diff --git a/src/orca/settings.py b/src/orca/settings.py
index b44eab5..7626833 100644
--- a/src/orca/settings.py
+++ b/src/orca/settings.py
@@ -101,8 +101,8 @@ userCustomizableSettings = [
     "enableFlashMessages",
     "brailleFlashTime",
     "flashIsPersistent",
-    "flashVerbosityLevel",
-    "messageVerbosityLevel",
+    "flashIsDetailed",
+    "messagesAreDetailed",
     "presentDateFormat",
     "presentTimeFormat",
     "activeProfile",
@@ -211,7 +211,7 @@ sayAllStyle                  = SAYALL_STYLE_SENTENCE
 capitalizationStyle          = CAPITALIZATION_STYLE_NONE
 verbalizePunctuationStyle    = PUNCTUATION_STYLE_MOST
 speechVerbosityLevel         = VERBOSITY_LEVEL_VERBOSE
-messageVerbosityLevel        = VERBOSITY_LEVEL_VERBOSE
+messagesAreDetailed          = True
 enablePauseBreaks            = True
 
 # Braille
@@ -222,6 +222,7 @@ enableBrailleContext           = True
 enableFlashMessages            = True
 brailleFlashTime               = 5000
 flashIsPersistent              = False
+flashIsDetailed                = True
 enableContractedBraille        = False
 brailleContractionTable        = ''
 disableBrailleEOL              = False
@@ -230,7 +231,6 @@ brailleSelectorIndicator       = BRAILLE_UNDERLINE_BOTH
 brailleLinkIndicator           = BRAILLE_UNDERLINE_BOTH
 textAttributesBrailleIndicator = BRAILLE_UNDERLINE_NONE
 brailleVerbosityLevel          = VERBOSITY_LEVEL_VERBOSE
-flashVerbosityLevel            = VERBOSITY_LEVEL_VERBOSE
 brailleAlignmentStyle          = BRAILLE_ALIGN_BY_EDGE
 brailleAlignmentMargin         = 3
 brailleMaximumJump             = 8


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