Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix minor bug in synth settings ring #16153

Merged
merged 2 commits into from
Feb 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions source/synthSettingsRing.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# 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-2024 NV Access Limited

from typing import Any

from autoSettingsUtils.driverSetting import BooleanDriverSetting, NumericDriverSetting
import baseObject
import config
import synthDriverHandler
import queueHandler
from autoSettingsUtils.driverSetting import BooleanDriverSetting, NumericDriverSetting
import synthDriverHandler


class SynthSetting(baseObject.AutoPropertyObject):
Expand Down Expand Up @@ -85,12 +92,15 @@ def _set_value(self, val):
def _getReportValue(self, val):
return _("on") if val else _("off")


class SynthSettingsRing(baseObject.AutoPropertyObject):
"""
A synth settings ring which enables the user to change to the next and previous settings and ajust the selected one
It was written to facilitate the implementation of a way to change the settings resembling the window-eyes way.
A synth settings ring which enables the user to change to the next and previous settings,
as well as adjust the selected one.
"""

settings: list[SynthSetting] | None

def __init__(self,synth):
try:
self._current = synth.initialSettingsRingSetting
Expand All @@ -107,9 +117,9 @@ def _get_currentSettingName(self):
def _get_currentSettingValue(self):
return self.settings[self._current].reportValue

def _set_currentSettingValue(self,value):
def _set_currentSettingValue(self, value: Any):
if self._current is not None:
self.settings[_current].value = val
self.settings[self._current].value = value

def next(self):
""" changes to the next setting and returns its name """
Expand Down Expand Up @@ -145,7 +155,7 @@ def updateSupportedSettings(self,synth):
if self._current is not None and hasattr(self,'settings')
else None
)
list = []
list: list[SynthSetting] = []
for s in synth.supportedSettings:
if not s.availableInSettingsRing: continue
if prevID == s.id: #restore the last setting
Expand Down