Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
ti35244 in progress
  • Loading branch information
nishimotz committed Jun 28, 2015
1 parent 570d59b commit cfe677f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions source/NVDAObjects/inputComposition.py
Expand Up @@ -78,13 +78,14 @@ def needDiscriminantReading(gesture):
def reportPartialSelection(sel):
global lastCompositionText, lastCompositionTime
newText = nvdajp_dic.getJapaneseDiscriminantReading(sel)
newTextForBraille = nvdajp_dic.getJapaneseDiscriminantReading(sel, forBraille=True)
if lastCompositionText == newText and lastCompositionTime and time.time() - lastCompositionTime < 0.1:
newText = None
if newText:
log.debug(newText)
lastCompositionTime = time.time()
lastCompositionText = newText
queueHandler.queueFunction(queueHandler.eventQueue,braille.handler.message,newText)
queueHandler.queueFunction(queueHandler.eventQueue,braille.handler.message,newTextForBraille)
queueHandler.queueFunction(queueHandler.eventQueue,speech.speakText,newText,symbolLevel=characterProcessing.SYMLVL_ALL)
#nvdajp end

Expand Down Expand Up @@ -119,14 +120,16 @@ def findOverlayClasses(self,clsList):
def reportNewText(self,oldString,newString,forceNewText=False):
global lastCompositionText, lastCompositionTime #nvdajp
#nvdajp begin
newText=calculateInsertedChars(oldString.strip(u'\u3000'),newString.strip(u'\u3000'))
newTextForBraille = newText = calculateInsertedChars(oldString.strip(u'\u3000'),newString.strip(u'\u3000'))
if forceNewText:
newText=newString.strip(u'\u3000')
isCandidate = False
if config.conf["keyboard"]["nvdajpEnableKeyEvents"] and \
config.conf["inputComposition"]["announceSelectedCandidate"] and \
needDiscriminantReading(lastKeyGesture):
newText = nvdajp_dic.getJapaneseDiscriminantReading(newString.strip(u'\u3000'))
ns = newString.strip(u'\u3000')
newText = nvdajp_dic.getJapaneseDiscriminantReading(ns)
newTextForBraille = nvdajp_dic.getJapaneseDiscriminantReading(ns, forBraille=True)
isCandidate = True
if lastCompositionText == newText and lastCompositionTime and time.time() - lastCompositionTime < 1.0:
newText = None
Expand All @@ -139,7 +142,7 @@ def reportNewText(self,oldString,newString,forceNewText=False):
newText = nvdajp_dic.fixNewText(newText)
lastCompositionTime = time.time()
lastCompositionText = newText
queueHandler.queueFunction(queueHandler.eventQueue,braille.handler.message,newText)
queueHandler.queueFunction(queueHandler.eventQueue,braille.handler.message,newTextForBraille)
if config.conf["keyboard"]["speakTypedCharacters"] or isCandidate:
queueHandler.queueFunction(queueHandler.eventQueue,speech.speakText,newText,symbolLevel=characterProcessing.SYMLVL_ALL)
#nvdajp end
Expand Down
2 changes: 1 addition & 1 deletion source/globalCommands.py
Expand Up @@ -1070,7 +1070,7 @@ def script_review_currentCharacter(self,gesture):
if characterDescriptionMode:
speech.spellTextInfo(info,useCharacterDescriptions=True)
# display description to braille
braille.handler.message(nvdajp_dic.getJapaneseDiscriminantReading(info.text))
braille.handler.message(nvdajp_dic.getJapaneseDiscriminantReading(info.text, forBraille=True))
else:
speech.speakTextInfo(info,unit=textInfos.UNIT_CHARACTER,reason=controlTypes.REASON_CARET)
elif scriptCount==1:
Expand Down
2 changes: 1 addition & 1 deletion source/nvdajp_dic.py
Expand Up @@ -154,7 +154,7 @@ def useAttrDesc(a):

#TODO: merge _get_description() and getJapaneseDiscriminantReading().
#nvdajp must modify locale/ja/characterDescriptions.dic and nvdajp_dic.py.
def getJapaneseDiscriminantReading(name, attrOnly=False, capAnnounced=False):
def getJapaneseDiscriminantReading(name, attrOnly=False, capAnnounced=False, forBraille=False):
if not name: return ''
attrs = []
for c in name:
Expand Down

0 comments on commit cfe677f

Please sign in to comment.