Skip to content

Commit 8b9d9a5

Browse files
authored
Merge a76b5b6 into 5c4e6e1
2 parents 5c4e6e1 + a76b5b6 commit 8b9d9a5

4 files changed

Lines changed: 40 additions & 26 deletions

File tree

source/_addonStore/models/status.py

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# A part of NonVisual Desktop Access (NVDA)
2-
# Copyright (C) 2022-2023 NV Access Limited
2+
# Copyright (C) 2022-2023 NV Access Limited, Cyrille Bougot
33
# This file is covered by the GNU General Public License.
44
# See the file COPYING for more details.
55

@@ -245,17 +245,38 @@ class _StatusFilterKey(DisplayStringEnum):
245245

246246
@property
247247
def _displayStringLabels(self) -> Dict["_StatusFilterKey", str]:
248+
return {k: v.replace('&', '') for (k, v) in self._displayStringLabelsWithAccelerators.items()}
249+
250+
@property
251+
def _displayStringLabelsWithAccelerators(self) -> Dict["_StatusFilterKey", str]:
248252
return {
249-
# Translators: A selection option to display installed add-ons in the add-on store
250-
self.INSTALLED: pgettext("addonStore", "Installed add-ons"),
251-
# Translators: A selection option to display updatable add-ons in the add-on store
252-
self.UPDATE: pgettext("addonStore", "Updatable add-ons"),
253-
# Translators: A selection option to display available add-ons in the add-on store
254-
self.AVAILABLE: pgettext("addonStore", "Available add-ons"),
255-
# Translators: A selection option to display incompatible add-ons in the add-on store
256-
self.INCOMPATIBLE: pgettext("addonStore", "Installed incompatible add-ons"),
253+
# Translators: The label of a tab to display installed add-ons in the add-on store and the label of the
254+
# add-ons list in the corresponding panel (preferably use the same accelerator key for the four labels)
255+
self.INSTALLED: pgettext("addonStore", "Installed &add-ons"),
256+
# Translators: The label of a tab to display updatable add-ons in the add-on store and the label of the
257+
# add-ons list in the corresponding panel (preferably use the same accelerator key for the four labels)
258+
self.UPDATE: pgettext("addonStore", "Updatable &add-ons"),
259+
# Translators: The label of a tab to display available add-ons in the add-on store and the label of the
260+
# add-ons list in the corresponding panel (preferably use the same accelerator key for the four labels)
261+
self.AVAILABLE: pgettext("addonStore", "Available &add-ons"),
262+
# Translators: The label of a tab to display incompatible add-ons in the add-on store and the label of the
263+
# add-ons list in the corresponding panel (preferably use the same accelerator key for the four labels)
264+
self.INCOMPATIBLE: pgettext("addonStore", "Installed incompatible &add-ons"),
257265
}
258266

267+
@property
268+
def displayStringWithAccelerator(self) -> str:
269+
"""
270+
@return: The translated UI display string with accelerator that should be used for this value of the enum.
271+
"""
272+
try:
273+
return self._displayStringLabelsWithAccelerators[self]
274+
except KeyError as e:
275+
log.error(f"No translation mapping for: {self}")
276+
raise e
277+
278+
279+
259280

260281
_statusFilters: OrderedDict[_StatusFilterKey, Set[AvailableAddonStatus]] = OrderedDict({
261282
_StatusFilterKey.INSTALLED: {

source/gui/_addonStoreGui/controls/details.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# A part of NonVisual Desktop Access (NVDA)
2-
# Copyright (C) 2022-2023 NV Access Limited
2+
# Copyright (C) 2022-2023 NV Access Limited, Cyrille Bougot
33
# This file is covered by the GNU General Public License.
44
# See the file COPYING for more details.
55

@@ -42,7 +42,7 @@ class AddonDetails(
4242

4343
# Translators: Label for the text control containing a description of the selected add-on.
4444
# In the add-on store dialog.
45-
_actionsLabelText: str = pgettext("addonStore", "&Actions")
45+
_actionsLabelText: str = pgettext("addonStore", "A&ctions")
4646

4747
def __init__(
4848
self,
@@ -126,17 +126,13 @@ def __init__(
126126
self.contents.Add(wx.StaticLine(self.contentsPanel), flag=wx.EXPAND)
127127
self.contents.AddSpacer(guiHelper.SPACE_BETWEEN_VERTICAL_DIALOG_ITEMS)
128128

129-
# It would be nice to override the name using wx.Accessible,
130-
# but using it on a TextCtrl breaks the accessibility of the control entirely (all state/role is reset)
131-
# Instead, add a hidden label for the textBox, Windows exposes this as the accessible name.
132129
self.otherDetailsLabel = wx.StaticText(
133130
self.contentsPanel,
134131
# Translators: Label for the text control containing extra details about the selected add-on.
135132
# In the add-on store dialog.
136133
label=pgettext("addonStore", "&Other Details:")
137134
)
138135
self.contents.Add(self.otherDetailsLabel, flag=wx.EXPAND)
139-
self.otherDetailsLabel.Hide()
140136
self.otherDetailsTextCtrl = wx.TextCtrl(
141137
self.contentsPanel,
142138
size=self.scaleSize((panelWidth, 400)),

source/gui/_addonStoreGui/controls/storeDialog.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,11 @@ def makeSettings(self, settingsSizer: wx.BoxSizer):
9797

9898
settingsSizer.Add(splitViewSizer, flag=wx.EXPAND, proportion=1)
9999

100-
# add a label for the AddonListVM so that it is announced with a name in NVDA
101100
self.listLabel = wx.StaticText(self)
102101
tabPageHelper.addItem(
103102
self.listLabel,
104103
flag=wx.EXPAND
105104
)
106-
self.listLabel.Hide()
107105
self._setListLabels()
108106

109107
self.addonListView = AddonVirtualList(
@@ -112,12 +110,6 @@ def makeSettings(self, settingsSizer: wx.BoxSizer):
112110
actionsContextMenu=self._actionsContextMenu,
113111
)
114112
self.bindHelpEvent("AddonStoreBrowsing", self.addonListView)
115-
# Add alt+l accelerator key
116-
_setFocusToAddonListView_eventId = wx.NewIdRef(count=1)
117-
self.Bind(wx.EVT_MENU, lambda e: self.addonListView.SetFocus(), _setFocusToAddonListView_eventId)
118-
self.SetAcceleratorTable(wx.AcceleratorTable([
119-
wx.AcceleratorEntry(wx.ACCEL_ALT, ord("l"), _setFocusToAddonListView_eventId)
120-
]))
121113
tabPageHelper.addItem(self.addonListView, flag=wx.EXPAND, proportion=1)
122114
splitViewSizer.AddSpacer(5)
123115

@@ -281,10 +273,15 @@ def _titleText(self) -> str:
281273

282274
@property
283275
def _listLabelText(self) -> str:
284-
return f"{self._statusFilterKey.displayString}"
276+
return pgettext(
277+
"addonStore",
278+
# Translators: The label of the add-on list in the add-on store; {category} is replaced by the selected
279+
# tab's name.
280+
"{category}:",
281+
).format(category=self._statusFilterKey.displayStringWithAccelerator)
285282

286283
def _setListLabels(self):
287-
self.listLabel.SetLabelText(self._listLabelText)
284+
self.listLabel.SetLabel(self._listLabelText)
288285
self.SetTitle(self._titleText)
289286

290287
def _toggleFilterControls(self):

user_docs/en/userGuide.t2t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2591,7 +2591,7 @@ To access the Add-on Store from anywhere, assign a custom gesture using the [Inp
25912591

25922592
++ Browsing add-ons ++[AddonStoreBrowsing]
25932593
When opened, the Add-on Store displays a list of add-ons.
2594-
You can jump back to the list with ``alt+l`` from anywhere else within the store.
2594+
You can jump back to the add-ons list with ``alt+a`` from anywhere else within the store.
25952595
If you have not installed an add-on before, the add-on store will open to a list of add-ons available to install.
25962596
If you have installed add-ons, the list will display currently installed add-ons.
25972597

0 commit comments

Comments
 (0)