Skip to content

Commit

Permalink
Mark model as changed during validation at init to fix timer loop in …
Browse files Browse the repository at this point in the history
…MainWindow
  • Loading branch information
s-simoncelli committed Feb 19, 2024
1 parent d29a6d5 commit e099e2e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pywr_editor/model/model_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ def check_missing_keys(self) -> None:
for key in ["nodes", "edges", "includes", "scenarios"]:
if key not in self.json:
self.json[key] = []
self.has_changed()

# check for missing keys with dictionary as value
for key in [
Expand All @@ -278,6 +279,7 @@ def check_missing_keys(self) -> None:
]:
if key not in self.json:
self.json[key] = {}
self.has_changed()

if (
Constants.SHAPES_KEY.value
Expand All @@ -286,6 +288,7 @@ def check_missing_keys(self) -> None:
self.json[Constants.EDITOR_CONFIG_KEY.value][
Constants.SHAPES_KEY.value
] = []
self.has_changed()

# check that the metadata dictionary and its key/value pairs are defined
default_metadata = {
Expand All @@ -298,6 +301,7 @@ def check_missing_keys(self) -> None:
self.json["metadata"][key], str
):
self.json["metadata"][key] = value
self.has_changed()

def is_valid(self) -> bool:
"""
Expand Down

0 comments on commit e099e2e

Please sign in to comment.