Skip to content

Commit

Permalink
Fix initial save
Browse files Browse the repository at this point in the history
  • Loading branch information
MattHag committed May 27, 2024
1 parent 3d74693 commit 0782707
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/logitech_receiver/diversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions lib/solaar/ui/rules/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

0 comments on commit 0782707

Please sign in to comment.