def init_enigma2_flags(self, flags): f_flags = list(filter(lambda x: x.startswith("f:"), flags)) if f_flags: value = int(f_flags[0][2:]) self._keep_check_button.set_active(Flag.is_keep(value)) self._hide_check_button.set_active(Flag.is_hide(value)) self._use_pids_check_button.set_active(Flag.is_pids(value)) self._new_check_button.set_active(Flag.is_new(value))
def set_hide(services, model, paths): col_num = 5 hide = has_locked_hide(model, paths, col_num) for path in paths: itr = model.get_iter(path) model.set_value(itr, col_num, None if hide else HIDE_ICON) flags = [*model.get_value(itr, 0).split(",")] index, flag = None, None for i, fl in enumerate(flags): if fl.startswith("f:"): index = i flag = fl break value = int(flag[2:]) if flag else 0 if not hide: if Flag.is_hide(value): continue # skip if already hidden value += Flag.HIDE.value else: if not Flag.is_hide(value): continue # skip if already allowed to show value -= Flag.HIDE.value if value == 0 and index is not None: del flags[index] else: value = "f:{:02d}".format(value) if index is not None: flags[index] = value else: flags.append(value) model.set_value(itr, 0, (",".join(reversed(sorted(flags))))) fav_id = model.get_value(itr, 18) srv = services.get(fav_id, None) if srv: services[fav_id] = srv._replace(hide=None if hide else HIDE_ICON)