diff --git a/.github/workflows/analyse.yml b/.github/workflows/analyse.yml index 6a6d12c..3ea4ffe 100644 --- a/.github/workflows/analyse.yml +++ b/.github/workflows/analyse.yml @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e2524f2..d067c2d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index ded9a78..6c3004b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/documentation/CMakeLists.txt b/documentation/CMakeLists.txt index d0bfb5c..4eb515f 100644 --- a/documentation/CMakeLists.txt +++ b/documentation/CMakeLists.txt @@ -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 diff --git a/documentation/conf.py.in b/documentation/conf.py.in index 0fbf981..ae35247 100644 --- a/documentation/conf.py.in +++ b/documentation/conf.py.in @@ -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 --------------------------------------------------- diff --git a/environment/configuration/requirements-dev.txt b/environment/configuration/requirements-dev.txt index ff530f7..d026562 100644 --- a/environment/configuration/requirements-dev.txt +++ b/environment/configuration/requirements-dev.txt @@ -1,6 +1,7 @@ build cairosvg cmake +flet>=0.25.1 furo linkchecker ninja diff --git a/environment/configuration/requirements.txt b/environment/configuration/requirements.txt index cd1eff8..616b386 100644 --- a/environment/configuration/requirements.txt +++ b/environment/configuration/requirements.txt @@ -2,4 +2,3 @@ docopt matplotlib networkx[default] pyside6>=6.6 -flet==0.22.* diff --git a/pyproject.toml b/pyproject.toml index bb5c3c9..c4e3f24 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,11 +34,10 @@ classifiers = [ "Operating System :: OS Independent", ] dependencies = [ - "docopt", + # "docopt", # TODO flet build can't find docopt... "matplotlib", "networkx[default]", - "pyside6", - "flet", + # "pyside6", ] [project.urls] diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index ce5eec5..b4df5fa 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -1,2 +1,3 @@ add_subdirectory(package/adaptation_pathways/desktop) +add_subdirectory(package/pathways_app) add_subdirectory(test) diff --git a/source/package/pathways_app/.gitignore b/source/package/pathways_app/.gitignore deleted file mode 100644 index 68bc17f..0000000 --- a/source/package/pathways_app/.gitignore +++ /dev/null @@ -1,160 +0,0 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py,cover -.hypothesis/ -.pytest_cache/ -cover/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -.pybuilder/ -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -# For a library or package, you might want to ignore these files since the code is -# intended to run in multiple environments; otherwise, check them in: -# .python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# poetry -# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. -# This is especially recommended for binary packages to ensure reproducibility, and is more -# commonly ignored for libraries. -# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control -#poetry.lock - -# pdm -# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. -#pdm.lock -# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it -# in version control. -# https://pdm.fming.dev/#use-with-ide -.pdm.toml - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ - -# pytype static type analyzer -.pytype/ - -# Cython debug symbols -cython_debug/ - -# PyCharm -# JetBrains specific template is maintained in a separate JetBrains.gitignore that can -# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore -# and can be added to the global gitignore or merged into this file. For a more nuclear -# option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ diff --git a/source/package/pathways_app/CMakeLists.txt b/source/package/pathways_app/CMakeLists.txt new file mode 100644 index 0000000..f5f4a30 --- /dev/null +++ b/source/package/pathways_app/CMakeLists.txt @@ -0,0 +1,24 @@ +find_program(AP_FLET_COMMAND flet REQUIRED) + + +configure_file( + pyproject.toml.in + pyproject.toml + @ONLY +) + +add_custom_target(web_app + COMMAND + ${CMAKE_COMMAND} -E copy_directory_if_different + ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} + COMMAND + ${CMAKE_COMMAND} -E env "PIP_FIND_LINKS=file://${PROJECT_BINARY_DIR}/dist" + ${AP_FLET_COMMAND} build web ${CMAKE_CURRENT_BINARY_DIR} + COMMAND + ${CMAKE_COMMAND} -E echo + "Run a command like this to start the web app:" + "${Python3_EXECUTABLE} -m http.server --directory ${CMAKE_CURRENT_BINARY_DIR}/build/web" + DEPENDS + package + VERBATIM +) diff --git a/source/package/pathways_app/README.md b/source/package/pathways_app/README.md index 8abf6ca..16bffb2 100644 --- a/source/package/pathways_app/README.md +++ b/source/package/pathways_app/README.md @@ -3,11 +3,21 @@ To run the app from within this directory: ``` -flet run . +flet run main.py ``` To run the app as a website: ``` -flet run --web . +flet run --web +``` + +To build the web app: + +``` +# Assumes you're in the binary directory +cmake --build . --target web_app + +# Alternatively, if using Ninja for example +ninja web_app ``` diff --git a/source/package/pathways_app/main.py b/source/package/pathways_app/main.py index 5fc1db6..b80c27a 100644 --- a/source/package/pathways_app/main.py +++ b/source/package/pathways_app/main.py @@ -1,139 +1,7 @@ -import locale import logging -import example import flet as ft -import theme -from controls.actions_panel import ActionsPanel -from controls.graph_panel import GraphPanel -from controls.header import SectionHeader -from controls.menu_bar import MenuBar -from controls.metrics_panel import MetricsPanel -from controls.panel import Panel -from controls.pathways_panel import PathwaysPanel -from controls.scenarios_panel import ScenariosPanel -from controls.tabbed_panel import TabbedPanel - - -locale.setlocale(locale.LC_ALL, "") - - -def main(page: ft.Page): - page.theme = theme.theme - page.theme_mode = ft.ThemeMode.LIGHT - - # bitdojo_window could make a custom title bar - # page.window.frameless = True - - page.window.width = 1200 - page.window.height = 800 - page.window.resizable = True - - page.title = "Pathways Generator" - page.fonts = theme.fonts - page.bgcolor = theme.colors.primary_darker - page.padding = 1 - page.spacing = 0 - - project = example.project - - page.appbar = MenuBar(project) - metrics_panel = MetricsPanel(project) - metrics_tab = (SectionHeader(ft.icons.TUNE, "Metrics"), metrics_panel) - - actions_panel = ActionsPanel(project) - actions_tab = ( - SectionHeader(ft.icons.CONSTRUCTION_OUTLINED, "Actions"), - actions_panel, - ) - - scenarios_panel = ScenariosPanel(project) - scenarios_tab = ( - SectionHeader(ft.icons.PUBLIC, "Scenarios"), - scenarios_panel, - ) - - graph_panel = GraphPanel(project) - pathways_panel = PathwaysPanel(project) - - def on_metrics_changed(): - metrics_panel.redraw() - scenarios_panel.redraw() - actions_panel.redraw() - pathways_panel.redraw() - graph_panel.redraw() - - def on_scenarios_changed(): - scenarios_panel.redraw() - graph_panel.redraw() - - def on_actions_changed(): - actions_panel.redraw() - pathways_panel.redraw() - graph_panel.redraw() - - def on_pathways_changed(): - pathways_panel.redraw() - graph_panel.redraw() - - def on_action_color_changed(): - pathways_panel.redraw() - graph_panel.redraw() - - # def on_graph_changed(): - # graph_panel.redraw() - - project.on_conditions_changed.append(on_metrics_changed) - project.on_criteria_changed.append(on_metrics_changed) - project.on_scenarios_changed.append(on_scenarios_changed) - project.on_actions_changed.append(on_actions_changed) - project.on_action_color_changed.append(on_action_color_changed) - project.on_pathways_changed.append(on_pathways_changed) - - page.add( - ft.Container( - expand=True, - padding=theme.variables.panel_spacing, - content=ft.Row( - expand=True, - spacing=theme.variables.panel_spacing, - controls=[ - ft.Column( - expand=2, - spacing=theme.variables.panel_spacing, - horizontal_alignment=ft.CrossAxisAlignment.STRETCH, - controls=[ - TabbedPanel( - selected_index=0, - tabs=[metrics_tab, actions_tab, scenarios_tab], - ) - ], - ), - ft.Column( - expand=3, - spacing=theme.variables.panel_spacing, - horizontal_alignment=ft.CrossAxisAlignment.STRETCH, - controls=[ - Panel(graph_panel), - Panel( - content=ft.Column( - expand=False, - alignment=ft.MainAxisAlignment.START, - spacing=15, - controls=[ - pathways_panel, - ], - ), - padding=theme.variables.panel_padding, - ), - ], - ), - ], - ), - bgcolor=theme.colors.primary_lighter, - border_radius=ft.border_radius.only(bottom_left=8, bottom_right=8), - ) - ) +from pathways_app.cli.app import main logging.basicConfig(level=logging.CRITICAL) diff --git a/source/package/pathways_app/__init__.py b/source/package/pathways_app/pathways_app/__init__.py similarity index 100% rename from source/package/pathways_app/__init__.py rename to source/package/pathways_app/pathways_app/__init__.py diff --git a/source/package/pathways_app/pathways_app/cli/__init__.py b/source/package/pathways_app/pathways_app/cli/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/source/package/pathways_app/pathways_app/cli/app.py b/source/package/pathways_app/pathways_app/cli/app.py new file mode 100644 index 0000000..c86ef33 --- /dev/null +++ b/source/package/pathways_app/pathways_app/cli/app.py @@ -0,0 +1,135 @@ +import locale + +import flet as ft + +from .. import example, theme +from ..controls.actions_panel import ActionsPanel +from ..controls.graph_panel import GraphPanel +from ..controls.header import SectionHeader +from ..controls.menu_bar import MenuBar +from ..controls.metrics_panel import MetricsPanel +from ..controls.panel import Panel +from ..controls.pathways_panel import PathwaysPanel +from ..controls.scenarios_panel import ScenariosPanel +from ..controls.tabbed_panel import TabbedPanel + + +locale.setlocale(locale.LC_ALL, "") + + +def main(page: ft.Page): + page.theme = theme.theme + page.theme_mode = ft.ThemeMode.LIGHT + + # bitdojo_window could make a custom title bar + # page.window.frameless = True + + page.window.width = 1200 + page.window.height = 800 + page.window.resizable = True + + page.title = "Pathways Generator" + page.fonts = theme.fonts + page.bgcolor = theme.colors.primary_darker + page.padding = 1 + page.spacing = 0 + + project = example.project + + page.appbar = MenuBar(project) + metrics_panel = MetricsPanel(project) + metrics_tab = (SectionHeader(ft.icons.TUNE, "Metrics"), metrics_panel) + + actions_panel = ActionsPanel(project) + actions_tab = ( + SectionHeader(ft.icons.CONSTRUCTION_OUTLINED, "Actions"), + actions_panel, + ) + + scenarios_panel = ScenariosPanel(project) + scenarios_tab = ( + SectionHeader(ft.icons.PUBLIC, "Scenarios"), + scenarios_panel, + ) + + graph_panel = GraphPanel(project) + pathways_panel = PathwaysPanel(project) + + def on_metrics_changed(): + metrics_panel.redraw() + scenarios_panel.redraw() + actions_panel.redraw() + pathways_panel.redraw() + graph_panel.redraw() + + def on_scenarios_changed(): + scenarios_panel.redraw() + graph_panel.redraw() + + def on_actions_changed(): + actions_panel.redraw() + pathways_panel.redraw() + graph_panel.redraw() + + def on_pathways_changed(): + pathways_panel.redraw() + graph_panel.redraw() + + def on_action_color_changed(): + pathways_panel.redraw() + graph_panel.redraw() + + # def on_graph_changed(): + # graph_panel.redraw() + + project.on_conditions_changed.append(on_metrics_changed) + project.on_criteria_changed.append(on_metrics_changed) + project.on_scenarios_changed.append(on_scenarios_changed) + project.on_actions_changed.append(on_actions_changed) + project.on_action_color_changed.append(on_action_color_changed) + project.on_pathways_changed.append(on_pathways_changed) + + page.add( + ft.Container( + expand=True, + padding=theme.variables.panel_spacing, + content=ft.Row( + expand=True, + spacing=theme.variables.panel_spacing, + controls=[ + ft.Column( + expand=2, + spacing=theme.variables.panel_spacing, + horizontal_alignment=ft.CrossAxisAlignment.STRETCH, + controls=[ + TabbedPanel( + selected_index=0, + tabs=[metrics_tab, actions_tab, scenarios_tab], + ) + ], + ), + ft.Column( + expand=3, + spacing=theme.variables.panel_spacing, + horizontal_alignment=ft.CrossAxisAlignment.STRETCH, + controls=[ + Panel(graph_panel), + Panel( + content=ft.Column( + expand=False, + alignment=ft.MainAxisAlignment.START, + spacing=15, + controls=[ + pathways_panel, + ], + ), + padding=theme.variables.panel_padding, + ), + ], + ), + ], + ), + bgcolor=theme.colors.primary_lighter, + border_radius=ft.border_radius.only(bottom_left=8, bottom_right=8), + ) + ) diff --git a/source/package/pathways_app/controls/__init__.py b/source/package/pathways_app/pathways_app/controls/__init__.py similarity index 100% rename from source/package/pathways_app/controls/__init__.py rename to source/package/pathways_app/pathways_app/controls/__init__.py diff --git a/source/package/pathways_app/controls/action_icon.py b/source/package/pathways_app/pathways_app/controls/action_icon.py similarity index 98% rename from source/package/pathways_app/controls/action_icon.py rename to source/package/pathways_app/pathways_app/controls/action_icon.py index c3915a1..2de0fe9 100644 --- a/source/package/pathways_app/controls/action_icon.py +++ b/source/package/pathways_app/pathways_app/controls/action_icon.py @@ -1,8 +1,9 @@ import flet as ft -import theme from adaptation_pathways.app.model.action import Action +from .. import theme + class ActionIcon(ft.Container): def __init__(self, action: Action, display_tooltip=True, size=36): diff --git a/source/package/pathways_app/controls/actions_panel.py b/source/package/pathways_app/pathways_app/controls/actions_panel.py similarity index 95% rename from source/package/pathways_app/controls/actions_panel.py rename to source/package/pathways_app/pathways_app/controls/actions_panel.py index 8c78f60..7abce25 100644 --- a/source/package/pathways_app/controls/actions_panel.py +++ b/source/package/pathways_app/pathways_app/controls/actions_panel.py @@ -2,19 +2,20 @@ import random import flet as ft -import theme -from controls.action_icon import ActionIcon -from controls.editable_cell import EditableTextCell -from controls.metric_effect import MetricEffectCell -from controls.metric_value import MetricValueCell -from controls.sortable_header import SortableHeader, SortMode -from controls.styled_button import StyledButton -from controls.styled_table import StyledTable from adaptation_pathways.app.model.action import Action from adaptation_pathways.app.model.pathways_project import PathwaysProject from adaptation_pathways.app.model.sorting import SortTarget +from .. import theme +from .action_icon import ActionIcon +from .editable_cell import EditableTextCell +from .metric_effect import MetricEffectCell +from .metric_value import MetricValueCell +from .sortable_header import SortableHeader, SortMode +from .styled_button import StyledButton +from .styled_table import StyledTable + class ActionsPanel(ft.Column): def __init__(self, project: PathwaysProject): diff --git a/source/package/pathways_app/controls/editable_cell.py b/source/package/pathways_app/pathways_app/controls/editable_cell.py similarity index 99% rename from source/package/pathways_app/controls/editable_cell.py rename to source/package/pathways_app/pathways_app/controls/editable_cell.py index fbd5100..21f7175 100644 --- a/source/package/pathways_app/controls/editable_cell.py +++ b/source/package/pathways_app/pathways_app/controls/editable_cell.py @@ -2,9 +2,10 @@ from typing import Callable import flet as ft -import theme from pyparsing import abstractmethod +from .. import theme + class EditableCell(ft.DataCell, ABC): def __init__( diff --git a/source/package/pathways_app/controls/graph_panel.py b/source/package/pathways_app/pathways_app/controls/graph_panel.py similarity index 96% rename from source/package/pathways_app/controls/graph_panel.py rename to source/package/pathways_app/pathways_app/controls/graph_panel.py index d2433df..a24507b 100644 --- a/source/package/pathways_app/controls/graph_panel.py +++ b/source/package/pathways_app/pathways_app/controls/graph_panel.py @@ -1,13 +1,14 @@ import flet as ft import matplotlib.pyplot -import theme -from controls.styled_button import StyledButton -from controls.styled_dropdown import StyledDropdown from flet.matplotlib_chart import MatplotlibChart from adaptation_pathways.app.model.pathways_project import PathwaysProject from adaptation_pathways.app.service.plotting_service import PlottingService +from .. import theme +from .styled_button import StyledButton +from .styled_dropdown import StyledDropdown + class GraphPanel(ft.Row): def __init__(self, project: PathwaysProject): diff --git a/source/package/pathways_app/controls/header.py b/source/package/pathways_app/pathways_app/controls/header.py similarity index 98% rename from source/package/pathways_app/controls/header.py rename to source/package/pathways_app/pathways_app/controls/header.py index 96c2621..87746bd 100644 --- a/source/package/pathways_app/controls/header.py +++ b/source/package/pathways_app/pathways_app/controls/header.py @@ -1,6 +1,7 @@ # pylint: disable=too-many-arguments import flet as ft -import theme + +from .. import theme class SectionHeader(ft.Container): diff --git a/source/package/pathways_app/controls/menu_bar.py b/source/package/pathways_app/pathways_app/controls/menu_bar.py similarity index 99% rename from source/package/pathways_app/controls/menu_bar.py rename to source/package/pathways_app/pathways_app/controls/menu_bar.py index e97db50..46003a3 100644 --- a/source/package/pathways_app/controls/menu_bar.py +++ b/source/package/pathways_app/pathways_app/controls/menu_bar.py @@ -1,8 +1,9 @@ import flet as ft -import theme from adaptation_pathways.app.model import PathwaysProject +from .. import theme + class MenuBar(ft.Container): def __init__(self, project: PathwaysProject): diff --git a/source/package/pathways_app/controls/metric_effect.py b/source/package/pathways_app/pathways_app/controls/metric_effect.py similarity index 95% rename from source/package/pathways_app/controls/metric_effect.py rename to source/package/pathways_app/pathways_app/controls/metric_effect.py index b2c681b..33ff121 100644 --- a/source/package/pathways_app/controls/metric_effect.py +++ b/source/package/pathways_app/pathways_app/controls/metric_effect.py @@ -1,14 +1,15 @@ from typing import Callable import flet as ft -import theme -from controls.editable_cell import EditableCell -from controls.metric_value import FloatInputFilter -from controls.styled_dropdown import StyledDropdown from adaptation_pathways.app.model.action import MetricEffect from adaptation_pathways.app.model.metric import Metric, MetricOperation +from .. import theme +from .editable_cell import EditableCell +from .metric_value import FloatInputFilter +from .styled_dropdown import StyledDropdown + class MetricEffectCell(EditableCell): def __init__( diff --git a/source/package/pathways_app/controls/metric_value.py b/source/package/pathways_app/pathways_app/controls/metric_value.py similarity index 97% rename from source/package/pathways_app/controls/metric_value.py rename to source/package/pathways_app/pathways_app/controls/metric_value.py index 90b00dc..6e88822 100644 --- a/source/package/pathways_app/controls/metric_value.py +++ b/source/package/pathways_app/pathways_app/controls/metric_value.py @@ -1,9 +1,10 @@ import flet as ft -import theme -from controls.editable_cell import EditableCell from adaptation_pathways.app.model.metric import Metric, MetricValue +from .. import theme +from .editable_cell import EditableCell + class FloatInputFilter(ft.InputFilter): def __init__(self): diff --git a/source/package/pathways_app/controls/metrics_panel.py b/source/package/pathways_app/pathways_app/controls/metrics_panel.py similarity index 96% rename from source/package/pathways_app/controls/metrics_panel.py rename to source/package/pathways_app/pathways_app/controls/metrics_panel.py index cf2cf28..95c1195 100644 --- a/source/package/pathways_app/controls/metrics_panel.py +++ b/source/package/pathways_app/pathways_app/controls/metrics_panel.py @@ -1,15 +1,16 @@ from typing import Callable import flet as ft -from controls.editable_cell import EditableTextCell -from controls.header import SmallHeader -from controls.styled_button import StyledButton -from controls.styled_table import StyledTable -from controls.unit_cell import MetricUnitCell from adaptation_pathways.app.model.metric import Metric from adaptation_pathways.app.model.pathways_project import PathwaysProject +from .editable_cell import EditableTextCell +from .header import SmallHeader +from .styled_button import StyledButton +from .styled_table import StyledTable +from .unit_cell import MetricUnitCell + class MetricsPanel(ft.Column): def __init__(self, project: PathwaysProject): diff --git a/source/package/pathways_app/controls/panel.py b/source/package/pathways_app/pathways_app/controls/panel.py similarity index 97% rename from source/package/pathways_app/controls/panel.py rename to source/package/pathways_app/pathways_app/controls/panel.py index 1c24de5..69d374f 100644 --- a/source/package/pathways_app/controls/panel.py +++ b/source/package/pathways_app/pathways_app/controls/panel.py @@ -1,5 +1,6 @@ import flet as ft -import theme + +from .. import theme class Panel(ft.Container): diff --git a/source/package/pathways_app/controls/pathways_panel.py b/source/package/pathways_app/pathways_app/controls/pathways_panel.py similarity index 96% rename from source/package/pathways_app/controls/pathways_panel.py rename to source/package/pathways_app/pathways_app/controls/pathways_panel.py index e02aced..e175f2b 100644 --- a/source/package/pathways_app/controls/pathways_panel.py +++ b/source/package/pathways_app/pathways_app/controls/pathways_panel.py @@ -1,16 +1,17 @@ import flet as ft -import theme -from controls.action_icon import ActionIcon -from controls.header import SectionHeader -from controls.metric_value import MetricValueCell -from controls.sortable_header import SortableHeader, SortMode -from controls.styled_button import StyledButton -from controls.styled_table import StyledTable from adaptation_pathways.app.model.pathway import Pathway from adaptation_pathways.app.model.pathways_project import PathwaysProject from adaptation_pathways.app.model.sorting import SortTarget +from .. import theme +from .action_icon import ActionIcon +from .header import SectionHeader +from .metric_value import MetricValueCell +from .sortable_header import SortableHeader, SortMode +from .styled_button import StyledButton +from .styled_table import StyledTable + class PathwaysPanel(ft.Column): def __init__(self, project: PathwaysProject): diff --git a/source/package/pathways_app/controls/scenarios_panel.py b/source/package/pathways_app/pathways_app/controls/scenarios_panel.py similarity index 94% rename from source/package/pathways_app/controls/scenarios_panel.py rename to source/package/pathways_app/pathways_app/controls/scenarios_panel.py index 1ae2353..a935bd0 100644 --- a/source/package/pathways_app/controls/scenarios_panel.py +++ b/source/package/pathways_app/pathways_app/controls/scenarios_panel.py @@ -1,10 +1,11 @@ import flet as ft -from controls.styled_button import StyledButton -from controls.styled_dropdown import StyledDropdown -from controls.styled_table import StyledTable from adaptation_pathways.app.model.pathways_project import PathwaysProject +from .styled_button import StyledButton +from .styled_dropdown import StyledDropdown +from .styled_table import StyledTable + class ScenariosPanel(ft.Column): def __init__(self, project: PathwaysProject): diff --git a/source/package/pathways_app/controls/sortable_header.py b/source/package/pathways_app/pathways_app/controls/sortable_header.py similarity index 98% rename from source/package/pathways_app/controls/sortable_header.py rename to source/package/pathways_app/pathways_app/controls/sortable_header.py index d09ff27..e6e5dc7 100644 --- a/source/package/pathways_app/controls/sortable_header.py +++ b/source/package/pathways_app/pathways_app/controls/sortable_header.py @@ -1,10 +1,11 @@ from enum import Enum import flet as ft -import theme from adaptation_pathways.app.model.sorting import SortingInfo, SortTarget +from .. import theme + class SortMode(Enum): NONE = 0 diff --git a/source/package/pathways_app/controls/styled_button.py b/source/package/pathways_app/pathways_app/controls/styled_button.py similarity index 97% rename from source/package/pathways_app/controls/styled_button.py rename to source/package/pathways_app/pathways_app/controls/styled_button.py index e76cdff..48ef260 100644 --- a/source/package/pathways_app/controls/styled_button.py +++ b/source/package/pathways_app/pathways_app/controls/styled_button.py @@ -1,5 +1,6 @@ import flet as ft -import theme + +from .. import theme class StyledButton(ft.FilledButton): diff --git a/source/package/pathways_app/controls/styled_dropdown.py b/source/package/pathways_app/pathways_app/controls/styled_dropdown.py similarity index 96% rename from source/package/pathways_app/controls/styled_dropdown.py rename to source/package/pathways_app/pathways_app/controls/styled_dropdown.py index aafe713..75215ff 100644 --- a/source/package/pathways_app/controls/styled_dropdown.py +++ b/source/package/pathways_app/pathways_app/controls/styled_dropdown.py @@ -1,7 +1,8 @@ # pylint: disable=too-many-arguments import flet as ft -import theme -from utils import index_of_first + +from .. import theme +from ..utils import index_of_first class StyledDropdown(ft.Dropdown): diff --git a/source/package/pathways_app/controls/styled_table.py b/source/package/pathways_app/pathways_app/controls/styled_table.py similarity index 99% rename from source/package/pathways_app/controls/styled_table.py rename to source/package/pathways_app/pathways_app/controls/styled_table.py index ceb238f..26e4fad 100644 --- a/source/package/pathways_app/controls/styled_table.py +++ b/source/package/pathways_app/pathways_app/controls/styled_table.py @@ -1,6 +1,7 @@ # pylint: disable=too-many-arguments import flet as ft -import theme + +from .. import theme class StyledTable(ft.DataTable): diff --git a/source/package/pathways_app/controls/tabbed_panel.py b/source/package/pathways_app/pathways_app/controls/tabbed_panel.py similarity index 98% rename from source/package/pathways_app/controls/tabbed_panel.py rename to source/package/pathways_app/pathways_app/controls/tabbed_panel.py index 1fd6751..92b6306 100644 --- a/source/package/pathways_app/controls/tabbed_panel.py +++ b/source/package/pathways_app/pathways_app/controls/tabbed_panel.py @@ -1,6 +1,7 @@ import flet as ft -import theme -from controls.header import SectionHeader + +from .. import theme +from .header import SectionHeader class TabbedPanel(ft.Column): diff --git a/source/package/pathways_app/controls/unit_cell.py b/source/package/pathways_app/pathways_app/controls/unit_cell.py similarity index 99% rename from source/package/pathways_app/controls/unit_cell.py rename to source/package/pathways_app/pathways_app/controls/unit_cell.py index 9b7f2bf..31b7ee1 100644 --- a/source/package/pathways_app/controls/unit_cell.py +++ b/source/package/pathways_app/pathways_app/controls/unit_cell.py @@ -1,10 +1,11 @@ from typing import Callable import flet as ft -import theme from adaptation_pathways.app.model.metric import Metric, MetricUnit, default_units +from .. import theme + class MetricUnitCell(ft.DataCell): def __init__( diff --git a/source/package/pathways_app/example.py b/source/package/pathways_app/pathways_app/example.py similarity index 100% rename from source/package/pathways_app/example.py rename to source/package/pathways_app/pathways_app/example.py diff --git a/source/package/pathways_app/theme.py b/source/package/pathways_app/pathways_app/theme.py similarity index 100% rename from source/package/pathways_app/theme.py rename to source/package/pathways_app/pathways_app/theme.py diff --git a/source/package/pathways_app/utils.py b/source/package/pathways_app/pathways_app/utils.py similarity index 100% rename from source/package/pathways_app/utils.py rename to source/package/pathways_app/pathways_app/utils.py diff --git a/source/package/pathways_app/pyproject.toml.in b/source/package/pathways_app/pyproject.toml.in new file mode 100644 index 0000000..00af796 --- /dev/null +++ b/source/package/pathways_app/pyproject.toml.in @@ -0,0 +1,31 @@ +[tool.flet] +org = "nl.deltares" +product = "TODO" +company = "TODO" +copyright = "@AP_COPYRIGHT@" + +# [tool.flet.app] +# module = "main" +# path = "package/pathways_app" + +[tool.flet.compile] +app = false +packages = false +cleanup = false + +# [tool.flet.web] +# base_url = "TODO" +# renderer = "canvaskit" +# use_color_emoji = false +# route_url_strategy = "path" + +[project] +name = "Pathways Generator" +version = "@CMAKE_PROJECT_VERSION@" +description = "@CMAKE_PROJECT_DESCRIPTION@" +authors = "@AP_AUTHORS@" +dependencies = [ + "adaptation_pathways==@CMAKE_PROJECT_VERSION@", + "pyparsing", + "flet>=0.25.1" +] diff --git a/source/package/pathways_app/requirements.txt b/source/package/pathways_app/requirements.txt deleted file mode 100644 index cbd0a52..0000000 --- a/source/package/pathways_app/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -matplotlib -pyparsing -networkx