def script_modified_review_nextCharacter(self, gesture): #Add character description Braille output to the review character when Braille review mode is turned on. lineInfo = api.getReviewPosition().copy() lineInfo.expand(textInfos.UNIT_LINE) charInfo = api.getReviewPosition().copy() charInfo.expand(textInfos.UNIT_CHARACTER) charInfo.collapse() res = charInfo.move(textInfos.UNIT_CHARACTER, 1) if res == 0 or charInfo.compareEndPoints(lineInfo, "endToEnd") >= 0: ui.reviewMessage(_("Right")) reviewInfo = api.getReviewPosition().copy() reviewInfo.expand(textInfos.UNIT_CHARACTER) speech.speakTextInfo(reviewInfo, unit=textInfos.UNIT_CHARACTER, reason=controlTypes.OutputReason.CARET) char = reviewInfo.text.lower() if not isAlphanumeric(char) and CJK["brailleReview"] == "Auto": try: charDesc = characterProcessing.getCharacterDescription( CJK["locale"], char) BrailleHandler.message(handler, char + " " + " ".join(charDesc)) except TypeError: pass else: api.setReviewPosition(charInfo) charInfo.expand(textInfos.UNIT_CHARACTER) speech.speakTextInfo(charInfo, unit=textInfos.UNIT_CHARACTER, reason=controlTypes.OutputReason.CARET) char = charInfo.text.lower() if not isAlphanumeric(char) and CJK["brailleReview"] == "Auto": try: charDesc = characterProcessing.getCharacterDescription( CJK["locale"], char) BrailleHandler.message(handler, char + " " + " ".join(charDesc)) except TypeError: pass
def script_forward_review_currentCharacter(self, gesture): #When speech review mode is enabled, the first character description is spoken on first script call. #When Braille review mode is set to "On" or "Auto", character descriptions are displayed on the first script call. CJK["direction"] = 1 info = api.getReviewPosition().copy() info.expand(textInfos.UNIT_CHARACTER) count = getLastScriptRepeatCount() try: c = ord(info.text) except: c = 0 if count == 1 or (CJK["speechReview"] == "On" or CJK["brailleReview"] != "Off"): CJK["isReviewCharacter"] = True if count == 1 or CJK["speechReview"] == "On": speech.speakSpelling(info.text, useCharacterDescriptions=True) else: speech.speakTextInfo(info, unit=textInfos.UNIT_CHARACTER, reason=controlTypes.OutputReason.CARET) if CJK["brailleReview"] == "On" or CJK["brailleReview"] == "Auto": try: char = info.text.lower() charDesc = characterProcessing.getCharacterDescription( CJK["locale"], char) BrailleHandler.message(handler, char + " " + " ".join(charDesc)) except TypeError: pass elif count == 0: speech.speakTextInfo(info, unit=textInfos.UNIT_CHARACTER, reason=controlTypes.OutputReason.CARET) else: try: speech.speakMessage("%d," % c) speech.speakSpelling(hex(c)) except: speech.speakTextInfo(info, unit=textInfos.UNIT_CHARACTER, reason=controlTypes.OutputReason.CARET) #Reset parameters to prepare for the next call. CJK["direction"] = 0 CJK["isReviewCharacter"] = False