Updated speech handling specifically for web.
This commit is contained in:
@@ -3001,7 +3001,13 @@ class Script(script.Script):
|
||||
self.pointOfReference["lastTextUnitSpoken"] = "word"
|
||||
|
||||
def presentObject(self, obj, **args):
|
||||
interrupt = args.get("interrupt", False)
|
||||
has_interrupt_request = "interrupt" in args
|
||||
interrupt = self.should_interrupt_for_object_presentation(
|
||||
args.get("interrupt", False),
|
||||
args.pop("interrupt_already_handled", False),
|
||||
)
|
||||
if has_interrupt_request:
|
||||
args["interrupt"] = interrupt
|
||||
tokens = ["DEFAULT: Presenting object", obj, ". Interrupt:", interrupt]
|
||||
debug.printTokens(debug.LEVEL_INFO, tokens, True)
|
||||
|
||||
@@ -3421,6 +3427,20 @@ class Script(script.Script):
|
||||
if self.utilities.shouldInterruptForLocusOfFocusChange(oldFocus, newFocus, event):
|
||||
self.presentationInterrupt()
|
||||
|
||||
def should_interrupt_for_object_presentation(
|
||||
self,
|
||||
requested: bool,
|
||||
already_handled: bool = False,
|
||||
) -> bool:
|
||||
"""Returns whether object presentation should interrupt prior output."""
|
||||
|
||||
if requested and already_handled:
|
||||
msg = "DEFAULT: Object presentation interruption already handled by input dispatch"
|
||||
debug.printMessage(debug.LEVEL_INFO, msg, True)
|
||||
return False
|
||||
|
||||
return requested
|
||||
|
||||
def presentKeyboardEvent(self, event):
|
||||
"""Convenience method to present the KeyboardEvent event. Returns True
|
||||
if we fully present the event; False otherwise."""
|
||||
|
||||
@@ -1183,7 +1183,13 @@ class Script(default.Script):
|
||||
super().presentObject(obj, **args)
|
||||
return
|
||||
|
||||
interrupt = args.get("interrupt", False)
|
||||
has_interrupt_request = "interrupt" in args
|
||||
interrupt = self.should_interrupt_for_object_presentation(
|
||||
args.get("interrupt", False),
|
||||
args.pop("interrupt_already_handled", False),
|
||||
)
|
||||
if has_interrupt_request:
|
||||
args["interrupt"] = interrupt
|
||||
tokens = ["WEB: Presenting object", obj, ". Interrupt:", interrupt]
|
||||
debug.printTokens(debug.LEVEL_INFO, tokens, True)
|
||||
|
||||
|
||||
@@ -1221,7 +1221,13 @@ class StructuralNavigation:
|
||||
return
|
||||
|
||||
AXEventSynthesizer.scroll_to_top_edge(obj)
|
||||
self._script.presentObject(obj, offset=offset, priorObj=priorObj, interrupt=True)
|
||||
self._script.presentObject(
|
||||
obj,
|
||||
offset=offset,
|
||||
priorObj=priorObj,
|
||||
interrupt=True,
|
||||
interrupt_already_handled=True,
|
||||
)
|
||||
|
||||
def _presentWithSayAll(self, obj, offset):
|
||||
if self._script.inSayAll() \
|
||||
|
||||
Reference in New Issue
Block a user