Skip to content

Commit d67c6e7

Browse files
committed
Fix #50 by zooming in a level
The reportFocus() function handles the zoom since that seems to be where NVDA first tells MathCAT it should navigate. An alternative would be in `script_navigate`. In there, `gesture` is `None`. It seems cleaner in reportFocus(). I needed to remove the 'SetMathML' call in `__init__` because that wipes out the navigation state. As far as I could see, nothing bad happens with that call removed.
1 parent 2213443 commit d67c6e7

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

NVDA-addon/addon/globalPlugins/MathCAT/MathCAT.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,12 @@ def __init__(self, provider=None, mathMl: Optional[str]=None):
133133
super(MathCATInteraction, self).__init__(provider=provider, mathMl=mathMl)
134134
provider._setSpeechLanguage(mathMl)
135135
self.init_mathml = mathMl
136-
try:
137-
libmathcat.SetMathML(mathMl)
138-
except Exception as e:
139-
speech.speakMessage(_("Illegal MathML found: see NVDA error log for details"))
140-
log.error(e)
141136

142137
def reportFocus(self):
143138
super(MathCATInteraction, self).reportFocus()
144139
try:
145-
speech.speak(ConvertSSMLTextForNVDA(libmathcat.GetSpokenText(),
146-
self.provider._language))
140+
text = libmathcat.DoNavigateCommand("ZoomIn")
141+
speech.speak(ConvertSSMLTextForNVDA(text, self.provider._language))
147142
except Exception as e:
148143
log.error(e)
149144
speech.speakMessage(_("Error in speaking math: see NVDA error log for details"))
@@ -182,7 +177,7 @@ def getScript(self, gesture: KeyboardInputGesture):
182177
def script_navigate(self, gesture: KeyboardInputGesture):
183178
# log.info("***MathCAT script_navigate")
184179
try:
185-
if gesture != None:
180+
if gesture != None: # == None when initial focus -- handled in reportFocus()
186181
modNames = gesture.modifierNames
187182
text = libmathcat.DoNavigateKeyPress(gesture.vkCode,
188183
"shift" in modNames, "control" in modNames, "alt" in modNames, False)

0 commit comments

Comments
 (0)