forked from nvaccess/nvda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobalCommands.py
executable file
·2590 lines (2396 loc) · 130 KB
/
globalCommands.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# -*- coding: UTF-8 -*-
#globalCommands.py
#A part of NonVisual Desktop Access (NVDA)
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
#Copyright (C) 2006-2018 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Rui Batista, Joseph Lee, Leonard de Ruijter, Derek Riemer, Babbage B.V., Davy Kager, Ethan Holliger, Łukasz Golonka
import time
import itertools
import tones
import audioDucking
import touchHandler
import keyboardHandler
import mouseHandler
import eventHandler
import review
import controlTypes
import api
import textInfos
import speech
import sayAllHandler
from NVDAObjects import NVDAObject, NVDAObjectTextInfo
import globalVars
from logHandler import log
from synthDriverHandler import *
import gui
import wx
import config
import winUser
import appModuleHandler
import winKernel
import treeInterceptorHandler
import browseMode
import scriptHandler
from scriptHandler import script
import ui
import braille
import brailleInput
import inputCore
import virtualBuffers
import characterProcessing
from baseObject import ScriptableObject
import core
import winVersion
from base64 import b16encode
#: Script category for text review commands.
# Translators: The name of a category of NVDA commands.
SCRCAT_TEXTREVIEW = _("Text review")
#: Script category for Object navigation commands.
# Translators: The name of a category of NVDA commands.
SCRCAT_OBJECTNAVIGATION = _("Object navigation")
#: Script category for system caret commands.
# Translators: The name of a category of NVDA commands.
SCRCAT_SYSTEMCARET = _("System caret")
#: Script category for mouse commands.
# Translators: The name of a category of NVDA commands.
SCRCAT_MOUSE = _("Mouse")
#: Script category for speech commands.
# Translators: The name of a category of NVDA commands.
SCRCAT_SPEECH = _("Speech")
#: Script category for configuration dialogs commands.
# Translators: The name of a category of NVDA commands.
SCRCAT_CONFIG = _("Configuration")
#: Script category for configuration profile activation and management commands.
# Translators: The name of a category of NVDA commands.
SCRCAT_CONFIG_PROFILES = _("Configuration profiles")
#: Script category for Braille commands.
# Translators: The name of a category of NVDA commands.
SCRCAT_BRAILLE = _("Braille")
#: Script category for tools commands.
# Translators: The name of a category of NVDA commands.
SCRCAT_TOOLS = pgettext('script category', 'Tools')
#: Script category for touch commands.
# Translators: The name of a category of NVDA commands.
SCRCAT_TOUCH = _("Touch screen")
#: Script category for focus commands.
# Translators: The name of a category of NVDA commands.
SCRCAT_FOCUS = _("System focus")
#: Script category for system status commands.
# Translators: The name of a category of NVDA commands.
SCRCAT_SYSTEM = _("System status")
#: Script category for input commands.
# Translators: The name of a category of NVDA commands.
SCRCAT_INPUT = _("Input")
#: Script category for document formatting commands.
# Translators: The name of a category of NVDA commands.
SCRCAT_DOCUMENTFORMATTING = _("Document formatting")
class GlobalCommands(ScriptableObject):
"""Commands that are available at all times, regardless of the current focus.
"""
def script_cycleAudioDuckingMode(self,gesture):
if not audioDucking.isAudioDuckingSupported():
# Translators: a message when audio ducking is not supported on this machine
ui.message(_("Audio ducking not supported"))
return
curMode=config.conf['audio']['audioDuckingMode']
numModes=len(audioDucking.audioDuckingModes)
nextMode=(curMode+1)%numModes
audioDucking.setAudioDuckingMode(nextMode)
config.conf['audio']['audioDuckingMode']=nextMode
nextLabel=audioDucking.audioDuckingModes[nextMode]
ui.message(nextLabel)
# Translators: Describes the Cycle audio ducking mode command.
script_cycleAudioDuckingMode.__doc__=_("Cycles through audio ducking modes which determine when NVDA lowers the volume of other sounds")
def script_toggleInputHelp(self,gesture):
inputCore.manager.isInputHelpActive = not inputCore.manager.isInputHelpActive
# Translators: This will be presented when the input help is toggled.
stateOn = _("input help on")
# Translators: This will be presented when the input help is toggled.
stateOff = _("input help off")
state = stateOn if inputCore.manager.isInputHelpActive else stateOff
ui.message(state)
# Translators: Input help mode message for toggle input help command.
script_toggleInputHelp.__doc__=_("Turns input help on or off. When on, any input such as pressing a key on the keyboard will tell you what script is associated with that input, if any.")
script_toggleInputHelp.category=SCRCAT_INPUT
def script_toggleCurrentAppSleepMode(self,gesture):
curFocus=api.getFocusObject()
curApp=curFocus.appModule
if curApp.sleepMode:
curApp.sleepMode=False
# Translators: This is presented when sleep mode is deactivated, NVDA will continue working as expected.
ui.message(_("Sleep mode off"))
eventHandler.executeEvent("gainFocus",curFocus)
else:
eventHandler.executeEvent("loseFocus",curFocus)
curApp.sleepMode=True
# Translators: This is presented when sleep mode is activated, the focused application is self voicing, such as klango or openbook.
ui.message(_("Sleep mode on"))
# Translators: Input help mode message for toggle sleep mode command.
script_toggleCurrentAppSleepMode.__doc__=_("Toggles sleep mode on and off for the active application.")
script_toggleCurrentAppSleepMode.allowInSleepMode=True
def script_reportCurrentLine(self,gesture):
obj=api.getFocusObject()
treeInterceptor=obj.treeInterceptor
if isinstance(treeInterceptor,treeInterceptorHandler.DocumentTreeInterceptor) and not treeInterceptor.passThrough:
obj=treeInterceptor
try:
info=obj.makeTextInfo(textInfos.POSITION_CARET)
except (NotImplementedError, RuntimeError):
info=obj.makeTextInfo(textInfos.POSITION_FIRST)
info.expand(textInfos.UNIT_LINE)
scriptCount=scriptHandler.getLastScriptRepeatCount()
if scriptCount==0:
speech.speakTextInfo(info,unit=textInfos.UNIT_LINE,reason=controlTypes.REASON_CARET)
else:
speech.spellTextInfo(info,useCharacterDescriptions=scriptCount>1)
# Translators: Input help mode message for report current line command.
script_reportCurrentLine.__doc__=_("Reports the current line under the application cursor. Pressing this key twice will spell the current line. Pressing three times will spell the line using character descriptions.")
script_reportCurrentLine.category=SCRCAT_SYSTEMCARET
def script_leftMouseClick(self,gesture):
# Translators: Reported when left mouse button is clicked.
ui.message(_("Left click"))
mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN,0,0)
mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP,0,0)
# Translators: Input help mode message for left mouse click command.
script_leftMouseClick.__doc__=_("Clicks the left mouse button once at the current mouse position")
script_leftMouseClick.category=SCRCAT_MOUSE
def script_rightMouseClick(self,gesture):
# Translators: Reported when right mouse button is clicked.
ui.message(_("Right click"))
mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_RIGHTDOWN,0,0)
mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_RIGHTUP,0,0)
# Translators: Input help mode message for right mouse click command.
script_rightMouseClick.__doc__=_("Clicks the right mouse button once at the current mouse position")
script_rightMouseClick.category=SCRCAT_MOUSE
def script_toggleLeftMouseButton(self,gesture):
if winUser.getKeyState(winUser.VK_LBUTTON)&32768:
# Translators: This is presented when the left mouse button lock is released (used for drag and drop).
ui.message(_("Left mouse button unlock"))
mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP,0,0)
else:
# Translators: This is presented when the left mouse button is locked down (used for drag and drop).
ui.message(_("Left mouse button lock"))
mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN,0,0)
# Translators: Input help mode message for left mouse lock/unlock toggle command.
script_toggleLeftMouseButton.__doc__=_("Locks or unlocks the left mouse button")
script_toggleLeftMouseButton.category=SCRCAT_MOUSE
def script_toggleRightMouseButton(self,gesture):
if winUser.getKeyState(winUser.VK_RBUTTON)&32768:
# Translators: This is presented when the right mouse button lock is released (used for drag and drop).
ui.message(_("Right mouse button unlock"))
mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_RIGHTUP,0,0)
else:
# Translators: This is presented when the right mouse button is locked down (used for drag and drop).
ui.message(_("Right mouse button lock"))
mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_RIGHTDOWN,0,0)
# Translators: Input help mode message for right mouse lock/unlock command.
script_toggleRightMouseButton.__doc__=_("Locks or unlocks the right mouse button")
script_toggleRightMouseButton.category=SCRCAT_MOUSE
def script_reportCurrentSelection(self,gesture):
obj=api.getFocusObject()
treeInterceptor=obj.treeInterceptor
if isinstance(treeInterceptor,treeInterceptorHandler.DocumentTreeInterceptor) and not treeInterceptor.passThrough:
obj=treeInterceptor
try:
info=obj.makeTextInfo(textInfos.POSITION_SELECTION)
except (RuntimeError, NotImplementedError):
info=None
if not info or info.isCollapsed:
speech.speakMessage(_("No selection"))
else:
speech.speakTextSelected(info.text)
# Translators: Input help mode message for report current selection command.
script_reportCurrentSelection.__doc__=_("Announces the current selection in edit controls and documents. If there is no selection it says so.")
script_reportCurrentSelection.category=SCRCAT_SYSTEMCARET
def script_dateTime(self,gesture):
if scriptHandler.getLastScriptRepeatCount()==0:
text=winKernel.GetTimeFormatEx(winKernel.LOCALE_NAME_USER_DEFAULT, winKernel.TIME_NOSECONDS, None, None)
else:
text=winKernel.GetDateFormatEx(winKernel.LOCALE_NAME_USER_DEFAULT, winKernel.DATE_LONGDATE, None, None)
ui.message(text)
# Translators: Input help mode message for report date and time command.
script_dateTime.__doc__=_("If pressed once, reports the current time. If pressed twice, reports the current date")
script_dateTime.category=SCRCAT_SYSTEM
def script_increaseSynthSetting(self,gesture):
settingName=globalVars.settingsRing.currentSettingName
if not settingName:
# Translators: Reported when there are no settings to configure in synth settings ring (example: when there is no setting for language).
ui.message(_("No settings"))
return
settingValue=globalVars.settingsRing.increase()
ui.message("%s %s" % (settingName,settingValue))
# Translators: Input help mode message for increase synth setting value command.
script_increaseSynthSetting.__doc__=_("Increases the currently active setting in the synth settings ring")
script_increaseSynthSetting.category=SCRCAT_SPEECH
def script_decreaseSynthSetting(self,gesture):
settingName=globalVars.settingsRing.currentSettingName
if not settingName:
ui.message(_("No settings"))
return
settingValue=globalVars.settingsRing.decrease()
ui.message("%s %s" % (settingName,settingValue))
# Translators: Input help mode message for decrease synth setting value command.
script_decreaseSynthSetting.__doc__=_("Decreases the currently active setting in the synth settings ring")
script_decreaseSynthSetting.category=SCRCAT_SPEECH
def script_nextSynthSetting(self,gesture):
nextSettingName=globalVars.settingsRing.next()
if not nextSettingName:
ui.message(_("No settings"))
return
nextSettingValue=globalVars.settingsRing.currentSettingValue
ui.message("%s %s"%(nextSettingName,nextSettingValue))
# Translators: Input help mode message for next synth setting command.
script_nextSynthSetting.__doc__=_("Moves to the next available setting in the synth settings ring")
script_nextSynthSetting.category=SCRCAT_SPEECH
def script_previousSynthSetting(self,gesture):
previousSettingName=globalVars.settingsRing.previous()
if not previousSettingName:
ui.message(_("No settings"))
return
previousSettingValue=globalVars.settingsRing.currentSettingValue
ui.message("%s %s"%(previousSettingName,previousSettingValue))
# Translators: Input help mode message for previous synth setting command.
script_previousSynthSetting.__doc__=_("Moves to the previous available setting in the synth settings ring")
script_previousSynthSetting.category=SCRCAT_SPEECH
def script_toggleSpeakTypedCharacters(self,gesture):
if config.conf["keyboard"]["speakTypedCharacters"]:
# Translators: The message announced when toggling the speak typed characters keyboard setting.
state = _("speak typed characters off")
config.conf["keyboard"]["speakTypedCharacters"]=False
else:
# Translators: The message announced when toggling the speak typed characters keyboard setting.
state = _("speak typed characters on")
config.conf["keyboard"]["speakTypedCharacters"]=True
ui.message(state)
# Translators: Input help mode message for toggle speaked typed characters command.
script_toggleSpeakTypedCharacters.__doc__=_("Toggles on and off the speaking of typed characters")
script_toggleSpeakTypedCharacters.category=SCRCAT_SPEECH
def script_toggleSpeakTypedWords(self,gesture):
if config.conf["keyboard"]["speakTypedWords"]:
# Translators: The message announced when toggling the speak typed words keyboard setting.
state = _("speak typed words off")
config.conf["keyboard"]["speakTypedWords"]=False
else:
# Translators: The message announced when toggling the speak typed words keyboard setting.
state = _("speak typed words on")
config.conf["keyboard"]["speakTypedWords"]=True
ui.message(state)
# Translators: Input help mode message for toggle speak typed words command.
script_toggleSpeakTypedWords.__doc__=_("Toggles on and off the speaking of typed words")
script_toggleSpeakTypedWords.category=SCRCAT_SPEECH
def script_toggleSpeakCommandKeys(self,gesture):
if config.conf["keyboard"]["speakCommandKeys"]:
# Translators: The message announced when toggling the speak typed command keyboard setting.
state = _("speak command keys off")
config.conf["keyboard"]["speakCommandKeys"]=False
else:
# Translators: The message announced when toggling the speak typed command keyboard setting.
state = _("speak command keys on")
config.conf["keyboard"]["speakCommandKeys"]=True
ui.message(state)
# Translators: Input help mode message for toggle speak command keys command.
script_toggleSpeakCommandKeys.__doc__=_("Toggles on and off the speaking of typed keys, that are not specifically characters")
script_toggleSpeakCommandKeys.category=SCRCAT_SPEECH
def script_toggleReportFontName(self,gesture):
if config.conf["documentFormatting"]["reportFontName"]:
# Translators: The message announced when toggling the report font name document formatting setting.
state = _("report font name off")
config.conf["documentFormatting"]["reportFontName"]=False
else:
# Translators: The message announced when toggling the report font name document formatting setting.
state = _("report font name on")
config.conf["documentFormatting"]["reportFontName"]=True
ui.message(state)
# Translators: Input help mode message for toggle report font name command.
script_toggleReportFontName.__doc__=_("Toggles on and off the reporting of font changes")
script_toggleReportFontName.category=SCRCAT_DOCUMENTFORMATTING
def script_toggleReportFontSize(self,gesture):
if config.conf["documentFormatting"]["reportFontSize"]:
# Translators: The message announced when toggling the report font size document formatting setting.
state = _("report font size off")
config.conf["documentFormatting"]["reportFontSize"]=False
else:
# Translators: The message announced when toggling the report font size document formatting setting.
state = _("report font size on")
config.conf["documentFormatting"]["reportFontSize"]=True
ui.message(state)
# Translators: Input help mode message for toggle report font size command.
script_toggleReportFontSize.__doc__=_("Toggles on and off the reporting of font size changes")
script_toggleReportFontSize.category=SCRCAT_DOCUMENTFORMATTING
def script_toggleReportFontAttributes(self,gesture):
if config.conf["documentFormatting"]["reportFontAttributes"]:
# Translators: The message announced when toggling the report font attributes document formatting setting.
state = _("report font attributes off")
config.conf["documentFormatting"]["reportFontAttributes"]=False
else:
# Translators: The message announced when toggling the report font attributes document formatting setting.
state = _("report font attributes on")
config.conf["documentFormatting"]["reportFontAttributes"]=True
ui.message(state)
# Translators: Input help mode message for toggle report font attributes command.
script_toggleReportFontAttributes.__doc__=_("Toggles on and off the reporting of font attributes")
script_toggleReportFontAttributes.category=SCRCAT_DOCUMENTFORMATTING
def script_toggleReportRevisions(self,gesture):
if config.conf["documentFormatting"]["reportRevisions"]:
# Translators: The message announced when toggling the report revisions document formatting setting.
state = _("report revisions off")
config.conf["documentFormatting"]["reportRevisions"]=False
else:
# Translators: The message announced when toggling the report revisions document formatting setting.
state = _("report revisions on")
config.conf["documentFormatting"]["reportRevisions"]=True
ui.message(state)
# Translators: Input help mode message for toggle report revisions command.
script_toggleReportRevisions.__doc__=_("Toggles on and off the reporting of revisions")
script_toggleReportRevisions.category=SCRCAT_DOCUMENTFORMATTING
def script_toggleReportEmphasis(self,gesture):
if config.conf["documentFormatting"]["reportEmphasis"]:
# Translators: The message announced when toggling the report emphasis document formatting setting.
state = _("report emphasis off")
config.conf["documentFormatting"]["reportEmphasis"]=False
else:
# Translators: The message announced when toggling the report emphasis document formatting setting.
state = _("report emphasis on")
config.conf["documentFormatting"]["reportEmphasis"]=True
ui.message(state)
# Translators: Input help mode message for toggle report emphasis command.
script_toggleReportEmphasis.__doc__=_("Toggles on and off the reporting of emphasis")
script_toggleReportEmphasis.category=SCRCAT_DOCUMENTFORMATTING
def script_toggleReportColor(self,gesture):
if config.conf["documentFormatting"]["reportColor"]:
# Translators: The message announced when toggling the report colors document formatting setting.
state = _("report colors off")
config.conf["documentFormatting"]["reportColor"]=False
else:
# Translators: The message announced when toggling the report colors document formatting setting.
state = _("report colors on")
config.conf["documentFormatting"]["reportColor"]=True
ui.message(state)
# Translators: Input help mode message for toggle report colors command.
script_toggleReportColor.__doc__=_("Toggles on and off the reporting of colors")
script_toggleReportColor.category=SCRCAT_DOCUMENTFORMATTING
def script_toggleReportAlignment(self,gesture):
if config.conf["documentFormatting"]["reportAlignment"]:
# Translators: The message announced when toggling the report alignment document formatting setting.
state = _("report alignment off")
config.conf["documentFormatting"]["reportAlignment"]=False
else:
# Translators: The message announced when toggling the report alignment document formatting setting.
state = _("report alignment on")
config.conf["documentFormatting"]["reportAlignment"]=True
ui.message(state)
# Translators: Input help mode message for toggle report alignment command.
script_toggleReportAlignment.__doc__=_("Toggles on and off the reporting of text alignment")
script_toggleReportAlignment.category=SCRCAT_DOCUMENTFORMATTING
def script_toggleReportStyle(self,gesture):
if config.conf["documentFormatting"]["reportStyle"]:
# Translators: The message announced when toggling the report style document formatting setting.
state = _("report style off")
config.conf["documentFormatting"]["reportStyle"]=False
else:
# Translators: The message announced when toggling the report style document formatting setting.
state = _("report style on")
config.conf["documentFormatting"]["reportStyle"]=True
ui.message(state)
# Translators: Input help mode message for toggle report style command.
script_toggleReportStyle.__doc__=_("Toggles on and off the reporting of style changes")
script_toggleReportStyle.category=SCRCAT_DOCUMENTFORMATTING
def script_toggleReportSpellingErrors(self,gesture):
if config.conf["documentFormatting"]["reportSpellingErrors"]:
# Translators: The message announced when toggling the report spelling errors document formatting setting.
state = _("report spelling errors off")
config.conf["documentFormatting"]["reportSpellingErrors"]=False
else:
# Translators: The message announced when toggling the report spelling errors document formatting setting.
state = _("report spelling errors on")
config.conf["documentFormatting"]["reportSpellingErrors"]=True
ui.message(state)
# Translators: Input help mode message for toggle report spelling errors command.
script_toggleReportSpellingErrors.__doc__=_("Toggles on and off the reporting of spelling errors")
script_toggleReportSpellingErrors.category=SCRCAT_DOCUMENTFORMATTING
def script_toggleReportPage(self,gesture):
if config.conf["documentFormatting"]["reportPage"]:
# Translators: The message announced when toggling the report pages document formatting setting.
state = _("report pages off")
config.conf["documentFormatting"]["reportPage"]=False
else:
# Translators: The message announced when toggling the report pages document formatting setting.
state = _("report pages on")
config.conf["documentFormatting"]["reportPage"]=True
ui.message(state)
# Translators: Input help mode message for toggle report pages command.
script_toggleReportPage.__doc__=_("Toggles on and off the reporting of pages")
script_toggleReportPage.category=SCRCAT_DOCUMENTFORMATTING
def script_toggleReportLineNumber(self,gesture):
if config.conf["documentFormatting"]["reportLineNumber"]:
# Translators: The message announced when toggling the report line numbers document formatting setting.
state = _("report line numbers off")
config.conf["documentFormatting"]["reportLineNumber"]=False
else:
# Translators: The message announced when toggling the report line numbers document formatting setting.
state = _("report line numbers on")
config.conf["documentFormatting"]["reportLineNumber"]=True
ui.message(state)
# Translators: Input help mode message for toggle report line numbers command.
script_toggleReportLineNumber.__doc__=_("Toggles on and off the reporting of line numbers")
script_toggleReportLineNumber.category=SCRCAT_DOCUMENTFORMATTING
def script_toggleReportLineIndentation(self,gesture):
lineIndentationSpeech = config.conf["documentFormatting"]["reportLineIndentation"]
lineIndentationTones = config.conf["documentFormatting"]["reportLineIndentationWithTones"]
if not lineIndentationSpeech and not lineIndentationTones:
# Translators: A message reported when cycling through line indentation settings.
ui.message(_("Report line indentation with speech"))
lineIndentationSpeech = True
elif lineIndentationSpeech and not lineIndentationTones:
# Translators: A message reported when cycling through line indentation settings.
ui.message(_("Report line indentation with tones"))
lineIndentationSpeech = False
lineIndentationTones = True
elif not lineIndentationSpeech and lineIndentationTones:
# Translators: A message reported when cycling through line indentation settings.
ui.message(_("Report line indentation with speech and tones"))
lineIndentationSpeech = True
else:
# Translators: A message reported when cycling through line indentation settings.
ui.message(_("Report line indentation off"))
lineIndentationSpeech = False
lineIndentationTones = False
config.conf["documentFormatting"]["reportLineIndentation"] = lineIndentationSpeech
config.conf["documentFormatting"]["reportLineIndentationWithTones"] = lineIndentationTones
# Translators: Input help mode message for toggle report line indentation command.
script_toggleReportLineIndentation.__doc__=_("Cycles through line indentation settings")
script_toggleReportLineIndentation.category=SCRCAT_DOCUMENTFORMATTING
def script_toggleReportParagraphIndentation(self,gesture):
if config.conf["documentFormatting"]["reportParagraphIndentation"]:
# Translators: The message announced when toggling the report paragraph indentation document formatting setting.
state = _("report paragraph indentation off")
config.conf["documentFormatting"]["reportParagraphIndentation"]=False
else:
# Translators: The message announced when toggling the report paragraph indentation document formatting setting.
state = _("report paragraph indentation on")
config.conf["documentFormatting"]["reportParagraphIndentation"]=True
ui.message(state)
# Translators: Input help mode message for toggle report paragraph indentation command.
script_toggleReportParagraphIndentation.__doc__=_("Toggles on and off the reporting of paragraph indentation")
script_toggleReportParagraphIndentation.category=SCRCAT_DOCUMENTFORMATTING
def script_toggleReportLineSpacing(self,gesture):
if config.conf["documentFormatting"]["reportLineSpacing"]:
# Translators: The message announced when toggling the report line spacing document formatting setting.
state = _("report line spacing off")
config.conf["documentFormatting"]["reportLineSpacing"]=False
else:
# Translators: The message announced when toggling the report line spacing document formatting setting.
state = _("report line spacing on")
config.conf["documentFormatting"]["reportLineSpacing"]=True
ui.message(state)
# Translators: Input help mode message for toggle report line spacing command.
script_toggleReportLineSpacing.__doc__=_("Toggles on and off the reporting of line spacing")
script_toggleReportLineSpacing.category=SCRCAT_DOCUMENTFORMATTING
def script_toggleReportTables(self,gesture):
if config.conf["documentFormatting"]["reportTables"]:
# Translators: The message announced when toggling the report tables document formatting setting.
state = _("report tables off")
config.conf["documentFormatting"]["reportTables"]=False
else:
# Translators: The message announced when toggling the report tables document formatting setting.
state = _("report tables on")
config.conf["documentFormatting"]["reportTables"]=True
ui.message(state)
# Translators: Input help mode message for toggle report tables command.
script_toggleReportTables.__doc__=_("Toggles on and off the reporting of tables")
script_toggleReportTables.category=SCRCAT_DOCUMENTFORMATTING
def script_toggleReportTableHeaders(self,gesture):
if config.conf["documentFormatting"]["reportTableHeaders"]:
# Translators: The message announced when toggling the report table row/column headers document formatting setting.
state = _("report table row and column headers off")
config.conf["documentFormatting"]["reportTableHeaders"]=False
else:
# Translators: The message announced when toggling the report table row/column headers document formatting setting.
state = _("report table row and column headers on")
config.conf["documentFormatting"]["reportTableHeaders"]=True
ui.message(state)
# Translators: Input help mode message for toggle report table row/column headers command.
script_toggleReportTableHeaders.__doc__=_("Toggles on and off the reporting of table row and column headers")
script_toggleReportTableHeaders.category=SCRCAT_DOCUMENTFORMATTING
def script_toggleReportTableCellCoords(self,gesture):
if config.conf["documentFormatting"]["reportTableCellCoords"]:
# Translators: The message announced when toggling the report table cell coordinates document formatting setting.
state = _("report table cell coordinates off")
config.conf["documentFormatting"]["reportTableCellCoords"]=False
else:
# Translators: The message announced when toggling the report table cell coordinates document formatting setting.
state = _("report table cell coordinates on")
config.conf["documentFormatting"]["reportTableCellCoords"]=True
ui.message(state)
# Translators: Input help mode message for toggle report table cell coordinates command.
script_toggleReportTableCellCoords.__doc__=_("Toggles on and off the reporting of table cell coordinates")
script_toggleReportTableCellCoords.category=SCRCAT_DOCUMENTFORMATTING
def script_toggleReportLinks(self,gesture):
if config.conf["documentFormatting"]["reportLinks"]:
# Translators: The message announced when toggling the report links document formatting setting.
state = _("report links off")
config.conf["documentFormatting"]["reportLinks"]=False
else:
# Translators: The message announced when toggling the report links document formatting setting.
state = _("report links on")
config.conf["documentFormatting"]["reportLinks"]=True
ui.message(state)
# Translators: Input help mode message for toggle report links command.
script_toggleReportLinks.__doc__=_("Toggles on and off the reporting of links")
script_toggleReportLinks.category=SCRCAT_DOCUMENTFORMATTING
def script_toggleReportComments(self,gesture):
if config.conf["documentFormatting"]["reportComments"]:
# Translators: The message announced when toggling the report comments document formatting setting.
state = _("report comments off")
config.conf["documentFormatting"]["reportComments"]=False
else:
# Translators: The message announced when toggling the report comments document formatting setting.
state = _("report comments on")
config.conf["documentFormatting"]["reportComments"]=True
ui.message(state)
# Translators: Input help mode message for toggle report comments command.
script_toggleReportComments.__doc__=_("Toggles on and off the reporting of comments")
script_toggleReportComments.category=SCRCAT_DOCUMENTFORMATTING
def script_toggleReportLists(self,gesture):
if config.conf["documentFormatting"]["reportLists"]:
# Translators: The message announced when toggling the report lists document formatting setting.
state = _("report lists off")
config.conf["documentFormatting"]["reportLists"]=False
else:
# Translators: The message announced when toggling the report lists document formatting setting.
state = _("report lists on")
config.conf["documentFormatting"]["reportLists"]=True
ui.message(state)
# Translators: Input help mode message for toggle report lists command.
script_toggleReportLists.__doc__=_("Toggles on and off the reporting of lists")
script_toggleReportLists.category=SCRCAT_DOCUMENTFORMATTING
def script_toggleReportHeadings(self,gesture):
if config.conf["documentFormatting"]["reportHeadings"]:
# Translators: The message announced when toggling the report headings document formatting setting.
state = _("report headings off")
config.conf["documentFormatting"]["reportHeadings"]=False
else:
# Translators: The message announced when toggling the report headings document formatting setting.
state = _("report headings on")
config.conf["documentFormatting"]["reportHeadings"]=True
ui.message(state)
# Translators: Input help mode message for toggle report headings command.
script_toggleReportHeadings.__doc__=_("Toggles on and off the reporting of headings")
script_toggleReportHeadings.category=SCRCAT_DOCUMENTFORMATTING
def script_toggleReportBlockQuotes(self,gesture):
if config.conf["documentFormatting"]["reportBlockQuotes"]:
# Translators: The message announced when toggling the report block quotes document formatting setting.
state = _("report block quotes off")
config.conf["documentFormatting"]["reportBlockQuotes"]=False
else:
# Translators: The message announced when toggling the report block quotes document formatting setting.
state = _("report block quotes on")
config.conf["documentFormatting"]["reportBlockQuotes"]=True
ui.message(state)
# Translators: Input help mode message for toggle report block quotes command.
script_toggleReportBlockQuotes.__doc__=_("Toggles on and off the reporting of block quotes")
script_toggleReportBlockQuotes.category=SCRCAT_DOCUMENTFORMATTING
def script_toggleReportLandmarks(self,gesture):
if config.conf["documentFormatting"]["reportLandmarks"]:
# Translators: The message announced when toggling the report landmarks document formatting setting.
state = _("report landmarks off")
config.conf["documentFormatting"]["reportLandmarks"]=False
else:
# Translators: The message announced when toggling the report landmarks document formatting setting.
state = _("report landmarks on")
config.conf["documentFormatting"]["reportLandmarks"]=True
ui.message(state)
# Translators: Input help mode message for toggle report landmarks command.
script_toggleReportLandmarks.__doc__=_("Toggles on and off the reporting of landmarks")
script_toggleReportLandmarks.category=SCRCAT_DOCUMENTFORMATTING
def script_toggleReportFrames(self,gesture):
if config.conf["documentFormatting"]["reportFrames"]:
# Translators: The message announced when toggling the report frames document formatting setting.
state = _("report frames off")
config.conf["documentFormatting"]["reportFrames"]=False
else:
# Translators: The message announced when toggling the report frames document formatting setting.
state = _("report frames on")
config.conf["documentFormatting"]["reportFrames"]=True
ui.message(state)
# Translators: Input help mode message for toggle report frames command.
script_toggleReportFrames.__doc__=_("Toggles on and off the reporting of frames")
script_toggleReportFrames.category=SCRCAT_DOCUMENTFORMATTING
def script_toggleReportClickable(self,gesture):
if config.conf["documentFormatting"]["reportClickable"]:
# Translators: The message announced when toggling the report if clickable document formatting setting.
state = _("report if clickable off")
config.conf["documentFormatting"]["reportClickable"]=False
else:
# Translators: The message announced when toggling the report if clickable document formatting setting.
state = _("report if clickable on")
config.conf["documentFormatting"]["reportClickable"]=True
ui.message(state)
# Translators: Input help mode message for toggle report if clickable command.
script_toggleReportClickable.__doc__=_("Toggles on and off reporting if clickable")
script_toggleReportClickable.category=SCRCAT_DOCUMENTFORMATTING
def script_cycleSpeechSymbolLevel(self,gesture):
curLevel = config.conf["speech"]["symbolLevel"]
for level in characterProcessing.CONFIGURABLE_SPEECH_SYMBOL_LEVELS:
if level > curLevel:
break
else:
level = characterProcessing.SYMLVL_NONE
name = characterProcessing.SPEECH_SYMBOL_LEVEL_LABELS[level]
config.conf["speech"]["symbolLevel"] = level
# Translators: Reported when the user cycles through speech symbol levels
# which determine what symbols are spoken.
# %s will be replaced with the symbol level; e.g. none, some, most and all.
ui.message(_("Symbol level %s") % name)
# Translators: Input help mode message for cycle speech symbol level command.
script_cycleSpeechSymbolLevel.__doc__=_("Cycles through speech symbol levels which determine what symbols are spoken")
script_cycleSpeechSymbolLevel.category=SCRCAT_SPEECH
def script_moveMouseToNavigatorObject(self,gesture):
try:
p=api.getReviewPosition().pointAtStart
except (NotImplementedError, LookupError):
p=None
if p:
x=p.x
y=p.y
else:
try:
(left,top,width,height)=api.getNavigatorObject().location
except:
# Translators: Reported when the object has no location for the mouse to move to it.
ui.message(_("Object has no location"))
return
x=left+(width/2)
y=top+(height/2)
winUser.setCursorPos(x,y)
mouseHandler.executeMouseMoveEvent(x,y)
# Translators: Input help mode message for move mouse to navigator object command.
script_moveMouseToNavigatorObject.__doc__=_("Moves the mouse pointer to the current navigator object")
script_moveMouseToNavigatorObject.category=SCRCAT_MOUSE
def script_moveNavigatorObjectToMouse(self,gesture):
# Translators: Reported when attempting to move the navigator object to the object under mouse pointer.
ui.message(_("Move navigator object to mouse"))
obj=api.getMouseObject()
api.setNavigatorObject(obj)
speech.speakObject(obj)
# Translators: Input help mode message for move navigator object to mouse command.
script_moveNavigatorObjectToMouse.__doc__=_("Sets the navigator object to the current object under the mouse pointer and speaks it")
script_moveNavigatorObjectToMouse.category=SCRCAT_MOUSE
def script_reviewMode_next(self,gesture):
label=review.nextMode()
if label:
ui.reviewMessage(label)
pos=api.getReviewPosition().copy()
pos.expand(textInfos.UNIT_LINE)
braille.handler.setTether(braille.handler.TETHER_REVIEW, auto=True)
speech.speakTextInfo(pos)
else:
# Translators: reported when there are no other available review modes for this object
ui.reviewMessage(_("No next review mode"))
# Translators: Script help message for next review mode command.
script_reviewMode_next.__doc__=_("Switches to the next review mode (e.g. object, document or screen) and positions the review position at the point of the navigator object")
script_reviewMode_next.category=SCRCAT_TEXTREVIEW
def script_reviewMode_previous(self,gesture):
label=review.nextMode(prev=True)
if label:
ui.reviewMessage(label)
pos=api.getReviewPosition().copy()
pos.expand(textInfos.UNIT_LINE)
braille.handler.setTether(braille.handler.TETHER_REVIEW, auto=True)
speech.speakTextInfo(pos)
else:
# Translators: reported when there are no other available review modes for this object
ui.reviewMessage(_("No previous review mode"))
# Translators: Script help message for previous review mode command.
script_reviewMode_previous.__doc__=_("Switches to the previous review mode (e.g. object, document or screen) and positions the review position at the point of the navigator object")
script_reviewMode_previous.category=SCRCAT_TEXTREVIEW
def script_toggleSimpleReviewMode(self,gesture):
if config.conf["reviewCursor"]["simpleReviewMode"]:
# Translators: The message announced when toggling simple review mode.
state = _("Simple review mode off")
config.conf["reviewCursor"]["simpleReviewMode"]=False
else:
# Translators: The message announced when toggling simple review mode.
state = _("Simple review mode on")
config.conf["reviewCursor"]["simpleReviewMode"]=True
ui.message(state)
# Translators: Input help mode message for toggle simple review mode command.
script_toggleSimpleReviewMode.__doc__=_("Toggles simple review mode on and off")
script_toggleSimpleReviewMode.category=SCRCAT_OBJECTNAVIGATION
def script_navigatorObject_current(self,gesture):
curObject=api.getNavigatorObject()
if not isinstance(curObject,NVDAObject):
# Translators: Reported when the user tries to perform a command related to the navigator object
# but there is no current navigator object.
ui.reviewMessage(_("No navigator object"))
return
if scriptHandler.getLastScriptRepeatCount()>=1:
if curObject.TextInfo!=NVDAObjectTextInfo:
textList=[]
if curObject.name and isinstance(curObject.name, basestring) and not curObject.name.isspace():
textList.append(curObject.name)
try:
info=curObject.makeTextInfo(textInfos.POSITION_SELECTION)
if not info.isCollapsed:
textList.append(info.text)
else:
info.expand(textInfos.UNIT_LINE)
if not info.isCollapsed:
textList.append(info.text)
except (RuntimeError, NotImplementedError):
# No caret or selection on this object.
pass
else:
textList=[prop for prop in (curObject.name, curObject.value) if prop and isinstance(prop, basestring) and not prop.isspace()]
text=" ".join(textList)
if len(text)>0 and not text.isspace():
if scriptHandler.getLastScriptRepeatCount()==1:
speech.speakSpelling(text)
else:
if api.copyToClip(text):
# Translators: Indicates something has been copied to clipboard (example output: title text copied to clipboard).
speech.speakMessage(_("%s copied to clipboard")%text)
else:
speech.speakObject(curObject,reason=controlTypes.REASON_QUERY)
# Translators: Input help mode message for report current navigator object command.
script_navigatorObject_current.__doc__=_("Reports the current navigator object. Pressing twice spells this information, and pressing three times Copies name and value of this object to the clipboard")
script_navigatorObject_current.category=SCRCAT_OBJECTNAVIGATION
def script_navigatorObject_currentDimensions(self,gesture):
count=scriptHandler.getLastScriptRepeatCount()
locationText=api.getReviewPosition().locationText if count==0 else None
if not locationText:
locationText=api.getNavigatorObject().locationText
if not locationText:
# Translators: message when there is no location information for the review cursor
ui.message(_("No location information"))
return
ui.message(locationText)
# Translators: Description for report review cursor location command.
script_navigatorObject_currentDimensions.__doc__=_("Reports information about the location of the text or object at the review cursor. Pressing twice may provide further detail.")
script_navigatorObject_currentDimensions.category=SCRCAT_OBJECTNAVIGATION
def script_navigatorObject_toFocus(self,gesture):
obj=api.getFocusObject()
try:
pos=obj.makeTextInfo(textInfos.POSITION_CARET)
except (NotImplementedError,RuntimeError):
pos=obj.makeTextInfo(textInfos.POSITION_FIRST)
api.setReviewPosition(pos)
# Translators: Reported when attempting to move the navigator object to focus.
speech.speakMessage(_("Move to focus"))
speech.speakObject(obj,reason=controlTypes.REASON_FOCUS)
# Translators: Input help mode message for move navigator object to current focus command.
script_navigatorObject_toFocus.__doc__=_("Sets the navigator object to the current focus, and the review cursor to the position of the caret inside it, if possible.")
script_navigatorObject_toFocus.category=SCRCAT_OBJECTNAVIGATION
def script_navigatorObject_moveFocus(self,gesture):
obj=api.getNavigatorObject()
if not isinstance(obj,NVDAObject):
# Translators: Reported when:
# 1. There is no focusable object e.g. cannot use tab and shift tab to move to controls.
# 2. Trying to move focus to navigator object but there is no focus.
ui.message(_("No focus"))
if scriptHandler.getLastScriptRepeatCount()==0:
# Translators: Reported when attempting to move focus to navigator object.
ui.message(_("Move focus"))
obj.setFocus()
else:
review=api.getReviewPosition()
try:
review.updateCaret()
except NotImplementedError:
# Translators: Reported when trying to move caret to the position of the review cursor but there is no caret.
ui.message(_("No caret"))
return
info=review.copy()
info.expand(textInfos.UNIT_LINE)
speech.speakTextInfo(info,reason=controlTypes.REASON_CARET)
# Translators: Input help mode message for move focus to current navigator object command.
script_navigatorObject_moveFocus.__doc__=_("Pressed once sets the keyboard focus to the navigator object, pressed twice sets the system caret to the position of the review cursor")
script_navigatorObject_moveFocus.category=SCRCAT_OBJECTNAVIGATION
def script_navigatorObject_parent(self,gesture):
curObject=api.getNavigatorObject()
if not isinstance(curObject,NVDAObject):
# Translators: Reported when the user tries to perform a command related to the navigator object
# but there is no current navigator object.
ui.reviewMessage(_("No navigator object"))
return
simpleReviewMode=config.conf["reviewCursor"]["simpleReviewMode"]
curObject=curObject.simpleParent if simpleReviewMode else curObject.parent
if curObject is not None:
api.setNavigatorObject(curObject)
speech.speakObject(curObject,reason=controlTypes.REASON_FOCUS)
else:
# Translators: Reported when there is no containing (parent) object such as when focused on desktop.
ui.reviewMessage(_("No containing object"))
# Translators: Input help mode message for move to parent object command.
script_navigatorObject_parent.__doc__=_("Moves the navigator object to the object containing it")
script_navigatorObject_parent.category=SCRCAT_OBJECTNAVIGATION
def script_navigatorObject_next(self,gesture):
curObject=api.getNavigatorObject()
if not isinstance(curObject,NVDAObject):
# Translators: Reported when the user tries to perform a command related to the navigator object
# but there is no current navigator object.
ui.reviewMessage(_("No navigator object"))
return
simpleReviewMode=config.conf["reviewCursor"]["simpleReviewMode"]
curObject=curObject.simpleNext if simpleReviewMode else curObject.next
if curObject is not None:
api.setNavigatorObject(curObject)
speech.speakObject(curObject,reason=controlTypes.REASON_FOCUS)
else:
# Translators: Reported when there is no next object (current object is the last object).
ui.reviewMessage(_("No next"))
# Translators: Input help mode message for move to next object command.
script_navigatorObject_next.__doc__=_("Moves the navigator object to the next object")
script_navigatorObject_next.category=SCRCAT_OBJECTNAVIGATION
def script_navigatorObject_previous(self,gesture):
curObject=api.getNavigatorObject()
if not isinstance(curObject,NVDAObject):
# Translators: Reported when the user tries to perform a command related to the navigator object
# but there is no current navigator object.
ui.reviewMessage(_("No navigator object"))
return
simpleReviewMode=config.conf["reviewCursor"]["simpleReviewMode"]
curObject=curObject.simplePrevious if simpleReviewMode else curObject.previous
if curObject is not None:
api.setNavigatorObject(curObject)
speech.speakObject(curObject,reason=controlTypes.REASON_FOCUS)
else:
# Translators: Reported when there is no previous object (current object is the first object).
ui.reviewMessage(_("No previous"))
# Translators: Input help mode message for move to previous object command.
script_navigatorObject_previous.__doc__=_("Moves the navigator object to the previous object")
script_navigatorObject_previous.category=SCRCAT_OBJECTNAVIGATION
def script_navigatorObject_firstChild(self,gesture):
curObject=api.getNavigatorObject()
if not isinstance(curObject,NVDAObject):
# Translators: Reported when the user tries to perform a command related to the navigator object
# but there is no current navigator object.
ui.reviewMessage(_("No navigator object"))
return
simpleReviewMode=config.conf["reviewCursor"]["simpleReviewMode"]
curObject=curObject.simpleFirstChild if simpleReviewMode else curObject.firstChild
if curObject is not None:
api.setNavigatorObject(curObject)
speech.speakObject(curObject,reason=controlTypes.REASON_FOCUS)
else:
# Translators: Reported when there is no contained (first child) object such as inside a document.
ui.reviewMessage(_("No objects inside"))
# Translators: Input help mode message for move to first child object command.
script_navigatorObject_firstChild.__doc__=_("Moves the navigator object to the first object inside it")
script_navigatorObject_firstChild.category=SCRCAT_OBJECTNAVIGATION
def script_review_activate(self,gesture):
# Translators: a message reported when the action at the position of the review cursor or navigator object is performed.
actionName=_("Activate")
pos=api.getReviewPosition()
try:
pos.activate()
if isinstance(gesture,touchHandler.TouchInputGesture):
touchHandler.handler.notifyInteraction(pos.NVDAObjectAtStart)
ui.message(actionName)
return
except NotImplementedError:
pass
obj=api.getNavigatorObject()
while obj:
realActionName=actionName
try:
realActionName=obj.getActionName()
except:
pass
try:
obj.doAction()
if isinstance(gesture,touchHandler.TouchInputGesture):
touchHandler.handler.notifyInteraction(obj)
ui.message(realActionName)
return
except NotImplementedError:
pass
obj=obj.parent
# Translators: the message reported when there is no action to perform on the review position or navigator object.
ui.message(_("No action"))
# Translators: Input help mode message for activate current object command.
script_review_activate.__doc__=_("Performs the default action on the current navigator object (example: presses it if it is a button).")
script_review_activate.category=SCRCAT_OBJECTNAVIGATION
def script_review_top(self,gesture):
info=api.getReviewPosition().obj.makeTextInfo(textInfos.POSITION_FIRST)
api.setReviewPosition(info)
info.expand(textInfos.UNIT_LINE)
ui.reviewMessage(_("Top"))
speech.speakTextInfo(info,unit=textInfos.UNIT_LINE,reason=controlTypes.REASON_CARET)
# Translators: Input help mode message for move review cursor to top line command.
script_review_top.__doc__=_("Moves the review cursor to the top line of the current navigator object and speaks it")
script_review_top.category=SCRCAT_TEXTREVIEW
def script_review_previousLine(self,gesture):
info=api.getReviewPosition().copy()
if info._expandCollapseBeforeReview:
info.expand(textInfos.UNIT_LINE)
info.collapse()
res=info.move(textInfos.UNIT_LINE,-1)
if res==0:
# Translators: a message reported when review cursor is at the top line of the current navigator object.
ui.reviewMessage(_("Top"))
else:
api.setReviewPosition(info)
info.expand(textInfos.UNIT_LINE)
speech.speakTextInfo(info,unit=textInfos.UNIT_LINE,reason=controlTypes.REASON_CARET)
# Translators: Input help mode message for move review cursor to previous line command.
script_review_previousLine.__doc__=_("Moves the review cursor to the previous line of the current navigator object and speaks it")
script_review_previousLine.resumeSayAllMode=sayAllHandler.CURSOR_REVIEW