Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Flet app package #57

Merged
merged 22 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f58605d
Created a mockup and some assets for it
ajkolenc Nov 20, 2024
23d02c2
Started working on flet app
ajkolenc Nov 20, 2024
a5745a2
Merge branch 'main' into feature/flet-frontend
ajkolenc Nov 21, 2024
7487a2a
Merge branch 'main' into feature/flet-frontend
ajkolenc Nov 25, 2024
e798f97
Fix flet linting and directory structure
ajkolenc Nov 26, 2024
66c8912
Created a mockup and some assets for it
ajkolenc Nov 20, 2024
379bd73
Started working on flet app
ajkolenc Nov 20, 2024
a1b9959
Fix flet linting and directory structure
ajkolenc Nov 26, 2024
8ec1b6d
Progress on pathways app
ajkolenc Dec 14, 2024
164cd67
Merge branch 'feature/flet-frontend' of github.com:Deltares-research/…
ajkolenc Dec 14, 2024
2bbc3ed
Refactored for CRUD operations on data
ajkolenc Dec 17, 2024
29d2968
Created a mockup and some assets for it
ajkolenc Nov 20, 2024
0e51991
Started working on flet app
ajkolenc Nov 20, 2024
3d05421
Fix flet linting and directory structure
ajkolenc Nov 26, 2024
749b718
Progress on pathways app
ajkolenc Dec 14, 2024
fa756ce
Started working on flet app
ajkolenc Nov 20, 2024
07277c9
Fix flet linting and directory structure
ajkolenc Nov 26, 2024
dcc693f
Refactored for CRUD operations on data
ajkolenc Dec 17, 2024
973a46f
Fix plotting
ajkolenc Dec 21, 2024
89f9924
Merge branch 'feature/flet-frontend' of github.com:Deltares-research/…
ajkolenc Dec 21, 2024
f0ec775
Remove old schema mockup
ajkolenc Dec 21, 2024
a7bfc3d
Create package, support web_app target
kordejong Jan 17, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/analyse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
matrix:
python_version: ["3.12"]
platform:
- { os: "ubuntu-22.04", arch: x64 }
- { os: "ubuntu-24.04", arch: x64 }
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
platform:
- { os: "macos-14", arch: arm64 }
- { os: "macos-13", arch: x64 }
- { os: "ubuntu-22.04", arch: x64 }
- { os: "ubuntu-24.04", arch: x64 }
- { os: "windows-2022", arch: x64 }
steps:
- name: Setup Linux platform
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build, env and .venv are conventions of individual developers. I would not put them in a project's .gitignore. They can be in a dev's personal .gitignore.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.venv
build/
env/
**/__pycache__/
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
exclude: '\.svg$'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
Expand Down
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ project(AdaptationPathways
HOMEPAGE_URL "https://publicwiki.deltares.nl/display/AP/Adaptation+Pathways"
)

set(AP_COPYRIGHT "2025 by TODO")
string(JOIN ", " AP_AUTHORS
# TODO Add everybody, in some order (alphabet?)
"Kor de Jong (Geoneric, NL)"
"Marjolijn Haasnoot (Deltares, NL)"
"Willem van Deursen (Carthago Consultancy, NL)"
)

enable_testing()

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/environment/cmake)
Expand Down
Binary file added datasets/test-dataset.apw
Binary file not shown.
2 changes: 1 addition & 1 deletion documentation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ add_custom_target(apidoc
--module-first
-d 1
-o ${CMAKE_CURRENT_BINARY_DIR}/api
${PROJECT_SOURCE_DIR}/source/package/adaptation_pathways
${PROJECT_SOURCE_DIR}/source/package
)

# https://www.sphinx-doc.org/en/master/man/sphinx-build.html
Expand Down
11 changes: 2 additions & 9 deletions documentation/conf.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,8 @@ import re
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "@CMAKE_PROJECT_NAME@"
copyright = "2024, TODO"
author = ", ".join(
[
# TODO Add everybody
"Marjolijn Haasnoot (Deltares, NL)",
"Willem van Deursen (Carthago Consultancy, NL)",
"Kor de Jong (Geoneric, NL)",
]
)
copyright = "@AP_COPYRIGHT@"
author = "@AP_AUTHORS@"
version = "@CMAKE_PROJECT_VERSION_MAJOR@.@CMAKE_PROJECT_VERSION_MINOR@"

# -- General configuration ---------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions environment/configuration/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
build
cairosvg
cmake
flet>=0.25.1
furo
linkchecker
ninja
Expand Down
3 changes: 3 additions & 0 deletions mockup/images/Action Outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mockup/images/deltares-logo-white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions mockup/images/deltares-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions mockup/images/icon_line-chart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ sections = "FUTURE,STDLIB,THIRDPARTY,AP,FIRSTPARTY,LOCALFOLDER"
profile = "black"

[tool.pylint]
disable = "C0103, C0114, C0115, C0116, C0302, E0401, W0212, W0511, R0801"
max-line-length=240
disable = "C0103, C0114, C0115, C0116, C0302, E0401, W0212, W0511, R0801, R0902, R0903, R0913, R0914, R0904, R0917"
extension-pkg-allow-list = [
"matplotlib",
"PySide6",
Expand Down Expand Up @@ -34,10 +34,10 @@ classifiers = [
"Operating System :: OS Independent",
]
dependencies = [
"docopt",
# "docopt", # TODO flet build can't find docopt...
"matplotlib",
"networkx[default]",
"pyside6",
# "pyside6",
]

[project.urls]
Expand Down
1 change: 1 addition & 0 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
add_subdirectory(package/adaptation_pathways/desktop)
add_subdirectory(package/pathways_app)
add_subdirectory(test)
2 changes: 1 addition & 1 deletion source/package/adaptation_pathways/alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
Actions = list[Action | ActionCombination]
Sequence = tuple[Action, Action]
Sequences = list[Sequence]
TippingPoint = int
TippingPoint = float
TippingPointByAction = dict[Action, TippingPoint]
3 changes: 3 additions & 0 deletions source/package/adaptation_pathways/app/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""
Contains the classes needed to communicate between the Flet app and the other parts of the codebase
"""
6 changes: 6 additions & 0 deletions source/package/adaptation_pathways/app/model/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
"""
These models are used by the front-end app to manipulate pathways data
"""

from .action import Action, ActionDependency
from .metric import Metric
from .pathway import Pathway
from .pathways_project import PathwaysProject
from .scenario import Scenario, TimeSeriesPoint
13 changes: 10 additions & 3 deletions source/package/adaptation_pathways/app/model/action.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import dataclasses

from comparisons import SequenceComparison
from metric import Metric, MetricValue
from .comparisons import SequenceComparison
from .metric import MetricEffect


@dataclasses.dataclass
Expand All @@ -10,7 +10,14 @@ class Action:
name: str
color: str
icon: str
metric_data: dict[Metric, MetricValue | None]
metric_data: dict[str, MetricEffect]

def apply_effect(self, metric_id: str, value: float) -> float:
if metric_id not in self.metric_data:
return value

effect = self.metric_data[metric_id]
return effect.apply_to(value)


@dataclasses.dataclass
Expand Down
Loading