Skip to content

Commit 582669b

Browse files
authored
Merge 05e4557 into e71916d
2 parents e71916d + 05e4557 commit 582669b

2 files changed

Lines changed: 102 additions & 1 deletion

File tree

source/globalCommands.py

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,36 @@ def script_dateTime(self,gesture):
312312
text=winKernel.GetDateFormatEx(winKernel.LOCALE_NAME_USER_DEFAULT, winKernel.DATE_LONGDATE, None, None)
313313
ui.message(text)
314314

315+
@script(
316+
# Translators: Input help mode message for set the first value in the synth ring setting.
317+
description=_("Set the first value of the current setting in the synth settings ring"),
318+
category=SCRCAT_SPEECH,
319+
gestures=("kb(desktop):NVDA+control+home", "kb(laptop):NVDA+shift+control+home")
320+
)
321+
def script_FirstValueSynthRing(self, gesture):
322+
settingName = globalVars.settingsRing.currentSettingName
323+
if not settingName:
324+
# Translators: Reported when there are no settings to configure in synth settings ring
325+
# Translators: (example: when there is no setting for language).
326+
ui.message(_("No settings"))
327+
return
328+
settingValue = globalVars.settingsRing.first()
329+
ui.message("%s %s" % (settingName, settingValue))
330+
331+
@script(
332+
# Translators: Input help mode message for set the last value in the synth ring settings.
333+
description=_("Set the last value of the current setting in the synth settings ring"),
334+
category=SCRCAT_SPEECH,
335+
gestures=("kb(desktop):NVDA+control+end", "kb(laptop):NVDA+shift+control+end")
336+
)
337+
def script_LastValueSynthRing(self, gesture):
338+
settingName = globalVars.settingsRing.currentSettingName
339+
if not settingName:
340+
ui.message(_("No settings"))
341+
return
342+
settingValue = globalVars.settingsRing.last()
343+
ui.message("%s %s" % (settingName, settingValue))
344+
315345
@script(
316346
# Translators: Input help mode message for increase synth setting value command.
317347
description=_("Increases the currently active setting in the synth settings ring"),
@@ -321,12 +351,25 @@ def script_dateTime(self,gesture):
321351
def script_increaseSynthSetting(self,gesture):
322352
settingName=globalVars.settingsRing.currentSettingName
323353
if not settingName:
324-
# Translators: Reported when there are no settings to configure in synth settings ring (example: when there is no setting for language).
325354
ui.message(_("No settings"))
326355
return
327356
settingValue=globalVars.settingsRing.increase()
328357
ui.message("%s %s" % (settingName,settingValue))
329358

359+
@script(
360+
# Translators: Input help mode message for quick jump between values forward in the synth settings ring.
361+
description=_("Jumps forward the value of the current active setting in the synth settings ring"),
362+
category=SCRCAT_SPEECH,
363+
gestures=("kb(desktop):NVDA+control+pageUp", "kb(laptop):NVDA+shift+control+pageUp")
364+
)
365+
def script_jumpForwardSynthSetting(self, gesture):
366+
settingName = globalVars.settingsRing.currentSettingName
367+
if not settingName:
368+
ui.message(_("No settings"))
369+
return
370+
settingValue = globalVars.settingsRing.increase_4x()
371+
ui.message("%s %s" % (settingName, settingValue))
372+
330373
@script(
331374
# Translators: Input help mode message for decrease synth setting value command.
332375
description=_("Decreases the currently active setting in the synth settings ring"),
@@ -341,6 +384,20 @@ def script_decreaseSynthSetting(self,gesture):
341384
settingValue=globalVars.settingsRing.decrease()
342385
ui.message("%s %s" % (settingName,settingValue))
343386

387+
@script(
388+
# Translators: Input help mode message for quick jump between values backward in the synth settings ring.
389+
description=_("Jumps backward the value of the current active setting in the synth settings ring"),
390+
category=SCRCAT_SPEECH,
391+
gestures=("kb(desktop):NVDA+control+pageDown", "kb(laptop):NVDA+control+shift+pageDown")
392+
)
393+
def script_jumpBackwardSynthSetting(self, gesture):
394+
settingName = globalVars.settingsRing.currentSettingName
395+
if not settingName:
396+
ui.message(_("No settings"))
397+
return
398+
settingValue = globalVars.settingsRing.decrease_4x()
399+
ui.message("%s %s" % (settingName, settingValue))
400+
344401
@script(
345402
# Translators: Input help mode message for next synth setting command.
346403
description=_("Moves to the next available setting in the synth settings ring"),

source/synthSettingsRing.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,36 @@ def __init__(self,synth,setting,min=0,max=100):
1414
self.max = setting.maxVal if isinstance(setting, NumericDriverSetting) else max
1515
self.step = setting.normalStep if isinstance(setting, NumericDriverSetting) else 1
1616

17+
def first(self):
18+
val = self.min
19+
self.value = val
20+
return self._getReportValue(val)
21+
22+
def last(self):
23+
val = self.max
24+
self.value = val
25+
return self._getReportValue(val)
26+
1727
def increase(self):
1828
val = min(self.max,self.value+self.step)
1929
self.value = val
2030
return self._getReportValue(val)
2131

32+
def increase_4x(self):
33+
val = min(self.max,self.value+self.step*4)
34+
self.value = val
35+
return self._getReportValue(val)
36+
2237
def decrease(self):
2338
val = max(self.min,self.value-self.step)
2439
self.value = val
2540
return self._getReportValue(val)
2641

42+
def decrease_4x(self):
43+
val = max(self.min,self.value-self.step*4)
44+
self.value = val
45+
return self._getReportValue(val)
46+
2747
def _get_value(self):
2848
return getattr(self.synth,self.setting.id)
2949

@@ -124,18 +144,42 @@ def previous(self):
124144
return self.currentSettingName
125145
return None
126146

147+
def first(self):
148+
""" set the current setting to the first value """
149+
if self._current is not None:
150+
return self.settings[self._current].first()
151+
return None
152+
153+
def last(self):
154+
""" set the current setting to the last value """
155+
if self._current is not None:
156+
return self.settings[self._current].last()
157+
return None
158+
127159
def increase(self):
128160
""" increases the currentSetting and returns its new value """
129161
if self._current is not None:
130162
return self.settings[self._current].increase()
131163
return None
132164

165+
def increase_4x(self):
166+
""" increases the currentSetting (by a multiplier 4x, to quickly jump between options or values forward) and returns its new value """
167+
if self._current is not None:
168+
return self.settings[self._current].increase_4x()
169+
return None
170+
133171
def decrease(self):
134172
""" decreases the currentSetting and returns its new value """
135173
if self._current is not None:
136174
return self.settings[self._current].decrease()
137175
return None
138176

177+
def decrease_4x(self):
178+
""" decreases the currentSetting (by a multiplier of 4x, to quickly jump between options or values backward) and returns its new value """
179+
if self._current is not None:
180+
return self.settings[self._current].decrease_4x()
181+
return None
182+
139183
def updateSupportedSettings(self,synth):
140184
import ui
141185
from scriptHandler import _isScriptRunning

0 commit comments

Comments
 (0)