def run(self): try: self._appInstance=windll.kernel32.GetModuleHandleW(None) self._cInputTouchWindowProc=winUser.WNDPROC(self.inputTouchWndProc) self._wc=winUser.WNDCLASSEXW(cbSize=sizeof(winUser.WNDCLASSEXW),lpfnWndProc=self._cInputTouchWindowProc,hInstance=self._appInstance,lpszClassName="inputTouchWindowClass") self._wca=windll.user32.RegisterClassExW(byref(self._wc)) self._touchWindow=windll.user32.CreateWindowExW(0,self._wca,u"NVDA touch input",0,0,0,0,0,HWND_MESSAGE,None,self._appInstance,None) windll.user32.RegisterPointerInputTarget(self._touchWindow,PT_TOUCH) oledll.oleacc.AccSetRunningUtilityState(self._touchWindow,ANRUS_TOUCH_MODIFICATION_ACTIVE,ANRUS_TOUCH_MODIFICATION_ACTIVE) self.trackerManager=touchTracker.TrackerManager() self.screenExplorer=screenExplorer.ScreenExplorer() self.screenExplorer.updateReview=True self.gesturePump=self.gesturePumpFunc() queueHandler.registerGeneratorObject(self.gesturePump) except Exception as e: self.threadExc=e finally: self.initializedEvent.set() msg=MSG() while windll.user32.GetMessageW(byref(msg),None,0,0): windll.user32.TranslateMessage(byref(msg)) windll.user32.DispatchMessageW(byref(msg)) self.gesturePump.close() oledll.oleacc.AccSetRunningUtilityState(self._touchWindow,ANRUS_TOUCH_MODIFICATION_ACTIVE,0) windll.user32.UnregisterPointerInputTarget(self._touchWindow,PT_TOUCH) windll.user32.DestroyWindow(self._touchWindow) windll.user32.UnregisterClassW(self._wca,self._appInstance)
def script_goToMatchingBrace(self, gesture): gesture.send() info = self.makeTextInfo(textInfos.POSITION_CARET).copy() #Expand to line. info.expand(textInfos.UNIT_LINE) if info.text.strip() in ('{', '}'): #This line is only one brace. Not very helpful to read, lets read the previous and next line as well. #Move it's start back a line. info.move(textInfos.UNIT_LINE, -1, endPoint = "start") # Move it's end one line, forward. info.move(textInfos.UNIT_LINE, 1, endPoint = "end") #speak the info. registerGeneratorObject((speech.speakMessage(i) for i in info.text.split("\n"))) else: speech.speakMessage(info.text)
def speakSpelling(text,locale=None,useCharacterDescriptions=False): global beenCanceled, _speakSpellingGenID import speechViewer if speechViewer.isActive: speechViewer.appendText(text) if speechMode==speechMode_off: return elif speechMode==speechMode_beeps: tones.beep(config.conf["speech"]["beepSpeechModePitch"],speechMode_beeps_ms) return if isPaused: cancelSpeech() beenCanceled=False from languageHandler import getLanguage locale=getLanguage() if not isinstance(text,basestring) or len(text)==0: return getSynth().speakText(processSymbol("")) if not text.isspace(): text=text.rstrip() gen=_speakSpellingGen(text,locale,useCharacterDescriptions) try: # Speak the first character before this function returns. next(gen) except StopIteration: return _speakSpellingGenID=queueHandler.registerGeneratorObject(gen)
def run(self): try: self._appInstance = windll.kernel32.GetModuleHandleW(None) self._cInputTouchWindowProc = winUser.WNDPROC( self.inputTouchWndProc) self._wc = winUser.WNDCLASSEXW( cbSize=sizeof(winUser.WNDCLASSEXW), lpfnWndProc=self._cInputTouchWindowProc, hInstance=self._appInstance, lpszClassName="inputTouchWindowClass") self._wca = windll.user32.RegisterClassExW(byref(self._wc)) self._touchWindow = windll.user32.CreateWindowExW( 0, self._wca, u"NVDA touch input", 0, 0, 0, 0, 0, HWND_MESSAGE, None, self._appInstance, None) windll.user32.RegisterPointerInputTarget(self._touchWindow, PT_TOUCH) oledll.oleacc.AccSetRunningUtilityState( self._touchWindow, ANRUS_TOUCH_MODIFICATION_ACTIVE, ANRUS_TOUCH_MODIFICATION_ACTIVE) self.trackerManager = touchTracker.TrackerManager() self.screenExplorer = screenExplorer.ScreenExplorer() self.screenExplorer.updateReview = True self.gesturePump = self.gesturePumpFunc() queueHandler.registerGeneratorObject(self.gesturePump) except Exception as e: self.threadExc = e finally: self.initializedEvent.set() msg = MSG() while windll.user32.GetMessageW(byref(msg), None, 0, 0): windll.user32.TranslateMessage(byref(msg)) windll.user32.DispatchMessageW(byref(msg)) self.gesturePump.close() oledll.oleacc.AccSetRunningUtilityState( self._touchWindow, ANRUS_TOUCH_MODIFICATION_ACTIVE, 0) windll.user32.UnregisterPointerInputTarget(self._touchWindow, PT_TOUCH) windll.user32.DestroyWindow(self._touchWindow) windll.user32.UnregisterClassW(self._wca, self._appInstance)
def _startGenerator(generator): global _generatorID stop() _generatorID = queueHandler.registerGeneratorObject(generator)
def run(self): ret = self._func(*self._args, **self._kwargs) if self._callback: queueHandler.registerGeneratorObject(self._callback_gen(ret))