File tree Expand file tree Collapse file tree 11 files changed +49
-3
lines changed Expand file tree Collapse file tree 11 files changed +49
-3
lines changed Original file line number Diff line number Diff line change 228
228
oleacc .STATE_SYSTEM_PROTECTED : controlTypes .State .PROTECTED ,
229
229
oleacc .STATE_SYSTEM_SELECTABLE : controlTypes .State .SELECTABLE ,
230
230
oleacc .STATE_SYSTEM_FOCUSABLE : controlTypes .State .FOCUSABLE ,
231
+ oleacc .STATE_SYSTEM_MULTISELECTABLE : controlTypes .State .MULTISELECTABLE ,
231
232
}
232
233
233
234
IAccessible2StatesToNVDAStates = {
Original file line number Diff line number Diff line change @@ -1080,15 +1080,15 @@ def _get_IAccessibleStates(self) -> int:
1080
1080
return 0
1081
1081
return res if isinstance (res , int ) else 0
1082
1082
1083
- states : typing . Set [controlTypes .State ]
1083
+ states : set [controlTypes .State ]
1084
1084
"""Type info for auto property: _get_states
1085
1085
"""
1086
1086
1087
1087
# C901 '_get_states' is too complex. Look for opportunities to break this method down.
1088
- def _get_states (self ) -> typing . Set [controlTypes .State ]: # noqa: C901
1088
+ def _get_states (self ) -> set [controlTypes .State ]: # noqa: C901
1089
1089
states = set ()
1090
1090
if self .event_objectID in (winUser .OBJID_CLIENT , winUser .OBJID_WINDOW ) and self .event_childID == 0 :
1091
- states .update (super (IAccessible , self ).states )
1091
+ states .update (super ().states )
1092
1092
try :
1093
1093
IAccessibleStates = self .IAccessibleStates
1094
1094
except COMError :
@@ -2434,6 +2434,12 @@ class List(IAccessible):
2434
2434
def _get_role (self ):
2435
2435
return controlTypes .Role .LIST
2436
2436
2437
+ def _get_states (self ) -> set [controlTypes .State ]:
2438
+ states = super ().states
2439
+ if self .windowStyle & winUser .LBS_EXTENDEDSEL :
2440
+ states .add (controlTypes .State .MULTISELECTABLE )
2441
+ return states
2442
+
2437
2443
2438
2444
class SysLinkClient (IAccessible ):
2439
2445
def reportFocus (self ):
Original file line number Diff line number Diff line change @@ -1891,6 +1891,7 @@ def _get_keyboardShortcut(self):
1891
1891
1892
1892
_UIAStatesPropertyIDs = {
1893
1893
UIAHandler .UIA_HasKeyboardFocusPropertyId ,
1894
+ UIAHandler .UIA .UIA_SelectionCanSelectMultiplePropertyId ,
1894
1895
UIAHandler .UIA_SelectionItemIsSelectedPropertyId ,
1895
1896
UIAHandler .UIA_IsDataValidForFormPropertyId ,
1896
1897
UIAHandler .UIA_IsRequiredForFormPropertyId ,
@@ -1934,6 +1935,8 @@ def _get_states(self):
1934
1935
if role == controlTypes .Role .RADIOBUTTON
1935
1936
else controlTypes .State .SELECTED ,
1936
1937
)
1938
+ if self ._getUIACacheablePropertyValue (UIAHandler .UIA .UIA_SelectionCanSelectMultiplePropertyId ):
1939
+ states .add (controlTypes .State .MULTISELECTABLE )
1937
1940
if not self ._getUIACacheablePropertyValue (UIAHandler .UIA_IsEnabledPropertyId , True ):
1938
1941
states .add (controlTypes .State .UNAVAILABLE )
1939
1942
try :
Original file line number Diff line number Diff line change 279
279
controlTypes .State .ON : "⣏⣿⣹" ,
280
280
# Translators: Displayed in braille when a link destination points to the same page
281
281
controlTypes .State .INTERNAL_LINK : _ ("smp" ),
282
+ # Translators: Displayed in braille when an object supports multiple selected items.
283
+ controlTypes .State .MULTISELECTABLE : _ ("msel" ),
282
284
}
283
285
negativeStateLabels = {
284
286
# Translators: Displayed in braille when an object is not selected.
@@ -706,6 +708,11 @@ def getPropertiesBraille(**propertyValues) -> str: # noqa: C901
706
708
states .discard (controlTypes .State .VISITED )
707
709
# Translators: Displayed in braille for a link which has been visited.
708
710
roleText = _ ("vlnk" )
711
+ elif role == controlTypes .Role .LIST and states and controlTypes .State .MULTISELECTABLE in states :
712
+ states = states .copy ()
713
+ states .discard (controlTypes .State .MULTISELECTABLE )
714
+ # Translators: Displayed in braille for a multi select list.
715
+ roleText = _ ("mslst" )
709
716
elif (
710
717
name or cellCoordsText or rowNumber or columnNumber
711
718
) and role in controlTypes .silentRolesOnFocus :
Original file line number Diff line number Diff line change 116
116
reportKeyboardShortcuts = boolean(default=true)
117
117
reportObjectPositionInformation = boolean(default=true)
118
118
guessObjectPositionInformationWhenUnavailable = boolean(default=false)
119
+ reportMultiSelect = boolean(default=false)
119
120
reportTooltips = boolean(default=false)
120
121
reportHelpBalloons = boolean(default=true)
121
122
reportObjectDescriptions = boolean(default=True)
Original file line number Diff line number Diff line change @@ -73,6 +73,9 @@ def _processPositiveStates(
73
73
and State .SELECTABLE in states
74
74
):
75
75
positiveStates .discard (State .SELECTED )
76
+ positiveStates .discard (State .MULTISELECTABLE )
77
+ elif not config .conf ["presentation" ]["reportMultiSelect" ]:
78
+ positiveStates .discard (State .MULTISELECTABLE )
76
79
if role not in (Role .EDITABLETEXT , Role .CHECKBOX ):
77
80
positiveStates .discard (State .READONLY )
78
81
if role == Role .CHECKBOX :
Original file line number Diff line number Diff line change @@ -103,6 +103,7 @@ def negativeDisplayString(self) -> str:
103
103
HASPOPUP_LIST = setBit (49 )
104
104
HASPOPUP_TREE = setBit (50 )
105
105
INTERNAL_LINK = setBit (51 )
106
+ MULTISELECTABLE = setBit (52 )
106
107
107
108
108
109
STATES_SORTED = frozenset ([State .SORTED , State .SORTED_ASCENDING , State .SORTED_DESCENDING ])
@@ -210,6 +211,9 @@ def negativeDisplayString(self) -> str:
210
211
# Translators: Presented when a link destination points to the page containing the link.
211
212
# For example, links of a table of contents of a document with different sections.
212
213
State .INTERNAL_LINK : _ ("same page" ),
214
+ # Translators: Presented when the control allows multiple selected objects.
215
+ # For example, a list box that allows selecting multiple items.
216
+ State .MULTISELECTABLE : _ ("multi-select" ),
213
217
}
214
218
215
219
Original file line number Diff line number Diff line change @@ -2478,6 +2478,15 @@ def makeSettings(self, settingsSizer):
2478
2478
config .conf ["presentation" ]["guessObjectPositionInformationWhenUnavailable" ],
2479
2479
)
2480
2480
2481
+ # Translators: This is the label for a checkbox in the
2482
+ # object presentation settings panel.
2483
+ reportMultiSelectText = _ ("Report when lists support &multiple selection" )
2484
+ self .reportMultiSelectCheckBox = sHelper .addItem (wx .CheckBox (self , label = reportMultiSelectText ))
2485
+ self .bindHelpEvent ("ReportMultiSelect" , self .reportMultiSelectCheckBox )
2486
+ self .reportMultiSelectCheckBox .SetValue (
2487
+ config .conf ["presentation" ]["reportMultiSelect" ],
2488
+ )
2489
+
2481
2490
# Translators: This is the label for a checkbox in the
2482
2491
# object presentation settings panel.
2483
2492
descriptionText = _ ("Report object &descriptions" )
@@ -2542,6 +2551,7 @@ def onSave(self):
2542
2551
config .conf ["presentation" ]["guessObjectPositionInformationWhenUnavailable" ] = (
2543
2552
self .guessPositionInfoCheckBox .IsChecked ()
2544
2553
)
2554
+ config .conf ["presentation" ]["reportMultiSelect" ] = self .reportMultiSelectCheckBox .IsChecked ()
2545
2555
config .conf ["presentation" ]["reportObjectDescriptions" ] = self .descriptionCheckBox .IsChecked ()
2546
2556
config .conf ["presentation" ]["progressBarUpdates" ]["progressBarOutputMode" ] = self .progressLabels [
2547
2557
self .progressList .GetSelection ()
Original file line number Diff line number Diff line change @@ -154,6 +154,7 @@ class GUITHREADINFO(Structure):
154
154
LBS_OWNERDRAWFIXED = 0x0010
155
155
LBS_OWNERDRAWVARIABLE = 0x0020
156
156
LBS_HASSTRINGS = 0x0040
157
+ LBS_EXTENDEDSEL = 0x0800
157
158
CBS_OWNERDRAWFIXED = 0x0010
158
159
CBS_OWNERDRAWVARIABLE = 0x0020
159
160
CBS_HASSTRINGS = 0x00200
Original file line number Diff line number Diff line change @@ -11,6 +11,9 @@ Windows 10 is the minimum Windows version supported.
11
11
12
12
### New Features
13
13
14
+ * Added the possibility to report when multiple items can be selected in a list control.
15
+ This can be enabled using the "Report when lists support multiple selection" setting in NVDA's object presentation settings. (#18365 @LeonarddeR)
16
+
14
17
### Changes
15
18
16
19
* Added a button to the About dialog to copy the NVDA version number to the clipboard. (#18667)
You can’t perform that action at this time.
0 commit comments