Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
8 changes: 7 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
from pywr_editor import app
import multiprocessing

if __name__ == "__main__":
# fix infinite loop - https://github.com/pyinstaller/pyinstaller/wiki/Recipe-Multiprocessing # noqa:E501
multiprocessing.freeze_support()
multiprocessing.set_start_method("spawn", force=True)

from pywr_editor import app

app()
9 changes: 6 additions & 3 deletions main.spec
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ a = Analysis(
"PySide6.QtSvg",
"PySide6.QtAxContainer",
"PySide6.QtSvgWidgets",
"inspector_dialog",
"matplotlib",
"numpy",
],
hookspath=[],
hooksconfig={},
Expand Down Expand Up @@ -85,6 +88,6 @@ coll = COLLECT(

# PyInstaller does not want to copy the following files/folder in the data attr
shutil.copytree(pywr_dist.as_posix(), f"./dist/main/{pywr_dist.name}")
shutil.copyfile(
Path(tables.__file__).parent / "libblosc2.dll", "./dist/main/tables/libblosc2.dll"
)
#shutil.copyfile(
# Path(tables.__file__).parent / "libblosc2.dll", "./dist/main/tables/libblosc2.dll"
#)
2 changes: 2 additions & 0 deletions pywr_editor/model/model_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,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 @@ -287,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 Down
2 changes: 1 addition & 1 deletion tests/dialogs/test_dialog_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ def test_valid_table_file(self, qtbot, table_name):
# 5. Save form to test filter
save_button: QPushButton = selected_page.findChild(QPushButton, "save_button")
# enable button (disabled due to no changes)
assert model_config.has_changes is False
assert model_config.has_changes is True
assert save_button.isEnabled() is False
save_button.setEnabled(True)
qtbot.mouseClick(save_button, Qt.MouseButton.LeftButton)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,12 @@
"values": 56.7
}
},
"recorders": {},
"pywr_editor": {
"schematic_size": [
1900,
1450
]
],
"shapes": []
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,12 @@
"index": 10
}
},
"recorders": {},
"pywr_editor": {
"schematic_size": [
1900,
1450
]
],
"shapes": []
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,12 @@
"index": 10
}
},
"recorders": {},
"pywr_editor": {
"schematic_size": [
1900,
1450
]
],
"shapes": []
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
"Link"
]
],
"includes": [],
"scenarios": [],
"tables": {},
"parameters": {
"param_with_index_col_str": {
"type": "constant",
Expand Down Expand Up @@ -245,10 +248,12 @@
"parse_dates": true
}
},
"recorders": {},
"pywr_editor": {
"schematic_size": [
1900,
1450
]
],
"shapes": []
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,14 @@
"column": " Date"
}
},
"includes": [],
"scenarios": [],
"recorders": {},
"pywr_editor": {
"schematic_size": [
1900,
1450
]
],
"shapes": []
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,15 @@
"column": " Date"
}
},
"includes": [],
"scenarios": [],
"tables": {},
"recorders": {},
"pywr_editor": {
"schematic_size": [
1900,
1450
]
],
"shapes": []
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,14 @@
"table": "h5_no_keys"
}
},
"includes": [],
"scenarios": [],
"recorders": {},
"pywr_editor": {
"schematic_size": [
1900,
1450
]
],
"shapes": []
}
}
7 changes: 6 additions & 1 deletion tests/json_models/model_dialog_parameters_url_widget.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,15 @@
"url": "files/table_no_keys.h5"
}
},
"includes": [],
"scenarios": [],
"tables": {},
"recorders": {},
"pywr_editor": {
"schematic_size": [
1900,
1450
]
],
"shapes": []
}
}
1 change: 0 additions & 1 deletion tests/model/test_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ def test_delete_node(self):

model.nodes.delete("Non-existing node")
assert all_nodes == model.nodes.get_all()
assert model.has_changes is False

def test_model_with_orphans(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion tests/widgets/test_line_edit_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def model_config(self) -> ModelConfig:
(
"valid_custom_parameter",
"custom",
"customParameter",
"customparameter",
{"type": "customParameter", "value": 2},
ParameterConfig(props={"type": "customParameter", "value": 2}),
),
Expand Down