fixed list of settings in config panel
This commit is contained in:
parent
a42e696695
commit
3cd0665166
|
@ -76,6 +76,10 @@ def error(window, title, text):
|
||||||
m.destroy()
|
m.destroy()
|
||||||
|
|
||||||
|
|
||||||
|
def remove_children(container):
|
||||||
|
container.foreach(lambda x, _: container.remove(x), None)
|
||||||
|
|
||||||
|
|
||||||
# def find_children(container, *child_names):
|
# def find_children(container, *child_names):
|
||||||
# assert container is not None
|
# assert container is not None
|
||||||
# assert isinstance(container, Gtk.Container)
|
# assert isinstance(container, Gtk.Container)
|
||||||
|
|
|
@ -6,6 +6,7 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
||||||
|
|
||||||
from gi.repository import Gtk, GObject
|
from gi.repository import Gtk, GObject
|
||||||
|
|
||||||
|
import ui
|
||||||
from logitech.unifying_receiver import settings as _settings
|
from logitech.unifying_receiver import settings as _settings
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -150,6 +151,15 @@ def _update_setting_item(sbox, value):
|
||||||
raise NotImplemented
|
raise NotImplemented
|
||||||
control.set_sensitive(True)
|
control.set_sensitive(True)
|
||||||
|
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
def create():
|
||||||
|
b = Gtk.VBox(homogeneous=False, spacing=4)
|
||||||
|
b.set_property('margin', 8)
|
||||||
|
return b
|
||||||
|
|
||||||
|
|
||||||
def update(frame):
|
def update(frame):
|
||||||
box = frame._config_box
|
box = frame._config_box
|
||||||
|
@ -159,7 +169,7 @@ def update(frame):
|
||||||
if device is None:
|
if device is None:
|
||||||
# remove all settings widgets
|
# remove all settings widgets
|
||||||
# if another device gets paired here, it will add its own widgets
|
# if another device gets paired here, it will add its own widgets
|
||||||
box.foreach(lambda x, _: box.remove(x), None)
|
ui.remove_children(box)
|
||||||
return
|
return
|
||||||
|
|
||||||
if not box.get_visible():
|
if not box.get_visible():
|
||||||
|
@ -172,15 +182,12 @@ def update(frame):
|
||||||
|
|
||||||
force_read = False
|
force_read = False
|
||||||
items = box.get_children()
|
items = box.get_children()
|
||||||
if not items:
|
if len(device.settings) != len(items):
|
||||||
|
ui.remove_children(box)
|
||||||
if device.status:
|
if device.status:
|
||||||
items = list(_add_settings(box, device))
|
items = list(_add_settings(box, device))
|
||||||
assert len(device.settings) == len(items)
|
assert len(device.settings) == len(items)
|
||||||
force_read = True
|
force_read = True
|
||||||
else:
|
|
||||||
# don't bother adding settings for offline devices,
|
|
||||||
# they're useless and might not guess all of them anyway
|
|
||||||
return
|
|
||||||
|
|
||||||
device_active = bool(device.status)
|
device_active = bool(device.status)
|
||||||
# if the device just became active, re-read the settings
|
# if the device just became active, re-read the settings
|
||||||
|
|
|
@ -218,10 +218,8 @@ def _make_device_box(index):
|
||||||
vbox.pack_start(Gtk.HSeparator(), False, False, 0)
|
vbox.pack_start(Gtk.HSeparator(), False, False, 0)
|
||||||
vbox.pack_start(info_label, False, False, 0)
|
vbox.pack_start(info_label, False, False, 0)
|
||||||
|
|
||||||
config_box = Gtk.VBox(homogeneous=False, spacing=4)
|
frame._config_box = _config_panel.create()
|
||||||
config_box.set_property('margin', 8)
|
vbox.pack_start(frame._config_box, False, False, 0)
|
||||||
vbox.pack_start(config_box, False, False, 0)
|
|
||||||
frame._config_box = config_box
|
|
||||||
|
|
||||||
unpair = Gtk.Button('Unpair')
|
unpair = Gtk.Button('Unpair')
|
||||||
unpair.set_image(Gtk.Image.new_from_icon_name('edit-delete', Gtk.IconSize.BUTTON))
|
unpair.set_image(Gtk.Image.new_from_icon_name('edit-delete', Gtk.IconSize.BUTTON))
|
||||||
|
|
Loading…
Reference in New Issue