ui: build item with all sub-items for multiple range settings

This commit is contained in:
Vinícius 2022-01-20 11:26:34 -03:00 committed by Peter F. Patel-Schneider
parent b9a23f133e
commit f5831cbda7
1 changed files with 7 additions and 3 deletions

View File

@ -440,11 +440,15 @@ class MultipleRangeControl(Gtk.ListBox, MultipleControl):
to_join = []
for c in ch._sub_items:
sub_item = c._setting_sub_item
c._control.set_value(v[str(sub_item)])
try:
sub_item_value = v[str(sub_item)]
except KeyError:
sub_item_value = c._control.get_value()
c._control.set_value(sub_item_value)
n += 1
to_join.append(str(sub_item) + f'={v[str(sub_item)]}')
to_join.append(str(sub_item) + f'={sub_item_value}')
b += ', '.join(to_join) + ') '
lbl_text = ngettext('%d value', '%d values', n) % n
lbl_text = ngettext('%d value', '%d values', n) % n
self._button.set_label(lbl_text)
self._button.set_tooltip_text(b)