[orca] Rename selected-text command and bind it to a keystroke



commit 1632dba2aa8f70abf822fada83a3540f93041613
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Jul 16 09:12:20 2018 -0400

    Rename selected-text command and bind it to a keystroke
    
    * The command will now present the current selection (not just text).
      Note that not all cases / selection types are handled yet.
    
    * The command is now bound to Orca Modifier + Shift + Up.

 help/C/commands_reading.page            | 13 +++++++------
 src/orca/cmdnames.py                    |  7 +++++--
 src/orca/common_keyboardmap.py          |  6 +++---
 src/orca/scripts/apps/soffice/script.py | 10 +++++-----
 src/orca/scripts/default.py             |  8 ++++----
 5 files changed, 24 insertions(+), 20 deletions(-)
---
diff --git a/help/C/commands_reading.page b/help/C/commands_reading.page
index 7f2db3ca8..bff61f729 100644
--- a/help/C/commands_reading.page
+++ b/help/C/commands_reading.page
@@ -176,11 +176,9 @@
       <app>Orca</app> has a dedicated command for obtaining the attributes of the
       text at the caret location. In addition, if you use <app>Orca</app>'s
       Where Am I commands from within a text object in which text has been
-      selected, <app>Orca</app> will announce the selected text. If you would
-      instead prefer a dedicated command for this purpose, you can bind
-      <app>Orca</app>'s Speak Selected Text command to a keystroke. Please see
-      <link xref="howto_key_bindings">Modifying Keybindings</link> for information
-      on how to do so.
+      selected, <app>Orca</app> will announce the selected text. <app>Orca</app>'s
+      command to speak the current selection will also perform this function in a
+      text object.
     </p>
     <list>
       <item>
@@ -221,7 +219,10 @@
       </list>
     </item>
     <item>
-      <p>Speak the selected text: (Unbound)</p>
+      <p>
+        Speak current selection:
+        <keyseq><key>Orca Modifier</key><key>Shift</key><key>Up</key></keyseq>
+      </p>
     </item>
   </list>
   </section>
diff --git a/src/orca/cmdnames.py b/src/orca/cmdnames.py
index 7e50b540f..715be9d12 100644
--- a/src/orca/cmdnames.py
+++ b/src/orca/cmdnames.py
@@ -79,8 +79,11 @@ WHERE_AM_I_BASIC = _("Performs the basic where am I operation.")
 WHERE_AM_I_DETAILED = _("Performs the detailed where am I operation.")
 
 # Translators: This is the description of a dedicated command to speak the
-# selected text (if any) in a document.
-WHERE_AM_I_SELECTED_TEXT = _("Speaks the selected text.")
+# current selection / highlighted object(s). For instance, in a text object,
+# "selection" refers to the selected/highlighted text. In a spreadsheet, it
+# refers to the selected/highlighted cells. In an file manager, it refers to
+# the selected/highlighted icons. Etc.
+WHERE_AM_I_SELECTION = _("Speaks the current selection.")
 
 # Translators: This is the description of a dedicated command to speak details
 # about a link, such as the uri and type of link.
diff --git a/src/orca/common_keyboardmap.py b/src/orca/common_keyboardmap.py
index ae36d4677..d9dc25549 100644
--- a/src/orca/common_keyboardmap.py
+++ b/src/orca/common_keyboardmap.py
@@ -69,6 +69,9 @@ keymap = (
     ("t", defaultModifierMask, ORCA_MODIFIER_MASK,
     "presentDateHandler", 2),
 
+    ("Up", defaultModifierMask, ORCA_SHIFT_MODIFIER_MASK,
+    "whereAmISelectionHandler"),
+
     #####################################################################
     #                                                                   #
     #  Bookmark key bindings                                            #
@@ -194,9 +197,6 @@ keymap = (
     ("", defaultModifierMask, NO_MODIFIER_MASK,
     "shutdownHandler"),
 
-    ("", defaultModifierMask, NO_MODIFIER_MASK,
-    "whereAmISelectedTextHandler"),
-
     ("", defaultModifierMask, NO_MODIFIER_MASK,
     "whereAmILinkHandler"),
 )
diff --git a/src/orca/scripts/apps/soffice/script.py b/src/orca/scripts/apps/soffice/script.py
index 61a7e444e..a4c1a0431 100644
--- a/src/orca/scripts/apps/soffice/script.py
+++ b/src/orca/scripts/apps/soffice/script.py
@@ -165,10 +165,10 @@ class Script(default.Script):
                 cmdnames.PAN_BRAILLE_RIGHT,
                 False) # Do not enable learn mode for this action
 
-        self.inputEventHandlers["whereAmISelectedTextHandler"] = \
+        self.inputEventHandlers["whereAmISelectionHandler"] = \
             input_event.InputEventHandler(
-                Script.whereAmISelectedText,
-                cmdnames.WHERE_AM_I_SELECTED_TEXT)
+                Script.whereAmISelection,
+                cmdnames.WHERE_AM_I_SELECTION)
 
     def getAppKeyBindings(self):
         """Returns the application-specific keybindings for this script."""
@@ -925,9 +925,9 @@ class Script(default.Script):
         super().onWindowDeactivated(event)
         self.spellcheck.deactivate()
 
-    def whereAmISelectedText(self, inputEvent=None, obj=None):
+    def whereAmISelection(self, inputEvent=None, obj=None):
         obj = obj or orca_state.locusOfFocus
         if not self.utilities.isSpreadSheetCell(obj):
-            return super().whereAmISelectedText(inputEvent, obj)
+            return super().whereAmISelection(inputEvent, obj)
 
         return self.utilities.speakSelectedCellRange(self.utilities.getTable(obj))
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index c2749d833..e0068be38 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -172,10 +172,10 @@ class Script(script.Script):
                 Script.whereAmILink,
                 cmdnames.WHERE_AM_I_LINK)
 
-        self.inputEventHandlers["whereAmISelectedTextHandler"] = \
+        self.inputEventHandlers["whereAmISelectionHandler"] = \
             input_event.InputEventHandler(
-                Script.whereAmISelectedText,
-                cmdnames.WHERE_AM_I_SELECTED_TEXT)
+                Script.whereAmISelection,
+                cmdnames.WHERE_AM_I_SELECTION)
 
         self.inputEventHandlers["getTitleHandler"] = \
             input_event.InputEventHandler(
@@ -2086,7 +2086,7 @@ class Script(script.Script):
             speech.speak(self.speechGenerator.generateLinkInfo(link))
         return True
 
-    def whereAmISelectedText(self, inputEvent=None, obj=None):
+    def whereAmISelection(self, inputEvent=None, obj=None):
         obj = obj or orca_state.locusOfFocus
         text, startOffset, endOffset = self.utilities.allSelectedText(obj)
         if not text:


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