diff --git a/lib/logitech_receiver/diversion.py b/lib/logitech_receiver/diversion.py index 6735b51fa..fe39eb893 100644 --- a/lib/logitech_receiver/diversion.py +++ b/lib/logitech_receiver/diversion.py @@ -1508,7 +1508,7 @@ def __init__(self, yml_file_path: str, default_rules: Optional[Rule] = None): self._yml_file_path = yml_file_path self.rules = [] - def save_config(self) -> bool: + def save_config(self, user_rules: Rule) -> bool: """Writes user configured rules into a YAML file. Returns @@ -1523,7 +1523,7 @@ def blockseq_rep(dumper, data): yaml.add_representer(_inline_list, blockseq_rep) # Save only user-defined rules - rule_components = self.rules.components + rule_components = user_rules.components return _save_rule_config(self._yml_file_path, rule_components) def load_config(self) -> Rule: diff --git a/lib/solaar/ui/rules/model.py b/lib/solaar/ui/rules/model.py index c6172b665..99a21a72c 100644 --- a/lib/solaar/ui/rules/model.py +++ b/lib/solaar/ui/rules/model.py @@ -19,7 +19,7 @@ class RulesModel: - def __init__(self, load_rules_func: Callable[[], Any], save_rules_func: Callable[[], bool]): + def __init__(self, load_rules_func: Callable[[], Any], save_rules_func: Callable[[Any], bool]): self._load_rules = load_rules_func self._save_rules = save_rules_func @@ -49,7 +49,7 @@ def save_rules(self) -> bool: if not self.unsaved_changes: return True - success = self._save_rules() + success = self._save_rules(self.rules) if success: self.unsaved_changes = False return success