Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions source/NVDAObjects/IAccessible/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1471,10 +1471,10 @@ def event_alert(self):
api.processPendingEvents()
if self in api.getFocusAncestors():
return
speech.speakObject(self, reason=controlTypes.REASON_FOCUS, priority=speech.Spri.NOW)
speech.speakObject(self, reason=controlTypes.OutputReason.FOCUS, priority=speech.Spri.NOW)
for child in self.recursiveDescendants:
if controlTypes.STATE_FOCUSABLE in child.states:
speech.speakObject(child, reason=controlTypes.REASON_FOCUS, priority=speech.Spri.NOW)
speech.speakObject(child, reason=controlTypes.OutputReason.FOCUS, priority=speech.Spri.NOW)

def event_caret(self):
focus = api.getFocusObject()
Expand Down Expand Up @@ -1956,11 +1956,11 @@ class IENotificationBar(Dialog,IAccessible):

def event_alert(self):
speech.cancelSpeech()
speech.speakObject(self,reason=controlTypes.REASON_FOCUS)
speech.speakObject(self, reason=controlTypes.OutputReason.FOCUS)
child=self.simpleFirstChild
while child:
if child.role!=controlTypes.ROLE_STATICTEXT:
speech.speakObject(child,reason=controlTypes.REASON_FOCUS)
speech.speakObject(child, reason=controlTypes.OutputReason.FOCUS)
child=child.simpleNext


Expand Down
5 changes: 4 additions & 1 deletion source/NVDAObjects/IAccessible/ia2Web.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ def event_IA2AttributeChange(self):
if self is api.getFocusObject():
# Report aria-current if it changed.
speech.speakObjectProperties(
self, current=True, reason=controlTypes.REASON_CHANGE)
self,
current=True,
reason=controlTypes.OutputReason.CHANGE
)
# super calls event_stateChange which updates braille, so no need to
# update braille here.

Expand Down
4 changes: 2 additions & 2 deletions source/NVDAObjects/IAccessible/winword.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def script_caret_moveByCell(self,gesture):
isCollapsed=info.isCollapsed
if inTable:
info.expand(textInfos.UNIT_CELL)
speech.speakTextInfo(info,reason=controlTypes.REASON_FOCUS)
speech.speakTextInfo(info, reason=controlTypes.OutputReason.FOCUS)
braille.handler.handleCaretMove(self)

def script_reportCurrentComment(self,gesture):
Expand Down Expand Up @@ -339,7 +339,7 @@ def _moveInTable(self,row=True,forward=True):
ui.message(_("Edge of table"))
return False
newInfo=WordDocumentTextInfo(self,textInfos.POSITION_CARET,_rangeObj=foundCell)
speech.speakTextInfo(newInfo,reason=controlTypes.REASON_CARET, unit=textInfos.UNIT_CELL)
speech.speakTextInfo(newInfo, reason=controlTypes.OutputReason.CARET, unit=textInfos.UNIT_CELL)
newInfo.collapse()
newInfo.updateCaret()
return True
Expand Down
4 changes: 2 additions & 2 deletions source/NVDAObjects/UIA/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1668,7 +1668,7 @@ def event_UIA_systemAlert(self):
This just reports the element that received the alert in speech and braille, similar to how focus is presented.
Skype for business toast notifications being one example.
"""
speech.speakObject(self, reason=controlTypes.REASON_FOCUS)
speech.speakObject(self, reason=controlTypes.OutputReason.FOCUS)
# Ideally, we wouldn't use getPropertiesBraille directly.
braille.handler.message(braille.getPropertiesBraille(name=self.name, role=self.role))

Expand Down Expand Up @@ -1768,7 +1768,7 @@ def event_focusEntered(self):
def event_valueChange(self):
focusParent=api.getFocusObject().parent
if self==focusParent:
speech.speakObjectProperties(self,value=True,reason=controlTypes.REASON_CHANGE)
speech.speakObjectProperties(self, value=True, reason=controlTypes.OutputReason.CHANGE)
else:
super(SensitiveSlider,self).event_valueChange()

Expand Down
6 changes: 5 additions & 1 deletion source/NVDAObjects/UIA/edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,11 @@ def _iterNodesByType(self,nodeType,direction="next",pos=None):

def shouldPassThrough(self,obj,reason=None):
# Enter focus mode for selectable list items (<select> and role=listbox)
if reason==controlTypes.REASON_FOCUS and obj.role==controlTypes.ROLE_LISTITEM and controlTypes.STATE_SELECTABLE in obj.states:
if(
reason == controlTypes.OutputReason.FOCUS
and obj.role == controlTypes.ROLE_LISTITEM
and controlTypes.STATE_SELECTABLE in obj.states
):
return True
return super(EdgeHTMLTreeInterceptor,self).shouldPassThrough(obj,reason=reason)

Expand Down
2 changes: 1 addition & 1 deletion source/NVDAObjects/UIA/wordDocument.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def script_tab(self,gesture):
return
info=self.makeTextInfo(textInfos.POSITION_SELECTION)
if not info.isCollapsed:
speech.speakTextInfo(info,reason=controlTypes.REASON_FOCUS)
speech.speakTextInfo(info, reason=controlTypes.OutputReason.FOCUS)
script_shiftTab=script_tab

def _iterNodesByType(self,nodeType,direction="next",pos=None):
Expand Down
12 changes: 6 additions & 6 deletions source/NVDAObjects/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ def _get_shouldAcceptShowHideCaretEvent(self):
def reportFocus(self):
"""Announces this object in a way suitable such that it gained focus.
"""
speech.speakObject(self,reason=controlTypes.REASON_FOCUS)
speech.speakObject(self, reason=controlTypes.OutputReason.FOCUS)

def _get_placeholder(self):
"""If it exists for this object get the value of the placeholder text.
Expand Down Expand Up @@ -1109,7 +1109,7 @@ def event_mouseMove(self,x,y):

def event_stateChange(self):
if self is api.getFocusObject():
speech.speakObjectProperties(self,states=True, reason=controlTypes.REASON_CHANGE)
speech.speakObjectProperties(self, states=True, reason=controlTypes.OutputReason.CHANGE)
braille.handler.handleUpdate(self)
vision.handler.handleUpdate(self, property="states")

Expand All @@ -1118,7 +1118,7 @@ def event_focusEntered(self):
speech.cancelSpeech()
return
if self.isPresentableFocusAncestor:
speech.speakObject(self,reason=controlTypes.REASON_FOCUSENTERED)
speech.speakObject(self, reason=controlTypes.OutputReason.FOCUSENTERED)

def event_gainFocus(self):
"""
Expand Down Expand Up @@ -1156,19 +1156,19 @@ def event_becomeNavigatorObject(self, isFocus=False):

def event_valueChange(self):
if self is api.getFocusObject():
speech.speakObjectProperties(self, value=True, reason=controlTypes.REASON_CHANGE)
speech.speakObjectProperties(self, value=True, reason=controlTypes.OutputReason.CHANGE)
braille.handler.handleUpdate(self)
vision.handler.handleUpdate(self, property="value")

def event_nameChange(self):
if self is api.getFocusObject():
speech.speakObjectProperties(self, name=True, reason=controlTypes.REASON_CHANGE)
speech.speakObjectProperties(self, name=True, reason=controlTypes.OutputReason.CHANGE)
braille.handler.handleUpdate(self)
vision.handler.handleUpdate(self, property="name")

def event_descriptionChange(self):
if self is api.getFocusObject():
speech.speakObjectProperties(self, description=True, reason=controlTypes.REASON_CHANGE)
speech.speakObjectProperties(self, description=True, reason=controlTypes.OutputReason.CHANGE)
braille.handler.handleUpdate(self)
vision.handler.handleUpdate(self, property="description")

Expand Down
6 changes: 3 additions & 3 deletions source/NVDAObjects/behaviors.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ def _moveToColumn(self, obj):
# Use the focused copy of the row as the parent for all cells to make comparison faster.
obj.parent = self
api.setNavigatorObject(obj)
speech.speakObject(obj, reason=controlTypes.REASON_FOCUS)
speech.speakObject(obj, reason=controlTypes.OutputReason.FOCUS)

def _moveToColumnNumber(self, column):
child = column - 1
Expand Down Expand Up @@ -732,7 +732,7 @@ class ToolTip(NVDAObject):
def event_show(self):
if not config.conf["presentation"]["reportTooltips"]:
return
speech.speakObject(self, reason=controlTypes.REASON_FOCUS)
speech.speakObject(self, reason=controlTypes.OutputReason.FOCUS)
# Ideally, we wouldn't use getPropertiesBraille directly.
braille.handler.message(braille.getPropertiesBraille(name=self.name, role=self.role))

Expand All @@ -745,7 +745,7 @@ class Notification(NVDAObject):
def event_alert(self):
if not config.conf["presentation"]["reportHelpBalloons"]:
return
speech.speakObject(self, reason=controlTypes.REASON_FOCUS)
speech.speakObject(self, reason=controlTypes.OutputReason.FOCUS)
# Ideally, we wouldn't use getPropertiesBraille directly.
braille.handler.message(braille.getPropertiesBraille(name=self.name, role=self.role))

Expand Down
6 changes: 3 additions & 3 deletions source/NVDAObjects/window/winword.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ def activate(self):
self.updateCaret()
tiCopy = self.copy()
tiCopy.expand(textInfos.UNIT_LINE)
speech.speakTextInfo(tiCopy,reason=controlTypes.REASON_FOCUS)
speech.speakTextInfo(tiCopy, reason=controlTypes.OutputReason.FOCUS)
braille.handler.handleCaretMove(self)
return

Expand Down Expand Up @@ -1413,15 +1413,15 @@ def reportTab(self):
info.expand(textInfos.UNIT_PARAGRAPH)
isCollapsed=info.isCollapsed
if not isCollapsed:
speech.speakTextInfo(info,reason=controlTypes.REASON_FOCUS)
speech.speakTextInfo(info, reason=controlTypes.OutputReason.FOCUS)
braille.handler.handleCaretMove(self)
if selectionObj and isCollapsed:
offset=selectionObj.information(wdHorizontalPositionRelativeToPage)
msg=self.getLocalizedMeasurementTextForPointSize(offset)
ui.message(msg)
if selectionObj.paragraphs[1].range.start==selectionObj.start:
info.expand(textInfos.UNIT_LINE)
speech.speakTextInfo(info,unit=textInfos.UNIT_LINE,reason=controlTypes.REASON_CARET)
speech.speakTextInfo(info, unit=textInfos.UNIT_LINE, reason=controlTypes.OutputReason.CARET)

def getLocalizedMeasurementTextForPointSize(self,offset):
options=self.WinwordApplicationObject.options
Expand Down
5 changes: 3 additions & 2 deletions source/appModules/kindle.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def event_pageChange(self, obj, nextHandler):
# Don't report anything if the book area isn't focused.
return
info.expand(textInfos.UNIT_LINE)
speech.speakTextInfo(info, unit=textInfos.UNIT_LINE, reason=controlTypes.REASON_CARET)
speech.speakTextInfo(info, unit=textInfos.UNIT_LINE, reason=OutputReason.CARET)

def isAlive(self):
return winUser.isWindow(self.rootNVDAObject.windowHandle)
Expand Down Expand Up @@ -100,7 +100,8 @@ def _changePageScriptHelper(self,gesture,previous=False):
info=self.makeTextInfo(textInfos.POSITION_FIRST)
self.selection=info
info.expand(textInfos.UNIT_LINE)
if not willSayAllResume(gesture): speech.speakTextInfo(info,unit=textInfos.UNIT_LINE,reason=controlTypes.REASON_CARET)
if not willSayAllResume(gesture):
speech.speakTextInfo(info, unit=textInfos.UNIT_LINE, reason=OutputReason.CARET)

def script_moveByPage_forward(self,gesture):
self._changePageScriptHelper(gesture)
Expand Down
2 changes: 1 addition & 1 deletion source/appModules/miranda32.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def script_changeItem(self,gesture):
gesture.send()
if not isScriptWaiting():
api.processPendingEvents()
speech.speakObject(self,reason=controlTypes.REASON_FOCUS)
speech.speakObject(self, reason=controlTypes.OutputReason.FOCUS)
braille.handler.handleGainFocus(self)

__changeItemGestures = (
Expand Down
2 changes: 1 addition & 1 deletion source/appModules/outlook.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ def script_tab(self,gesture):
info.expand(textInfos.UNIT_CELL)
isCollapsed=False
if not isCollapsed:
speech.speakTextInfo(info,reason=controlTypes.REASON_FOCUS)
speech.speakTextInfo(info, reason=controlTypes.OutputReason.FOCUS)
braille.handler.handleCaretMove(self)

__gestures={
Expand Down
2 changes: 1 addition & 1 deletion source/appModules/powerpnt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,7 @@ def event_treeInterceptor_gainFocus(self):
speech.speakPreselectedText(info.text)
else:
info.expand(textInfos.UNIT_LINE)
speech.speakTextInfo(info, reason=controlTypes.REASON_CARET, unit=textInfos.UNIT_LINE)
speech.speakTextInfo(info, reason=controlTypes.OutputReason.CARET, unit=textInfos.UNIT_LINE)

def event_gainFocus(self,obj,nextHandler):
pass
Expand Down
2 changes: 1 addition & 1 deletion source/appModules/winamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def script_changeItem(self,gesture):
gesture.send()
if not isScriptWaiting():
api.processPendingEvents()
speech.speakObject(self,reason=controlTypes.REASON_FOCUS)
speech.speakObject(self, reason=controlTypes.OutputReason.FOCUS)
braille.handler.handleGainFocus(self)

def event_nameChange(self):
Expand Down
10 changes: 9 additions & 1 deletion source/braille.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,15 @@ def getPropertiesBraille(**propertyValues) -> str: # noqa: C901
textList.append(value)
if states is not None:
textList.extend(
controlTypes.processAndLabelStates(role, states, controlTypes.REASON_FOCUS, states, None, positiveStateLabels, negativeStateLabels)
controlTypes.processAndLabelStates(
role,
states,
controlTypes.OutputReason.FOCUS,
states,
None,
positiveStateLabels,
negativeStateLabels
)
)
if roleText:
textList.append(roleText)
Expand Down
Loading