Skip to content

Commit cba51b3

Browse files
committed
Implemented reading of current row of number of rows.
1 parent 9056ad6 commit cba51b3

File tree

2 files changed

+44
-8
lines changed

2 files changed

+44
-8
lines changed

2023.2.1.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"addonId": "vismaAdministration",
3+
"displayName": "Visma Administration",
4+
"URL": "",
5+
"description": "Fixes accessibility issues in Visma Administration/Fakturering/forening.",
6+
"sha256": "7a91fb1824171851da9a1fec3185ea58205d66849df187bbf2a60ca809e65c7c",
7+
"homepage": null,
8+
"addonVersionName": "2023.2.1",
9+
"addonVersionNumber": {
10+
"major": 2023,
11+
"minor": 2,
12+
"patch": 1
13+
},
14+
"minNVDAVersion": {
15+
"major": 2021,
16+
"minor": 1,
17+
"patch": 0
18+
},
19+
"lastTestedVersion": {
20+
"major": 2023,
21+
"minor": 1,
22+
"patch": 0
23+
},
24+
"channel": "stable",
25+
"publisher": "",
26+
"sourceURL": "https://github.com/towebo/vismaadministration-nvdaaddon",
27+
"license": null,
28+
"licenseURL": null
29+
}

addon/appModules/vismaAdmin/__init__.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,7 @@ def event_gainFocus(self):
291291
if self.name != "Grid":
292292
ui.message(self.name)
293293
if config.conf['VismaAdministration']['sayNumGridRows']:
294-
ui.message("Listan har %d rader" % self._get_rowCount())
295-
#ui.message("Rad %d är markerad" % self._get_rowNumber())
294+
ui.message("Rad %d av %d markerad" % (self.GetCurrentRow() + 1, self._get_rowCount()))
296295
self.ReadGridSelection()
297296
except Exception as e:
298297
log.info("Fel i VismaSafGrid.gainFocus: %s" % e)
@@ -315,15 +314,13 @@ def event_UIA_AutomationFocusChanged(self, obj, nextHandler):
315314

316315
@script(
317316
# Translators: Gesture description
318-
description=_("Says the number of rows in the current list"),
317+
description=_("Says the current cell position and number of rows in the current list"),
319318
category=_("Visma Administration"),
320319
gesture="kb:NVDA+r"
321320
)
322321
def script_readNumGridRows(self, gesture):
323-
# Pass the keystroke along
324-
#gesture.send()
325-
ui.message("Listan har %d rader" % self._get_rowCount())
326-
#ui.message("Rad %d är markerad" % self._get_rowNumber())
322+
ui.message("Rad %d av %d markerad" % (self.GetCurrentRow() + 1, self._get_rowCount()))
323+
self.ReadGridSelection()
327324

328325
@script(
329326
# Translators: Gesture description
@@ -343,7 +340,6 @@ def ReadGridSelection(self):
343340
try:
344341
#gridpat = nav._getUIAPattern(UIAHandler.UIA_GridPatternId,UIAHandler.IUIAutomationGridPattern)
345342
#tablepat = nav._getUIAPattern(UIAHandler.UIA_TablePatternId,UIAHandler.IUIAutomationTablePattern)
346-
#tableitempat = nav._getUIAPattern(UIAHandler.UIA_TableItemPatternId,UIAHandler.IUIAutomationTableItemPattern)
347343
#selpat = nav._getUIAPattern(UIAHandler.UIA_SelectionPatternId,UIAHandler.IUIAutomationSelectionPattern)
348344
selpat = self._getUIAPattern(UIAHandler.UIA_SelectionPatternId,UIAHandler.IUIAutomationSelectionPattern)
349345

@@ -426,6 +422,17 @@ def ReadGridSelection(self):
426422

427423

428424

425+
def GetCurrentRow(self):
426+
try:
427+
selpat = self._getUIAPattern(UIAHandler.UIA_SelectionPatternId,UIAHandler.IUIAutomationSelectionPattern)
428+
cursel = selpat.GetCurrentSelection()
429+
selement = cursel.GetElement(0)
430+
return selement.GetCurrentPropertyValue(UIAHandler.UIA_GridItemRowPropertyId)
431+
except Exception as e:
432+
log.info("Fel i readGridSelection: %s"%e)
433+
ui.message("Fel i readGridSelection: %s"%e)
434+
return None
435+
429436

430437
class VismaAdministrationSettingsPanel(gui.SettingsPanel):
431438
# Translators: the label/title for the Visma Administration settings panel.

0 commit comments

Comments
 (0)