[nvda-addons] Re: commit/wintenApps: josephsl: SearchUI: Rewritten as a subclass of NVDA Core app module class (suggested by James Scholes), now silenced when Cortana is listening and spekaing.

  • From: "Joseph Lee" <joseph.lee22590@xxxxxxxxx>
  • To: <nvda-addons@xxxxxxxxxxxxx>, <nvda-addons-commits@xxxxxxxxxxxxx>
  • Date: Sun, 7 Feb 2016 22:17:08 -0800

Hi,
A public thanks to James Scholes for correcting my mistaken methodology. At
this point, NVDA will be silenced while Cortana is listening and speaking
(one will need to exit Start menu in order to let NVDA announce text
responses from Cortana).
Cheers,
osepyh

-----Original Message-----
From: nvda-addons-commits-bounce@xxxxxxxxxxxxx
[mailto:nvda-addons-commits-bounce@xxxxxxxxxxxxx] On Behalf Of
commits-noreply@xxxxxxxxxxxxx
Sent: Sunday, February 7, 2016 10:15 PM
To: nvda-addons-commits@xxxxxxxxxxxxx
Subject: commit/wintenApps: josephsl: SearchUI: Rewritten as a subclass of
NVDA Core app module class (suggested by James Scholes), now silenced when
Cortana is listening and spekaing.

1 new commit in wintenApps:

https://bitbucket.org/nvdaaddonteam/wintenapps/commits/fc13c3b623b4/
Changeset:   fc13c3b623b4
Branch:      master
User:        josephsl
Date:        2016-02-08 06:14:56+00:00
Summary:     SearchUI: Rewritten as a subclass of NVDA Core app module class
(suggested by James Scholes), now silenced when Cortana is listening and
spekaing.

Affected #:  1 file

diff --git a/addon/appModules/searchui.py b/addon/appModules/searchui.py
index f04c04b..6cb9bf9 100755
--- a/addon/appModules/searchui.py
+++ b/addon/appModules/searchui.py
@@ -4,44 +4,17 @@
 #See the file COPYING for more details.
 # Extended by Joseph Lee (released under GPL)
 
-import appModuleHandler
-import controlTypes
-import api
-import speech
-from NVDAObjects.UIA import UIA
-from NVDAObjects.UIA.edge import EdgeList -from NVDAObjects.IAccessible
import IAccessible, ContentGenericClient -import ui
+from nvdaBuiltin.appModules.searchui import *
 
-# Windows 10 Search UI suggestion list item -class SuggestionListItem(UIA):
-
-       role=controlTypes.ROLE_LISTITEM
-
-       def event_UIA_elementSelected(self):
-               focusControllerFor=api.getFocusObject().controllerFor
-               if len(focusControllerFor)>0 and
focusControllerFor[0].appModule is self.appModule and self.name:
-                       speech.cancelSpeech()
-                       api.setNavigatorObject(self)
-                       self.reportFocus()
-
-class AppModule(appModuleHandler.AppModule):
-
-       def chooseNVDAObjectOverlayClasses(self,obj,clsList):
-               if isinstance(obj,UIA) and isinstance(obj.parent,EdgeList):
-                       clsList.insert(0,SuggestionListItem)
-               elif isinstance(obj,IAccessible):
-                       try:
-                               # #5288: Never use ContentGenericClient, as
this uses displayModel
-                               # which will freeze if the process is
suspended.
-                               clsList.remove(ContentGenericClient)
-                       except ValueError:
-                               pass
+class AppModule(AppModule):
 
        # Past responses from Cortana (cached to prevent repetition,
initially an empty string).
        CortanaResponseCache = ""
+       # NVDA should not speak while Cortana is speaking.
+       CortanaIsListening = False
 
        def event_nameChange(self, obj, nextHandler):
+               if self.CortanaIsListening: return
                # NVDA, can you act as a mouthpiece for Cortana?
                if isinstance(obj, UIA):
                        element = obj.UIAElement
@@ -50,3 +23,13 @@ class AppModule(appModuleHandler.AppModule):
                                        ui.message(obj.name)
                nextHandler()
 
+       def event_appModule_gainFocus(self):
+               import globalPlugins
+               if globalPlugins.wintenObjs.letCortanaListen:
+                       self.CortanaIsListening = True
+
+       def event_appModule_loseFocus(self):
+               if self.CortanaIsListening:
+                       self.CortanaIsListening = False
+                       import globalPlugins
+                       globalPlugins.wintenObjs.letCortanaListen = False

Repository URL: https://bitbucket.org/nvdaaddonteam/wintenapps/

--

This is a commit notification from bitbucket.org. You are receiving this
because you have the service enabled, addressing the recipient of this
email.

----------------------------------------------------------------
NVDA add-ons: A list to discuss add-on code enhancements and for reporting 
bugs. 

Community addons are available from: http://addons.nvda-project.org
To send a message to the list: nvda-addons@xxxxxxxxxxxxx
To change your list settings/unsubscribe: 
//www.freelists.org/list/nvda-addons
To contact list moderators: nvda-addons-moderators@xxxxxxxxxxxxx

Other related posts:

  • » [nvda-addons] Re: commit/wintenApps: josephsl: SearchUI: Rewritten as a subclass of NVDA Core app module class (suggested by James Scholes), now silenced when Cortana is listening and spekaing. - Joseph Lee