def write(self, text): if text.find('\x00') >= 0: text = text.replace('\x00', '') text = "===Warning, text contains null bytes==\n" + text if type(text) == types.UnicodeType: text = text.encode('cp1252') natlink.displayText(text, 0)
def log(self, t, doPlaystring=None): # displayTest seems not to work: natlink.displayText(t, 0) if doPlaystring: natlink.playString(t+'\n') # do the global log function: log(t)
def log(self, t, doPlaystring=None): # displayTest seems not to work: natlink.displayText(t, 0) if doPlaystring: natlink.playString(t + '\n') # do the global log function: log(t)
def testPreTests(self): # make sure that NatSpeak is loaded into memory testForException = self.doTestForException # these function should all fail before natConnect is called testForException(natlink.NatError, "natlink.playString('')") testForException(natlink.NatError, "natlink.getCurrentModule()") testForException(natlink.NatError, "natlink.getCurrentUser()") testForException(natlink.NatError, "natlink.getMicState()") testForException(natlink.NatError, "natlink.setMicState('off')") testForException(natlink.NatError, "natlink.execScript('')") testForException(natlink.NatError, "natlink.recognitionMimic('')") testForException(natlink.NatError, "natlink.playEvents([])") testForException(natlink.NatError, "natlink.inputFromFile('test.wav')") testForException(natlink.NatError, "natlink.setTimerCallback(None)") testForException(natlink.NatError, "natlink.getTrainingMode()") testForException(natlink.NatError, "natlink.startTraining('calibrate')") testForException(natlink.NatError, "natlink.finishTraining()") testForException(natlink.NatError, "natlink.getAllUsers()") testForException(natlink.NatError, "natlink.openUser('testUser')") testForException(natlink.NatError, "natlink.saveUser()") testForException(natlink.NatError, "natlink.getUserTraining()") testForException(natlink.NatError, "natlink.waitForSpeech(0)") testForException(natlink.NatError, "natlink.GramObj().load('')") testForException(natlink.NatError, "natlink.DictObj()") # these functions should all work before natConnect is called natlink.displayText('', 0) natlink.getClipboard() natlink.getCallbackDepth() natlink.getCursorPos() natlink.getScreenSize() natlink.setBeginCallback(None) natlink.setChangeCallback(None) natlink.isNatSpeakRunning()
def testPreTests(self): # make sure that NatSpeak is loaded into memory testForException = self.doTestForException # these function should all fail before natConnect is called testForException( natlink.NatError, "natlink.playString('')" ) testForException( natlink.NatError, "natlink.getCurrentModule()" ) testForException( natlink.NatError, "natlink.getCurrentUser()" ) testForException( natlink.NatError, "natlink.getMicState()" ) testForException( natlink.NatError, "natlink.setMicState('off')" ) testForException( natlink.NatError, "natlink.execScript('')" ) testForException( natlink.NatError, "natlink.recognitionMimic('')" ) testForException( natlink.NatError, "natlink.playEvents([])" ) testForException( natlink.NatError, "natlink.inputFromFile('test.wav')" ) testForException( natlink.NatError, "natlink.setTimerCallback(None)" ) testForException( natlink.NatError, "natlink.getTrainingMode()" ) testForException( natlink.NatError, "natlink.startTraining('calibrate')" ) testForException( natlink.NatError, "natlink.finishTraining()" ) testForException( natlink.NatError, "natlink.getAllUsers()" ) testForException( natlink.NatError, "natlink.openUser('testUser')" ) testForException( natlink.NatError, "natlink.saveUser()" ) testForException( natlink.NatError, "natlink.getUserTraining()" ) testForException( natlink.NatError, "natlink.waitForSpeech(0)" ) testForException( natlink.NatError, "natlink.GramObj().load('')" ) testForException( natlink.NatError, "natlink.DictObj()" ) # these functions should all work before natConnect is called natlink.displayText('',0) natlink.getClipboard() natlink.getCallbackDepth() natlink.getCursorPos() natlink.getScreenSize() natlink.setBeginCallback(None) natlink.setChangeCallback(None) natlink.isNatSpeakRunning()
def write(self, text): # if text.find('\x00') >= 0: # text = text.replace('\x00', '') # text = "===Warning, text contains null bytes===\n" + text # if type(text) == str: # text = text.encode('cp1252') natlink.displayText(text, 1)
def gotResults_start(self, words, fullResults): #pylint:disable=R0201 natlink.displayText( '\nHeard macro "sample directory (info|information)"\n\n', 0) language = status.get_language() print(f'Language is: {language}') print( f'NatlinkDirectory from status (natlinkstatus): {status.getNatlinkDirectory()}' ) print( f'NatlinkUserDirectory from natlinkcore: {natlinkcore.getNatlinkUserDirectory()}' )
def write(self, text): natlink.displayText(text, self._error)
def log(self, t): if self.isConnected: natlink.displayText(t, 0) else: print(t) print(t, file=open(logFileName, "a"))
def write(self, text): natlink.displayText(text, 0)
def write(self, text: AnyStr) -> int: if not isinstance(text, str): raise ValueError(f'Can only write str, not {type(text)}') natlink.displayText(text, True) return len(text)
def gotResults_start(self, words, fullResults): natlink.displayText('Heard macro "sample one"{enter}', 0)
def write(self,text): natlink.displayText(text, 1)