[orca] Have scripts call presentationInterrupt() rather than speech.stop()



commit cc70f9b4c10f837be29c56e5820b52a2a2d3fdd3
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Oct 16 12:28:24 2018 +0200

    Have scripts call presentationInterrupt() rather than speech.stop()
    
    * We also should interrupt braille flash messages
    * It gives scripts the option of not doing the interruption

 src/orca/scripts/apps/gtk-window-decorator/script.py |  2 +-
 src/orca/scripts/apps/metacity/script.py             |  3 +--
 src/orca/scripts/apps/soffice/script.py              |  4 ++--
 src/orca/scripts/default.py                          | 14 ++++++++------
 4 files changed, 12 insertions(+), 11 deletions(-)
---
diff --git a/src/orca/scripts/apps/gtk-window-decorator/script.py 
b/src/orca/scripts/apps/gtk-window-decorator/script.py
index ef147fbc7..61f695f20 100644
--- a/src/orca/scripts/apps/gtk-window-decorator/script.py
+++ b/src/orca/scripts/apps/gtk-window-decorator/script.py
@@ -83,8 +83,8 @@ class Script(default.Script):
         if not found:
             text += ". " + messages.INACCESSIBLE
 
+        self.presentationInterrupt()
         self.displayBrailleMessage(text)
-        speech.stop()
         speech.speak(text)
 
     def onNameChanged(self, event):
diff --git a/src/orca/scripts/apps/metacity/script.py b/src/orca/scripts/apps/metacity/script.py
index 3ab7116ed..9b185e53a 100644
--- a/src/orca/scripts/apps/metacity/script.py
+++ b/src/orca/scripts/apps/metacity/script.py
@@ -52,8 +52,7 @@ class Script(default.Script):
 
         # We have to stop speech, as Metacity has a key grab and we're not
         # getting keys
-        #
-        speech.stop()
+        self.presentationInterrupt()
 
         # If the window was iconified, then obj.name will be surrounded by
         # brackets. If this is the case, remove them before comparing the
diff --git a/src/orca/scripts/apps/soffice/script.py b/src/orca/scripts/apps/soffice/script.py
index 0f98a28ba..12d8c9195 100644
--- a/src/orca/scripts/apps/soffice/script.py
+++ b/src/orca/scripts/apps/soffice/script.py
@@ -434,7 +434,7 @@ class Script(default.Script):
         row, column, table = self.utilities.getRowColumnAndTable(cell)
         try:
             del self.dynamicColumnHeaders[hash(table)]
-            speech.stop()
+            self.presentationInterrupt()
             self.presentMessage(messages.DYNAMIC_COLUMN_HEADER_CLEARED)
         except:
             pass
@@ -480,7 +480,7 @@ class Script(default.Script):
         row, column, table = self.utilities.getRowColumnAndTable(cell)
         try:
             del self.dynamicRowHeaders[hash(table)]
-            speech.stop()
+            self.presentationInterrupt()
             self.presentMessage(messages.DYNAMIC_ROW_HEADER_CLEARED)
         except:
             pass
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index bde29baac..ac4045408 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -1807,7 +1807,8 @@ class Script(script.Script):
 
         Returns True to indicate the input event has been consumed.
         """
-        speech.stop()
+
+        self.presentationInterrupt()
         if _settingsManager.getSetting('silenceSpeech'):
             _settingsManager.setSetting('silenceSpeech', False)
             self.presentMessage(messages.SPEECH_ENABLED)
@@ -2179,7 +2180,7 @@ class Script(script.Script):
             return
 
         if self.stopSpeechOnActiveDescendantChanged(event):
-            speech.stop()
+            self.presentationInterrupt()
 
         orca.setLocusOfFocus(event, event.any_data)
 
@@ -2354,7 +2355,7 @@ class Script(script.Script):
             orca_state.activeWindow = window
             orca.setLocusOfFocus(None, window, False)
 
-        speech.stop()
+        self.presentationInterrupt()
         obj = mouseEvent.obj
         if obj and obj.getState().contains(pyatspi.STATE_FOCUSED):
             orca.setLocusOfFocus(None, obj, windowChanged)
@@ -2847,9 +2848,8 @@ class Script(script.Script):
         # commands running in gnome-terminal.
         #
         if orca_state.locusOfFocus and \
-          (orca_state.locusOfFocus.getApplication() == \
-             event.source.getApplication()):
-            speech.stop()
+           orca_state.locusOfFocus.getApplication() == event.source.getApplication():
+            self.presentationInterrupt()
 
             # Clear the braille display just in case we are about to give
             # focus to an inaccessible application. See bug #519901 for
@@ -3751,6 +3751,8 @@ class Script(script.Script):
         """Convenience method to interrupt presentation of whatever is being
         presented at the moment."""
 
+        msg = "DEFAULT: Interrupting presentation"
+        debug.println(debug.LEVEL_INFO, msg, True)
         speech.stop()
         braille.killFlash()
 


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