Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Powerpoint say all on new slide #17498

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 17 additions & 13 deletions source/appModules/powerpnt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1387,18 +1387,9 @@ def __contains__(self, obj):
def event_treeInterceptor_gainFocus(self):
braille.handler.handleGainFocus(self)
self.rootNVDAObject.reportFocus()
doSayAll = not self.hadFocusOnce and config.conf["virtualBuffers"]["autoSayAllOnPageLoad"]
self.reportNewSlide(self.hadFocusOnce)
if not self.hadFocusOnce:
self.hadFocusOnce = True
if doSayAll:
self.reportNewSlide()
else:
info = self.selection
if not info.isCollapsed:
speech.speakPreselectedText(info.text)
else:
info.expand(textInfos.UNIT_LINE)
speech.speakTextInfo(info, reason=controlTypes.OutputReason.CARET, unit=textInfos.UNIT_LINE)

def event_gainFocus(self, obj, nextHandler):
pass
Expand All @@ -1408,9 +1399,22 @@ def event_gainFocus(self, obj, nextHandler):
def makeTextInfo(self, position):
return self.TextInfo(self, position)

def reportNewSlide(self):
self.makeTextInfo(textInfos.POSITION_FIRST).updateCaret()
sayAll.SayAllHandler.readText(sayAll.CURSOR.CARET)
def reportNewSlide(self, suppressSayAll: bool = False):
"""Reports a new slide, activating say all when appropriate.
:param suppressSayAll: When say all should be suppressed always, e.g.
because tree interceptor gets focus multiple times.
"""
doSayAll = not suppressSayAll and config.conf["virtualBuffers"]["autoSayAllOnPageLoad"]
if doSayAll:
self.makeTextInfo(textInfos.POSITION_FIRST).updateCaret()
sayAll.SayAllHandler.readText(sayAll.CURSOR.CARET)
else:
info = self.selection
if not info.isCollapsed:
speech.speakPreselectedText(info.text)
else:
info.expand(textInfos.UNIT_LINE)
speech.speakTextInfo(info, reason=controlTypes.OutputReason.CARET, unit=textInfos.UNIT_LINE)

@scriptHandler.script(
description=_(
Expand Down
Loading