Skip to content

Commit

Permalink
fix minor bug in synth settings ring (nvaccess#16153)
Browse files Browse the repository at this point in the history
Summary of the issue:
_set_currentSettingValue had invalid syntax, with two symbols not being referenced correctly
The function is currently not used in NVDA core, so the bug went unnoticed

Description of user facing changes
None

Description of development approach
Use correct references for symbols.

linting and typing fixes
  • Loading branch information
seanbudd authored and Adriani90 committed Mar 13, 2024
1 parent 0bdb170 commit 3f74cbd
Showing 1 changed file with 17 additions and 7 deletions.
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

0 comments on commit 3f74cbd

Please sign in to comment.