Skip to content

Commit c9d1bc9

Browse files
authored
Merge 942ba70 into 7402acd
2 parents 7402acd + 942ba70 commit c9d1bc9

8 files changed

Lines changed: 95 additions & 28 deletions

File tree

source/NVDAObjects/IAccessible/winword.py

Lines changed: 51 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
from speech import sayAll
2828
import inputCore
2929

30+
# Translators: The name of a category of NVDA commands.
31+
SCRCAT_SYSTEMCARET = _("System caret")
3032

3133
class WordDocument(IAccessible, EditableTextWithoutAutoSelectDetection, winWordWindowModule.WordDocument):
3234

@@ -212,6 +214,14 @@ def fetchAssociatedHeaderCellText(self,cell,columnHeader=False):
212214
if text:
213215
return text
214216

217+
@script(
218+
gesture="kb:NVDA+shift+c",
219+
# Translators: The label of a shortcut of NVDA.
220+
description=_("""Pressing once will set this cell as the first column header for any cells lower and
221+
to the right of it within this table.
222+
Pressing twice will forget the current column header for this cell."""),
223+
category=SCRCAT_SYSTEMCARET
224+
)
215225
def script_setColumnHeader(self,gesture):
216226
scriptCount=scriptHandler.getLastScriptRepeatCount()
217227
try:
@@ -234,8 +244,15 @@ def script_setColumnHeader(self,gesture):
234244
else:
235245
# Translators: a message reported in the SetColumnHeader script for Microsoft Word.
236246
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.")
238247

248+
@script(
249+
gesture="kb:NVDA+shift+r",
250+
# Translators: The label of a shortcut of NVDA.
251+
description=_("""Pressing once will set this cell as the first row header for any cells lower and
252+
to the right of it within this table.
253+
Pressing twice will forget the current row header for this cell."""),
254+
category=SCRCAT_SYSTEMCARET
255+
)
239256
def script_setRowHeader(self,gesture):
240257
scriptCount=scriptHandler.getLastScriptRepeatCount()
241258
try:
@@ -258,14 +275,25 @@ def script_setRowHeader(self,gesture):
258275
else:
259276
# Translators: a message reported in the SetRowHeader script for Microsoft Word.
260277
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.")
262278

279+
@script(
280+
gesture="kb:NVDA+shift+h",
281+
category=SCRCAT_SYSTEMCARET
282+
)
263283
def script_reportCurrentHeaders(self,gesture):
264284
cell=self.WinwordSelectionObject.cells[1]
265285
rowText=self.fetchAssociatedHeaderCellText(cell,False)
266286
columnText=self.fetchAssociatedHeaderCellText(cell,True)
267287
ui.message("Row %s, column %s"%(rowText or "empty",columnText or "empty"))
268288

289+
@script(
290+
gestures=(
291+
"kb:alt+home",
292+
"kb:alt+end",
293+
"kb:alt+pageUp",
294+
"kb:alt+pageDown"
295+
)
296+
)
269297
def script_caret_moveByCell(self, gesture: inputCore.InputGesture) -> None:
270298
info = self.makeTextInfo(textInfos.POSITION_SELECTION)
271299
inTable = info._rangeObj.tables.count > 0
@@ -301,6 +329,7 @@ def script_caret_moveByCell(self, gesture: inputCore.InputGesture) -> None:
301329
# Translators: a description for a script
302330
description=_("Reports the text of the comment where the system caret is located."),
303331
gesture="kb:NVDA+alt+c",
332+
category=SCRCAT_SYSTEMCARET,
304333
speakOnDemand=True,
305334
)
306335
def script_reportCurrentComment(self,gesture):
@@ -375,33 +404,51 @@ def _moveInTable(self,row=True,forward=True):
375404
newInfo.updateCaret()
376405
return True
377406

407+
@script(
408+
gesture="kb:control+alt+downArrow"
409+
)
378410
def script_nextRow(self,gesture):
379411
self._moveInTable(row=True,forward=True)
380412

413+
@script(
414+
gesture="kb:control+alt+upArrow"
415+
)
381416
def script_previousRow(self,gesture):
382417
self._moveInTable(row=True,forward=False)
383418

419+
@script(
420+
gesture="kb:control+alt+rightArrow"
421+
)
384422
def script_nextColumn(self,gesture):
385423
self._moveInTable(row=False,forward=True)
386424

425+
@script(
426+
gesture="kb:control+alt+leftArrow"
427+
)
387428
def script_previousColumn(self,gesture):
388429
self._moveInTable(row=False,forward=False)
389430

431+
@script(
432+
gesture="kb:control+downArrow",
433+
resumeSayAllMode=sayAll.CURSOR.CARET
434+
)
390435
def script_nextParagraph(self,gesture):
391436
info=self.makeTextInfo(textInfos.POSITION_CARET)
392437
# #4375: can't use self.move here as it may check document.chracters.count which can take for ever on large documents.
393438
info._rangeObj.move(winWordWindowModule.wdParagraph, 1)
394439
info.updateCaret()
395440
self._caretScriptPostMovedHelper(textInfos.UNIT_PARAGRAPH,gesture,None)
396-
script_nextParagraph.resumeSayAllMode = sayAll.CURSOR.CARET
397441

442+
@script(
443+
gesture="kb:control+upArrow",
444+
resumeSayAllMode=sayAll.CURSOR.CARET
445+
)
398446
def script_previousParagraph(self,gesture):
399447
info=self.makeTextInfo(textInfos.POSITION_CARET)
400448
# #4375: keeping symmetrical with nextParagraph script.
401449
info._rangeObj.move(winWordWindowModule.wdParagraph, -1)
402450
info.updateCaret()
403451
self._caretScriptPostMovedHelper(textInfos.UNIT_PARAGRAPH,gesture,None)
404-
script_previousParagraph.resumeSayAllMode = sayAll.CURSOR.CARET
405452

406453
@script(
407454
gestures=(
@@ -435,23 +482,6 @@ def focusOnActiveDocument(self, officeChartObject):
435482
import api
436483
eventHandler.executeEvent("gainFocus", api.getDesktopObject().objectWithFocus())
437484

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-
455485
class SpellCheckErrorField(IAccessible, winWordWindowModule.WordDocument_WwN):
456486

457487
parentSDMCanOverrideName=False

source/NVDAObjects/UIA/wordDocument.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141

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

44+
# Translators: The name of a category of NVDA commands.
45+
SCRCAT_SYSTEMCARET = _("System caret")
4446

4547
class UIACustomAttributeID(enum.IntEnum):
4648
LINE_NUMBER = 0
@@ -601,6 +603,7 @@ def _caretMoveBySentenceHelper(self, gesture, direction):
601603
gesture="kb:NVDA+alt+c",
602604
# Translators: a description for a script that reports the comment at the caret.
603605
description=_("Reports the text of the comment where the system caret is located."),
606+
category=SCRCAT_SYSTEMCARET,
604607
speakOnDemand=True,
605608
)
606609
def script_reportCurrentComment(self,gesture):

source/NVDAObjects/window/excel.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@
5353
from utils.displayString import DisplayStringIntEnum
5454
import NVDAState
5555

56+
# Translators: The name of a category of NVDA commands.
57+
SCRCAT_SYSTEMCARET = _("System caret")
58+
5659
excel2010VersionMajor=14
5760

5861
xlNone=-4142
@@ -1438,7 +1441,9 @@ def _get_rowHeaderText(self):
14381441
@script(
14391442
# Translators: the description for a script for Excel
14401443
description=_("opens a dropdown item at the current cell"),
1441-
gesture="kb:alt+downArrow")
1444+
gesture="kb:alt+downArrow",
1445+
category=SCRCAT_SYSTEMCARET
1446+
)
14421447
def script_openDropdown(self,gesture):
14431448
gesture.send()
14441449
d=None
@@ -1464,7 +1469,9 @@ def script_openDropdown(self,gesture):
14641469
@script(
14651470
# Translators: the description for a script for Excel
14661471
description=_("Sets the current cell as start of column header"),
1467-
gesture="kb:NVDA+shift+c")
1472+
gesture="kb:NVDA+shift+c",
1473+
category=SCRCAT_SYSTEMCARET
1474+
)
14681475
def script_setColumnHeader(self,gesture):
14691476
scriptCount=scriptHandler.getLastScriptRepeatCount()
14701477
if scriptCount==0:
@@ -1486,7 +1493,9 @@ def script_setColumnHeader(self,gesture):
14861493
@script(
14871494
# Translators: the description for a script for Excel
14881495
description=_("sets the current cell as start of row header"),
1489-
gesture="kb:NVDA+shift+r")
1496+
gesture="kb:NVDA+shift+r",
1497+
category=SCRCAT_SYSTEMCARET
1498+
)
14901499
def script_setRowHeader(self,gesture):
14911500
scriptCount=scriptHandler.getLastScriptRepeatCount()
14921501
if scriptCount==0:
@@ -1672,6 +1681,7 @@ def _get_positionInfo(self):
16721681
# Translators: the description for a script for Excel
16731682
description=_("Reports the note on the current cell"),
16741683
gesture="kb:NVDA+alt+c",
1684+
category=SCRCAT_SYSTEMCARET,
16751685
speakOnDemand=True,
16761686
)
16771687
def script_reportComment(self,gesture):
@@ -1686,7 +1696,9 @@ def script_reportComment(self,gesture):
16861696
@script(
16871697
# Translators: the description for a script for Excel
16881698
description=_("Opens the note editing dialog"),
1689-
gesture="kb:shift+f2")
1699+
gesture="kb:shift+f2",
1700+
category=SCRCAT_SYSTEMCARET
1701+
)
16901702
def script_editComment(self,gesture):
16911703
commentObj=self.excelCellObject.comment
16921704
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"])
@@ -1242,7 +1245,8 @@ def handleSlideChange(self):
12421245
self.treeInterceptor.reportNewSlide()
12431246

12441247
class AppModule(appModuleHandler.AppModule):
1245-
1248+
scriptCategory = SCRCAT_POWERPOINT
1249+
12461250
hasTriedPpAppSwitch=False
12471251
_ppApplicationWindow=None
12481252
_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)