Exemplo n.º 1
0
 def _calculateNewText(self, newLines, oldLines):
     hasNewLines = (self._findNonBlankIndices(newLines) !=
                    self._findNonBlankIndices(oldLines))
     if hasNewLines:
         # Clear the typed word buffer for new text lines.
         speech.clearTypedWordBuffer()
         self._queuedChars = []
     return super()._calculateNewText(newLines, oldLines)
Exemplo n.º 2
0
    def script_flush_queuedChars(self, gesture):
        """
		Flushes the typed word buffer if present.
		Since these gestures clear the current word/line, we should flush the
		current words buffer to avoid erroneously reporting words that already have been processed.
		"""
        gesture.send()
        speech.clearTypedWordBuffer()
Exemplo n.º 3
0
    def script_flush_queuedChars(self, gesture):
        """
		Flushes the typed word buffer and queue of typedCharacter events if present.
		Since these gestures clear the current word/line, we should flush the
		queue to avoid erroneously reporting these chars.
		"""
        self._queuedChars = []
        speech.clearTypedWordBuffer()
        gesture.send()
Exemplo n.º 4
0
 def _reportNewLines(self, lines):
     # Perform typed character filtering, as typed characters are handled with events.
     if (len(lines) == 1 and not self._hasTab and
             len(lines[0].strip()) < max(len(speech.curWordChars) + 1, 3)):
         return
     # Clear the typed word buffer for new text lines.
     speech.clearTypedWordBuffer()
     self._queuedChars = []
     super()._reportNewLines(lines)
Exemplo n.º 5
0
 def event_typedCharacter(self, ch):
     if ch == '\t':
         # Clear the typed word buffer for tab completion.
         speech.clearTypedWordBuffer()
     if ((config.conf['keyboard']['speakTypedCharacters']
          or config.conf['keyboard']['speakTypedWords'])
             and not config.conf['UIA']['winConsoleSpeakPasswords']):
         self._queuedChars.append(ch)
     else:
         super(WinConsoleUIA, self).event_typedCharacter(ch)
Exemplo n.º 6
0
 def event_typedCharacter(self, ch):
     if ch == '\t':
         self._hasTab = True
         # Clear the typed word buffer for tab completion.
         speech.clearTypedWordBuffer()
     else:
         self._hasTab = False
     if ((config.conf['keyboard']['speakTypedCharacters']
          or config.conf['keyboard']['speakTypedWords'])
             and not config.conf['terminals']['speakPasswords']
             and self._supportsTextChange):
         self._queuedChars.append(ch)
     else:
         super().event_typedCharacter(ch)
Exemplo n.º 7
0
	def _caretScriptPostMovedHelper(self, speakUnit, gesture, info=None):
		if isScriptWaiting() or eventHandler.isPendingEvents("gainFocus"):
			return
		if not info:
			try:
				info = self.makeTextInfo(textInfos.POSITION_CARET)
			except:
				return
		# Forget the word currently being typed as the user has moved the caret somewhere else.
		speech.clearTypedWordBuffer()
		review.handleCaretMove(info)
		if speakUnit and not willSayAllResume(gesture):
			info.expand(speakUnit)
			speech.speakTextInfo(info, unit=speakUnit, reason=controlTypes.REASON_CARET)
		braille.handler.handleCaretMove(self)
Exemplo n.º 8
0
 def _caretMoveBySentenceHelper(self, gesture, direction):
     if isScriptWaiting():
         return
     if not self.WinwordSelectionObject:
         # Legacy object model not available.
         # Translators: a message when navigating by sentence is unavailable in MS Word
         ui.message(
             _("Navigating by sentence not supported in this document"))
         gesture.send()
         return
     # Using the legacy object model,
     # Move the caret to the next sentence in the requested direction.
     legacyInfo = LegacyWordDocumentTextInfo(self, textInfos.POSITION_CARET)
     legacyInfo.move(textInfos.UNIT_SENTENCE, direction)
     # Save the start of the sentence for future use
     legacyStart = legacyInfo.copy()
     # With the legacy object model,
     # Move the caret to the end of the new sentence.
     legacyInfo.move(textInfos.UNIT_SENTENCE, 1)
     legacyInfo.updateCaret()
     # Fetch the caret position (end of the next sentence) with UI automation.
     endInfo = self.makeTextInfo(textInfos.POSITION_CARET)
     # Move the caret back to the start of the next sentence,
     # where it should be left for the user.
     legacyStart.updateCaret()
     # Fetch the new caret position (start of the next sentence) with UI Automation.
     startInfo = self.makeTextInfo(textInfos.POSITION_CARET)
     # Make a UI automation text range spanning the entire next sentence.
     info = startInfo.copy()
     info.end = endInfo.end
     # Speak the sentence moved to
     speech.speakTextInfo(info,
                          unit=textInfos.UNIT_SENTENCE,
                          reason=controlTypes.OutputReason.CARET)
     # Forget the word currently being typed as the user has moved the caret somewhere else.
     speech.clearTypedWordBuffer()
     # Alert review and braille the caret has moved to its new position
     review.handleCaretMove(info)
     braille.handler.handleCaretMove(self)