Skip to content

Commit 65640b9

Browse files
authored
Merge 2ef2ebe into 57f468f
2 parents 57f468f + 2ef2ebe commit 65640b9

8 files changed

Lines changed: 86 additions & 31 deletions

File tree

source/NVDAObjects/IAccessible/winword.py

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import NVDAObjects.window.winword as winWordWindowModule
2727
from speech import sayAll
2828
import inputCore
29-
29+
from globalCommands import SCRCAT_SYSTEMCARET
3030

3131
class WordDocument(IAccessible, EditableTextWithoutAutoSelectDetection, winWordWindowModule.WordDocument):
3232

@@ -212,6 +212,12 @@ def fetchAssociatedHeaderCellText(self,cell,columnHeader=False):
212212
if text:
213213
return text
214214

215+
@script(
216+
gesture="kb:NVDA+shift+c",
217+
# Translators: The label of a shortcut of NVDA.
218+
description=_("Set column header"),
219+
category=SCRCAT_SYSTEMCARET
220+
)
215221
def script_setColumnHeader(self,gesture):
216222
scriptCount=scriptHandler.getLastScriptRepeatCount()
217223
try:
@@ -234,8 +240,13 @@ def script_setColumnHeader(self,gesture):
234240
else:
235241
# Translators: a message reported in the SetColumnHeader script for Microsoft Word.
236242
ui.message(_("Cannot find row {rowNumber} column {columnNumber} in column headers").format(rowNumber=cell.rowIndex,columnNumber=cell.columnIndex))
237-
script_setColumnHeader.__doc__=_("Pressing once will set this cell as the first column header for any cells lower and to the right of it within this table. Pressing twice will forget the current column header for this cell.")
238243

244+
@script(
245+
gesture="kb:NVDA+shift+r",
246+
# Translators: The label of a shortcut of NVDA.
247+
description=_("Set row header."),
248+
category=SCRCAT_SYSTEMCARET
249+
)
239250
def script_setRowHeader(self,gesture):
240251
scriptCount=scriptHandler.getLastScriptRepeatCount()
241252
try:
@@ -258,14 +269,24 @@ def script_setRowHeader(self,gesture):
258269
else:
259270
# Translators: a message reported in the SetRowHeader script for Microsoft Word.
260271
ui.message(_("Cannot find row {rowNumber} column {columnNumber} in row headers").format(rowNumber=cell.rowIndex,columnNumber=cell.columnIndex))
261-
script_setRowHeader.__doc__=_("Pressing once will set this cell as the first row header for any cells lower and to the right of it within this table. Pressing twice will forget the current row header for this cell.")
262272

273+
@script(
274+
gesture="kb:NVDA+shift+h",
275+
)
263276
def script_reportCurrentHeaders(self,gesture):
264277
cell=self.WinwordSelectionObject.cells[1]
265278
rowText=self.fetchAssociatedHeaderCellText(cell,False)
266279
columnText=self.fetchAssociatedHeaderCellText(cell,True)
267280
ui.message("Row %s, column %s"%(rowText or "empty",columnText or "empty"))
268281

282+
@script(
283+
gestures=(
284+
"kb:alt+home",
285+
"kb:alt+end",
286+
"kb:alt+pageUp",
287+
"kb:alt+pageDown"
288+
)
289+
)
269290
def script_caret_moveByCell(self, gesture: inputCore.InputGesture) -> None:
270291
info = self.makeTextInfo(textInfos.POSITION_SELECTION)
271292
inTable = info._rangeObj.tables.count > 0
@@ -301,6 +322,7 @@ def script_caret_moveByCell(self, gesture: inputCore.InputGesture) -> None:
301322
# Translators: a description for a script
302323
description=_("Reports the text of the comment where the system caret is located."),
303324
gesture="kb:NVDA+alt+c",
325+
category=SCRCAT_SYSTEMCARET,
304326
speakOnDemand=True,
305327
)
306328
def script_reportCurrentComment(self,gesture):
@@ -375,33 +397,51 @@ def _moveInTable(self,row=True,forward=True):
375397
newInfo.updateCaret()
376398
return True
377399

400+
@script(
401+
gesture="kb:control+alt+downArrow"
402+
)
378403
def script_nextRow(self,gesture):
379404
self._moveInTable(row=True,forward=True)
380405

406+
@script(
407+
gesture="kb:control+alt+upArrow"
408+
)
381409
def script_previousRow(self,gesture):
382410
self._moveInTable(row=True,forward=False)
383411

412+
@script(
413+
gesture="kb:control+alt+rightArrow"
414+
)
384415
def script_nextColumn(self,gesture):
385416
self._moveInTable(row=False,forward=True)
386417

418+
@script(
419+
gesture="kb:control+alt+leftArrow"
420+
)
387421
def script_previousColumn(self,gesture):
388422
self._moveInTable(row=False,forward=False)
389423

424+
@script(
425+
gesture="kb:control+downArrow",
426+
resumeSayAllMode=sayAll.CURSOR.CARET
427+
)
390428
def script_nextParagraph(self,gesture):
391429
info=self.makeTextInfo(textInfos.POSITION_CARET)
392430
# #4375: can't use self.move here as it may check document.chracters.count which can take for ever on large documents.
393431
info._rangeObj.move(winWordWindowModule.wdParagraph, 1)
394432
info.updateCaret()
395433
self._caretScriptPostMovedHelper(textInfos.UNIT_PARAGRAPH,gesture,None)
396-
script_nextParagraph.resumeSayAllMode = sayAll.CURSOR.CARET
397434

435+
@script(
436+
gesture="kb:control+upArrow",
437+
resumeSayAllMode=sayAll.CURSOR.CARET
438+
)
398439
def script_previousParagraph(self,gesture):
399440
info=self.makeTextInfo(textInfos.POSITION_CARET)
400441
# #4375: keeping symmetrical with nextParagraph script.
401442
info._rangeObj.move(winWordWindowModule.wdParagraph, -1)
402443
info.updateCaret()
403444
self._caretScriptPostMovedHelper(textInfos.UNIT_PARAGRAPH,gesture,None)
404-
script_previousParagraph.resumeSayAllMode = sayAll.CURSOR.CARET
405445

406446
@script(
407447
gestures=(
@@ -435,23 +475,6 @@ def focusOnActiveDocument(self, officeChartObject):
435475
import api
436476
eventHandler.executeEvent("gainFocus", api.getDesktopObject().objectWithFocus())
437477

438-
__gestures={
439-
"kb:NVDA+shift+c":"setColumnHeader",
440-
"kb:NVDA+shift+r":"setRowHeader",
441-
"kb:NVDA+shift+h":"reportCurrentHeaders",
442-
"kb:control+alt+upArrow": "previousRow",
443-
"kb:control+alt+downArrow": "nextRow",
444-
"kb:control+alt+leftArrow": "previousColumn",
445-
"kb:control+alt+rightArrow": "nextColumn",
446-
"kb:control+downArrow":"nextParagraph",
447-
"kb:control+upArrow":"previousParagraph",
448-
"kb:alt+home":"caret_moveByCell",
449-
"kb:alt+end":"caret_moveByCell",
450-
"kb:alt+pageUp":"caret_moveByCell",
451-
"kb:alt+pageDown":"caret_moveByCell",
452-
}
453-
454-
455478
class SpellCheckErrorField(IAccessible, winWordWindowModule.WordDocument_WwN):
456479

457480
parentSDMCanOverrideName=False

source/NVDAObjects/UIA/wordDocument.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,10 @@
3737
from NVDAObjects import NVDAObject
3838
from scriptHandler import script
3939
import eventHandler
40-
40+
from globalCommands import SCRCAT_SYSTEMCARET
4141

4242
"""Support for Microsoft Word via UI Automation."""
4343

44-
4544
class UIACustomAttributeID(enum.IntEnum):
4645
LINE_NUMBER = 0
4746
PAGE_NUMBER = 1
@@ -601,6 +600,7 @@ def _caretMoveBySentenceHelper(self, gesture, direction):
601600
gesture="kb:NVDA+alt+c",
602601
# Translators: a description for a script that reports the comment at the caret.
603602
description=_("Reports the text of the comment where the system caret is located."),
603+
category=SCRCAT_SYSTEMCARET,
604604
speakOnDemand=True,
605605
)
606606
def script_reportCurrentComment(self,gesture):

source/NVDAObjects/window/excel.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
import vision
5353
from utils.displayString import DisplayStringIntEnum
5454
import NVDAState
55+
from globalCommands import SCRCAT_SYSTEMCARET
5556

5657
excel2010VersionMajor=14
5758

@@ -1438,7 +1439,9 @@ def _get_rowHeaderText(self):
14381439
@script(
14391440
# Translators: the description for a script for Excel
14401441
description=_("opens a dropdown item at the current cell"),
1441-
gesture="kb:alt+downArrow")
1442+
gesture="kb:alt+downArrow",
1443+
category=SCRCAT_SYSTEMCARET
1444+
)
14421445
def script_openDropdown(self,gesture):
14431446
gesture.send()
14441447
d=None
@@ -1464,7 +1467,9 @@ def script_openDropdown(self,gesture):
14641467
@script(
14651468
# Translators: the description for a script for Excel
14661469
description=_("Sets the current cell as start of column header"),
1467-
gesture="kb:NVDA+shift+c")
1470+
gesture="kb:NVDA+shift+c",
1471+
category=SCRCAT_SYSTEMCARET
1472+
)
14681473
def script_setColumnHeader(self,gesture):
14691474
scriptCount=scriptHandler.getLastScriptRepeatCount()
14701475
if scriptCount==0:
@@ -1486,7 +1491,9 @@ def script_setColumnHeader(self,gesture):
14861491
@script(
14871492
# Translators: the description for a script for Excel
14881493
description=_("sets the current cell as start of row header"),
1489-
gesture="kb:NVDA+shift+r")
1494+
gesture="kb:NVDA+shift+r",
1495+
category=SCRCAT_SYSTEMCARET
1496+
)
14901497
def script_setRowHeader(self,gesture):
14911498
scriptCount=scriptHandler.getLastScriptRepeatCount()
14921499
if scriptCount==0:
@@ -1672,6 +1679,7 @@ def _get_positionInfo(self):
16721679
# Translators: the description for a script for Excel
16731680
description=_("Reports the note on the current cell"),
16741681
gesture="kb:NVDA+alt+c",
1682+
category=SCRCAT_SYSTEMCARET,
16751683
speakOnDemand=True,
16761684
)
16771685
def script_reportComment(self,gesture):
@@ -1686,7 +1694,9 @@ def script_reportComment(self,gesture):
16861694
@script(
16871695
# Translators: the description for a script for Excel
16881696
description=_("Opens the note editing dialog"),
1689-
gesture="kb:shift+f2")
1697+
gesture="kb:shift+f2",
1698+
category=SCRCAT_SYSTEMCARET
1699+
)
16901700
def script_editComment(self,gesture):
16911701
commentObj=self.excelCellObject.comment
16921702
d = EditCommentDialog(

source/appModules/eclipse.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
import keyboardHandler
1616
from scriptHandler import script
1717

18+
# Translators: The name of a category of NVDA commands.
19+
SCRCAT_ECLIPSE = _("Eclipse")
20+
1821
class EclipseTextArea(EditableTextWithSuggestions, IAccessible):
1922

2023
def event_suggestionsClosed(self):
@@ -51,8 +54,9 @@ def script_closeAutocompleter(self, gesture):
5154

5255
@script(
5356
# Translators: Input help mode message for the 'read documentation script
54-
description = _("Tries to read documentation for the selected autocompletion item."),
55-
gesture = "kb:nvda+d"
57+
description=_("Tries to read documentation for the selected autocompletion item."),
58+
gesture="kb:nvda+d",
59+
category=SCRCAT_ECLIPSE
5660
)
5761
def script_readDocumentation(self, gesture):
5862
rootDocumentationWindow = None

source/appModules/miranda32.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
from keyboardHandler import KeyboardInputGesture
2323
import watchdog
2424

25+
# Translators: The name of a category of NVDA commands.
26+
SCRCAT_MIRANDA = _("Miranda NG")
27+
2528
#contact list window messages
2629
CLM_FIRST=0x1000 #this is the same as LVM_FIRST
2730
CLM_LAST=0x1100
@@ -113,6 +116,7 @@ def event_NVDAObject_init(self,obj):
113116
# Translators: The description of an NVDA command to view one of the recent messages.
114117
description=_("Displays one of the recent messages"),
115118
gestures=[f"kb:NVDA+control+{n}" for n in range(1, MessageHistoryLength + 1)],
119+
category=SCRCAT_MIRANDA,
116120
speakOnDemand=True,
117121
)
118122
def script_readMessage(self,gesture):

source/appModules/poedit.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
LEFT_TO_RIGHT_EMBEDDING = "\u202a"
2424
"""Character often found in translator comments."""
2525

26+
# Translators: The name of a category of NVDA commands.
27+
SCRCAT_POEDIT = _("Poedit")
2628

2729
class _WindowControlIdOffset(IntEnum):
2830
"""Window control ID's are not static, however, the order of ids stays the same.
@@ -146,6 +148,7 @@ def _reportControlScriptHelper(self, obj: Window, description: str):
146148
"Reports any notes for translators. If pressed twice, presents the notes in browse mode",
147149
),
148150
gesture="kb:control+shift+a",
151+
category=SCRCAT_POEDIT,
149152
speakOnDemand=True,
150153
)
151154
def script_reportAutoCommentsWindow(self, gesture):
@@ -172,6 +175,7 @@ def _get__commentObj(self) -> Window | None:
172175
"If pressed twice, presents the comment in browse mode",
173176
),
174177
gesture="kb:control+shift+c",
178+
category=SCRCAT_POEDIT,
175179
speakOnDemand=True,
176180
)
177181
def script_reportCommentsWindow(self, gesture):
@@ -197,6 +201,7 @@ def _get__oldSourceTextObj(self) -> Window | None:
197201
"Reports the old source text, if any. If pressed twice, presents the text in browse mode",
198202
),
199203
gesture="kb:control+shift+o",
204+
category=SCRCAT_POEDIT,
200205
speakOnDemand=True,
201206
)
202207
def script_reportOldSourceText(self, gesture):
@@ -220,6 +225,7 @@ def _get__translationWarningObj(self) -> Window | None:
220225
"Reports a translation warning, if any. If pressed twice, presents the warning in browse mode",
221226
),
222227
gesture="kb:control+shift+w",
228+
category=SCRCAT_POEDIT,
223229
speakOnDemand=True,
224230
)
225231
def script_reportTranslationWarning(self, gesture):

source/appModules/powerpnt.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
from locationHelper import RectLTRB
4242
from NVDAObjects.window._msOfficeChart import OfficeChart
4343

44+
# Translators: The name of a category of NVDA commands.
45+
SCRCAT_POWERPOINT = _("PowerPoint")
46+
4447
# Window classes where PowerPoint's object model should be used
4548
# These also all request to have their (incomplete) UI Automation implementations disabled. [MS Office 2013]
4649
objectModelWindowClasses=set(["paneClassDC","mdiClass","screenClass"])
@@ -1314,7 +1317,8 @@ def handleSlideChange(self):
13141317
self.treeInterceptor.reportNewSlide()
13151318

13161319
class AppModule(appModuleHandler.AppModule):
1317-
1320+
scriptCategory = SCRCAT_POWERPOINT
1321+
13181322
hasTriedPpAppSwitch=False
13191323
_ppApplicationWindow=None
13201324
_ppApplication=None

source/appModules/vipmud.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
This module makes NVDA read incoming text, as well as allowing the user to review the last nine messages with control 1 through 9.
1515
"""
1616

17+
# Translators: The name of a category of NVDA commands.
18+
SCRCAT_VIPMUD = _("VipMud")
19+
1720
class AppModule(appModuleHandler.AppModule):
1821
lastLength=0
1922
msgs =[]
@@ -26,6 +29,7 @@ def chooseNVDAObjectOverlayClasses(self, obj, clsList):
2629
# Translators: The description of an NVDA command to view one of the recent messages.
2730
description=_("Displays one of the recent messages"),
2831
gestures=[f"kb:control+{n}" for n in range(1, historyLength + 1)],
32+
category=SCRCAT_VIPMUD,
2933
speakOnDemand=True,
3034
)
3135
def script_readMessage(self,gesture):

0 commit comments

Comments
 (0)