Skip to content

Commit 5cad186

Browse files
authored
Merge d9fed3b into 57f468f
2 parents 57f468f + d9fed3b commit 5cad186

8 files changed

Lines changed: 101 additions & 28 deletions

File tree

source/NVDAObjects/IAccessible/winword.py

Lines changed: 57 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,17 @@ 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=_(
221+
"Set column header"
222+
"Pressing once will set this cell as the first column header for any cells lower and "
223+
"to the right of it within this table. "
224+
"Pressing twice will forget the current column header for this cell."
225+
),
226+
category=SCRCAT_SYSTEMCARET
227+
)
215228
def script_setColumnHeader(self,gesture):
216229
scriptCount=scriptHandler.getLastScriptRepeatCount()
217230
try:
@@ -234,8 +247,18 @@ def script_setColumnHeader(self,gesture):
234247
else:
235248
# Translators: a message reported in the SetColumnHeader script for Microsoft Word.
236249
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.")
238250

251+
@script(
252+
gesture="kb:NVDA+shift+r",
253+
# Translators: The label of a shortcut of NVDA.
254+
description=_(
255+
"Set row header."
256+
"Pressing once will set this cell as the first row header for any cells lower and "
257+
"to the right of it within this table. "
258+
"Pressing twice will forget the current row header for this cell."
259+
),
260+
category=SCRCAT_SYSTEMCARET
261+
)
239262
def script_setRowHeader(self,gesture):
240263
scriptCount=scriptHandler.getLastScriptRepeatCount()
241264
try:
@@ -258,14 +281,25 @@ def script_setRowHeader(self,gesture):
258281
else:
259282
# Translators: a message reported in the SetRowHeader script for Microsoft Word.
260283
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.")
262284

285+
@script(
286+
gesture="kb:NVDA+shift+h",
287+
category=SCRCAT_SYSTEMCARET
288+
)
263289
def script_reportCurrentHeaders(self,gesture):
264290
cell=self.WinwordSelectionObject.cells[1]
265291
rowText=self.fetchAssociatedHeaderCellText(cell,False)
266292
columnText=self.fetchAssociatedHeaderCellText(cell,True)
267293
ui.message("Row %s, column %s"%(rowText or "empty",columnText or "empty"))
268294

295+
@script(
296+
gestures=(
297+
"kb:alt+home",
298+
"kb:alt+end",
299+
"kb:alt+pageUp",
300+
"kb:alt+pageDown"
301+
)
302+
)
269303
def script_caret_moveByCell(self, gesture: inputCore.InputGesture) -> None:
270304
info = self.makeTextInfo(textInfos.POSITION_SELECTION)
271305
inTable = info._rangeObj.tables.count > 0
@@ -301,6 +335,7 @@ def script_caret_moveByCell(self, gesture: inputCore.InputGesture) -> None:
301335
# Translators: a description for a script
302336
description=_("Reports the text of the comment where the system caret is located."),
303337
gesture="kb:NVDA+alt+c",
338+
category=SCRCAT_SYSTEMCARET,
304339
speakOnDemand=True,
305340
)
306341
def script_reportCurrentComment(self,gesture):
@@ -375,33 +410,51 @@ def _moveInTable(self,row=True,forward=True):
375410
newInfo.updateCaret()
376411
return True
377412

413+
@script(
414+
gesture="kb:control+alt+downArrow"
415+
)
378416
def script_nextRow(self,gesture):
379417
self._moveInTable(row=True,forward=True)
380418

419+
@script(
420+
gesture="kb:control+alt+upArrow"
421+
)
381422
def script_previousRow(self,gesture):
382423
self._moveInTable(row=True,forward=False)
383424

425+
@script(
426+
gesture="kb:control+alt+rightArrow"
427+
)
384428
def script_nextColumn(self,gesture):
385429
self._moveInTable(row=False,forward=True)
386430

431+
@script(
432+
gesture="kb:control+alt+leftArrow"
433+
)
387434
def script_previousColumn(self,gesture):
388435
self._moveInTable(row=False,forward=False)
389436

437+
@script(
438+
gesture="kb:control+downArrow",
439+
resumeSayAllMode=sayAll.CURSOR.CARET
440+
)
390441
def script_nextParagraph(self,gesture):
391442
info=self.makeTextInfo(textInfos.POSITION_CARET)
392443
# #4375: can't use self.move here as it may check document.chracters.count which can take for ever on large documents.
393444
info._rangeObj.move(winWordWindowModule.wdParagraph, 1)
394445
info.updateCaret()
395446
self._caretScriptPostMovedHelper(textInfos.UNIT_PARAGRAPH,gesture,None)
396-
script_nextParagraph.resumeSayAllMode = sayAll.CURSOR.CARET
397447

448+
@script(
449+
gesture="kb:control+upArrow",
450+
resumeSayAllMode=sayAll.CURSOR.CARET
451+
)
398452
def script_previousParagraph(self,gesture):
399453
info=self.makeTextInfo(textInfos.POSITION_CARET)
400454
# #4375: keeping symmetrical with nextParagraph script.
401455
info._rangeObj.move(winWordWindowModule.wdParagraph, -1)
402456
info.updateCaret()
403457
self._caretScriptPostMovedHelper(textInfos.UNIT_PARAGRAPH,gesture,None)
404-
script_previousParagraph.resumeSayAllMode = sayAll.CURSOR.CARET
405458

406459
@script(
407460
gestures=(
@@ -435,23 +488,6 @@ def focusOnActiveDocument(self, officeChartObject):
435488
import api
436489
eventHandler.executeEvent("gainFocus", api.getDesktopObject().objectWithFocus())
437490

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

457493
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"])
@@ -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)