ui: only produce warning for unimplemented display of setting

This commit is contained in:
Peter F. Patel-Schneider 2022-06-07 09:57:14 -04:00
parent ec0e304fdc
commit c9810e606e
1 changed files with 13 additions and 2 deletions

View File

@ -18,6 +18,8 @@
import traceback import traceback
from logging import WARNING as _WARNING
from logging import getLogger
from threading import Timer as _Timer from threading import Timer as _Timer
from gi.repository import Gdk, GLib, Gtk from gi.repository import Gdk, GLib, Gtk
@ -26,6 +28,9 @@ from logitech_receiver.settings import SENSITIVITY_IGNORE as _SENSITIVITY_IGNORE
from solaar.i18n import _, ngettext from solaar.i18n import _, ngettext
from solaar.ui import ui_async as _ui_async from solaar.ui import ui_async as _ui_async
_log = getLogger(__name__)
del getLogger
# #
# #
# #
@ -538,7 +543,10 @@ def _create_sbox(s, device):
elif s.kind == _SETTING_KIND.multiple_range: elif s.kind == _SETTING_KIND.multiple_range:
control = MultipleRangeControl(sbox, change) control = MultipleRangeControl(sbox, change)
else: else:
raise Exception('NotImplemented') if _log.isEnabledFor(_WARNING):
_log.warn('setting %s display not implemented', s.label)
return None
control.set_sensitive(False) # the first read will enable it control.set_sensitive(False) # the first read will enable it
control.layout(sbox, label, change, spinner, failed) control.layout(sbox, label, change, spinner, failed)
sbox._control = control sbox._control = control
@ -610,7 +618,10 @@ def update(device, is_online=None):
if k in _items: if k in _items:
sbox = _items[k] sbox = _items[k]
else: else:
sbox = _items[k] = _create_sbox(s, device) sbox = _create_sbox(s, device)
if sbox is None:
continue
_items[k] = sbox
_box.pack_start(sbox, False, False, 0) _box.pack_start(sbox, False, False, 0)
sensitive = device.persister.get_sensitivity(s.name) if device.persister else True sensitive = device.persister.get_sensitivity(s.name) if device.persister else True
_read_async(s, False, sbox, is_online, sensitive) _read_async(s, False, sbox, is_online, sensitive)