Skip to content

Commit 5c25c1b

Browse files
authored
Merge 8a0392e into 7402acd
2 parents 7402acd + 8a0392e commit 5c25c1b

8 files changed

Lines changed: 91 additions & 28 deletions

File tree

source/NVDAObjects/IAccessible/winword.py

Lines changed: 47 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,12 @@ 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 to the right of it within this table. Pressing twice will forget the current column header for this cell."),
221+
category=SCRCAT_SYSTEMCARET
222+
)
215223
def script_setColumnHeader(self,gesture):
216224
scriptCount=scriptHandler.getLastScriptRepeatCount()
217225
try:
@@ -234,8 +242,13 @@ def script_setColumnHeader(self,gesture):
234242
else:
235243
# Translators: a message reported in the SetColumnHeader script for Microsoft Word.
236244
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.")
238245

246+
@script(
247+
gesture="kb:NVDA+shift+r",
248+
# Translators: The label of a shortcut of NVDA.
249+
description=_("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."),
250+
category=SCRCAT_SYSTEMCARET
251+
)
239252
def script_setRowHeader(self,gesture):
240253
scriptCount=scriptHandler.getLastScriptRepeatCount()
241254
try:
@@ -258,14 +271,25 @@ def script_setRowHeader(self,gesture):
258271
else:
259272
# Translators: a message reported in the SetRowHeader script for Microsoft Word.
260273
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.")
262274

275+
@script(
276+
gesture="kb:NVDA+shift+h",
277+
category=SCRCAT_SYSTEMCARET
278+
)
263279
def script_reportCurrentHeaders(self,gesture):
264280
cell=self.WinwordSelectionObject.cells[1]
265281
rowText=self.fetchAssociatedHeaderCellText(cell,False)
266282
columnText=self.fetchAssociatedHeaderCellText(cell,True)
267283
ui.message("Row %s, column %s"%(rowText or "empty",columnText or "empty"))
268284

285+
@script(
286+
gestures=(
287+
"kb:alt+home",
288+
"kb:alt+end",
289+
"kb:alt+pageUp",
290+
"kb:alt+pageDown"
291+
)
292+
)
269293
def script_caret_moveByCell(self, gesture: inputCore.InputGesture) -> None:
270294
info = self.makeTextInfo(textInfos.POSITION_SELECTION)
271295
inTable = info._rangeObj.tables.count > 0
@@ -301,6 +325,7 @@ def script_caret_moveByCell(self, gesture: inputCore.InputGesture) -> None:
301325
# Translators: a description for a script
302326
description=_("Reports the text of the comment where the system caret is located."),
303327
gesture="kb:NVDA+alt+c",
328+
category=SCRCAT_SYSTEMCARET,
304329
speakOnDemand=True,
305330
)
306331
def script_reportCurrentComment(self,gesture):
@@ -375,33 +400,51 @@ def _moveInTable(self,row=True,forward=True):
375400
newInfo.updateCaret()
376401
return True
377402

403+
@script(
404+
gesture="kb:control+alt+downArrow"
405+
)
378406
def script_nextRow(self,gesture):
379407
self._moveInTable(row=True,forward=True)
380408

409+
@script(
410+
gesture="kb:control+alt+upArrow"
411+
)
381412
def script_previousRow(self,gesture):
382413
self._moveInTable(row=True,forward=False)
383414

415+
@script(
416+
gesture="kb:control+alt+rightArrow"
417+
)
384418
def script_nextColumn(self,gesture):
385419
self._moveInTable(row=False,forward=True)
386420

421+
@script(
422+
gesture="kb:control+alt+leftArrow"
423+
)
387424
def script_previousColumn(self,gesture):
388425
self._moveInTable(row=False,forward=False)
389426

427+
@script(
428+
gesture="kb:control+downArrow",
429+
resumeSayAllMode=sayAll.CURSOR.CARET
430+
)
390431
def script_nextParagraph(self,gesture):
391432
info=self.makeTextInfo(textInfos.POSITION_CARET)
392433
# #4375: can't use self.move here as it may check document.chracters.count which can take for ever on large documents.
393434
info._rangeObj.move(winWordWindowModule.wdParagraph, 1)
394435
info.updateCaret()
395436
self._caretScriptPostMovedHelper(textInfos.UNIT_PARAGRAPH,gesture,None)
396-
script_nextParagraph.resumeSayAllMode = sayAll.CURSOR.CARET
397437

438+
@script(
439+
gesture="kb:control+upArrow",
440+
resumeSayAllMode=sayAll.CURSOR.CARET
441+
)
398442
def script_previousParagraph(self,gesture):
399443
info=self.makeTextInfo(textInfos.POSITION_CARET)
400444
# #4375: keeping symmetrical with nextParagraph script.
401445
info._rangeObj.move(winWordWindowModule.wdParagraph, -1)
402446
info.updateCaret()
403447
self._caretScriptPostMovedHelper(textInfos.UNIT_PARAGRAPH,gesture,None)
404-
script_previousParagraph.resumeSayAllMode = sayAll.CURSOR.CARET
405448

406449
@script(
407450
gestures=(
@@ -435,23 +478,6 @@ def focusOnActiveDocument(self, officeChartObject):
435478
import api
436479
eventHandler.executeEvent("gainFocus", api.getDesktopObject().objectWithFocus())
437480

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

457483
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)