Skip to content

Commit cbede09

Browse files
authored
Merge f3d14c9 into 6de241b
2 parents 6de241b + f3d14c9 commit cbede09

5 files changed

Lines changed: 15 additions & 1 deletion

File tree

source/NVDAObjects/UIA/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1647,6 +1647,11 @@ def _get_states(self):
16471647
if s!=UIAHandler.handler.reservedNotSupportedValue:
16481648
if not role:
16491649
role=self.role
1650+
if s == UIAHandler.ToggleState_Indeterminate:
1651+
if role == controlTypes.Role.TOGGLEBUTTON:
1652+
states.add(controlTypes.State.HALFPRESSED)
1653+
else:
1654+
states.add(controlTypes.State.HALFCHECKED)
16501655
if role==controlTypes.Role.TOGGLEBUTTON:
16511656
if s==UIAHandler.ToggleState_On:
16521657
states.add(controlTypes.State.PRESSED)

source/braille.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,8 @@
202202
controlTypes.State.SELECTED: _("sel"),
203203
# Displayed in braille when an object (e.g. a toggle button) is pressed.
204204
controlTypes.State.PRESSED: u"⢎⣿⡱",
205+
# Displayed in braille when an object (e.g. a toggle button) is half pressed.
206+
controlTypes.State.HALFPRESSED: u"⢎⣸⡱",
205207
# Displayed in braille when an object (e.g. a check box) is checked.
206208
controlTypes.State.CHECKED: u"⣏⣿⣹",
207209
# Displayed in braille when an object (e.g. a check box) is half checked.

source/controlTypes/deprecatedAliases.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@
199199
STATE_PRESSED = State.PRESSED
200200
STATE_CHECKED = State.CHECKED
201201
STATE_HALFCHECKED = State.HALFCHECKED
202+
STATE_HALFPRESSED = State.HALFPRESSED
202203
STATE_READONLY = State.READONLY
203204
STATE_EXPANDED = State.EXPANDED
204205
STATE_COLLAPSED = State.COLLAPSED

source/controlTypes/processAndLabelStates.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def _processNegativeStates(
126126
and (reason != OutputReason.CHANGE or State.FOCUSED in states)
127127
):
128128
speakNegatives.add(State.CHECKED)
129-
if role == Role.TOGGLEBUTTON:
129+
if role == Role.TOGGLEBUTTON and State.HALFPRESSED not in states:
130130
speakNegatives.add(State.PRESSED)
131131
if reason == OutputReason.CHANGE:
132132
# We want to speak this state only if it is changing to negative.
@@ -138,6 +138,9 @@ def _processNegativeStates(
138138
# #6946: if HALFCHECKED is present but CHECKED isn't, we should make sure we add CHECKED to speakNegatives.
139139
if (State.HALFCHECKED in negativeStates and State.CHECKED not in states):
140140
speakNegatives.add(State.CHECKED)
141+
if State.HALFPRESSED in negativeStates and State.PRESSED not in states:
142+
speakNegatives.add(State.PRESSED)
143+
141144
if STATES_SORTED & negativeStates and not STATES_SORTED & states:
142145
# If the object has just stopped being sorted, just report not sorted.
143146
# The user doesn't care how it was sorted before.

source/controlTypes/state.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ def negativeDisplayString(self) -> str:
9696
# indeterminate progress bar, aka busy indicator. No specific state label.
9797
# when combined with role of 'progress bar', role is mutated to 'busy indicator'
9898
INDETERMINATE = setBit(44)
99+
HALFPRESSED = setBit(45)
99100

100101

101102
STATES_SORTED = frozenset([State.SORTED, State.SORTED_ASCENDING, State.SORTED_DESCENDING])
@@ -116,6 +117,8 @@ def negativeDisplayString(self) -> str:
116117
State.CHECKED: _("checked"),
117118
# Translators: This is presented when a three state check box is half checked.
118119
State.HALFCHECKED: _("half checked"),
120+
# Translators: This is presented when a three state toggle button is half pressed.
121+
State.HALFPRESSED: _("half pressed"),
119122
# Translators: This is presented when the control is a read-only control such as read-only edit box.
120123
State.READONLY: _("read only"),
121124
# Translators: This is presented when a tree view or submenu item is expanded.

0 commit comments

Comments
 (0)