Skip to content

Commit

Permalink
Merge branch 'main' into feature/flet-frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
ajkolenc committed Nov 21, 2024
2 parents 23d02c2 + 9e7e898 commit a5745a2
Show file tree
Hide file tree
Showing 19 changed files with 424 additions and 7 deletions.
11 changes: 6 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 24.3.0
rev: 24.10.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.9.0
rev: v1.13.0
hooks:
- id: mypy
additional_dependencies: ["types-requests"]
Expand All @@ -40,7 +40,7 @@ repos:
"--extension-pkg-allow-list=PySide6",
]
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.2
rev: v3.19.0
hooks:
- id: pyupgrade
- repo: https://github.com/Lucas-C/pre-commit-hooks
Expand All @@ -49,10 +49,11 @@ repos:
- id: forbid-tabs
- id: remove-tabs
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
exclude: |
(?x)^(
adaptation_pathways.spec.in|
pyproject.toml|
)$
17 changes: 17 additions & 0 deletions presentation/2024/10/24/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
configure_file(presentation.qmd presentation.qmd COPYONLY)

add_custom_target(presentation.2024.10.24
COMMAND
${Quarto_EXECUTABLE}
render ${CMAKE_CURRENT_BINARY_DIR}/presentation.qmd --to html
BYPRODUCTS
presentation.html
)

set_property(
DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}
PROPERTY
ADDITIONAL_CLEAN_FILES
presentation_files
)
34 changes: 34 additions & 0 deletions presentation/2024/10/24/presentation.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: "Adaptation pathways"
subtitle: "Current status"
date: "20241024"
format:
revealjs:
theme: moon
fontsize: 2em
code-line-numbers: false
highlight-style: nord
standalone: true
embed-resources: true
---


::: {.incremental}
- All code, tests, docs are in the Git repository
- Generated targets:
- Run tests
- Documentation
- Python package (Wheel package)
- Portable distribution of GUI (zip file)
- Bugs, TODOs are described in GitHub issues
:::


---

::: {.incremental}
- Developer Manual
- User Manual
- GitHub issues
- GitHub wiki (use?)
:::
1 change: 1 addition & 0 deletions presentation/2024/10/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_subdirectory(24)
17 changes: 17 additions & 0 deletions presentation/2024/11/12/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
configure_file(presentation.qmd presentation.qmd COPYONLY)

add_custom_target(presentation.2024.11.12
COMMAND
${Quarto_EXECUTABLE}
render ${CMAKE_CURRENT_BINARY_DIR}/presentation.qmd --to html
BYPRODUCTS
presentation.html
)

set_property(
DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}
PROPERTY
ADDITIONAL_CLEAN_FILES
presentation_files
)
186 changes: 186 additions & 0 deletions presentation/2024/11/12/presentation.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
---
title: "Adaptation pathways"
subtitle: "Technicalities"
date: "20241112"
format:
revealjs:
theme: moon
fontsize: 2em
code-line-numbers: false
highlight-style: nord
standalone: true
embed-resources: true
---

# Topics

::: {.incremental}
- GUI
- Plotting
:::


# Assumptions

::: {.incremental}
- Pathway logic in Python package
- More freedom WRT UI-specific code
- UI is one of the possible interfaces
- Generator useful in workshop setting → interactivity
:::


# GUI

## Aspects

::: {.incremental}
- Web vs desktop
- Installer vs URL
- "Round trip latency"
:::


## Options

::: {.incremental}
- Qt
- Flet
- "Web"
- Dash
:::


## Qt

::: {.incremental}
- Desktop application
- Installer
- Python bindings
:::


## Flet

::: {.incremental}
- Web, desktop and mobile application
- Server process required:
- Yes (default)
- No (icw Pyodide)
- Access to local file system → standard open/save dialogs
- Python bindings (Flutter)
- Pyodide
:::


## Web

::: {.incremental}
- Web application
- Server process required
- Yes (default)
- No (icw Pyodide)
- Styling using CSS (also in case of Flet and Dash)
:::


## Dash

::: {.incremental}
- Dashboard, but also useful for general UI dev
- Integration with plotly
- Web application and desktop application (Qt web widget)
- Commercial (beware of enshittification?)
- More popular than Flet
:::


# Plotting

## Aspects

::: {.incremental}
- Support for visualization styles
- Vector vs raster formats
- Python
- Interactivity
- Hovering
- Save as {pdf,png,...} from Python script
:::


## Options

::: {.incremental}
- matplotlib
- plotly
:::


## matplotlib

::: {.incremental}
- Python
- Vector + raster formats
- Primitives for custom plots
- Support for interactivity
- We already use it
- Installed by default
:::


## plotly

::: {.incremental}
- Python bindings
- Vector + raster formats
- Support for interactivity
- Customization through JavaScript?
- Commercial (enshittification?)
:::


# Solutions

## Flet app

::: {.incremental}
- GUI: Flet
- Plotting: matplotlib
- Pyodide
- ✓:
- No installation
- Works everywhere
- Everything in Python
- ~:
- Will Flet fly?
:::


## Qt desktop app

::: {.incremental}
- GUI: Qt
- Plotting: matplotlib
- ✓:
- Works on all desktop platforms
- Everything in Python
- No server process
- Access to local file system
- ~:
- Requires installation
- Package is platform specific
:::


## Dash app

::: {.incremental}
- GUI: Dash
- Plotting: plotly
- ✓:
- Everything in Python
- ~:
- Server process
- Dependence on a single company
:::
Empty file.
2 changes: 2 additions & 0 deletions presentation/2024/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
add_subdirectory(01)
add_subdirectory(03)
add_subdirectory(10)
add_subdirectory(11)
2 changes: 1 addition & 1 deletion source/package/adaptation_pathways/desktop/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ def _add_action(self):
colour = self._current_palette[colour_idx]

action = Action(name)
assert not name in self.colour_by_action_name, name
assert name not in self.colour_by_action_name, name
self.colour_by_action_name[action.name] = colour
self.actions.append([action])
self._set_data_changed(True)
Expand Down
16 changes: 16 additions & 0 deletions source/package/adaptation_pathways/model/action.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from comparisons import SequenceComparison
from metric import Metric, MetricValue

class Action:
id: str
name: str
color: str
icon: str
metric_data: dict[Metric, MetricValue | None]

class ActionDependency:
id: str
action: Action
relation: SequenceComparison
other_actions: list[Action]
actions_in_order: bool
17 changes: 17 additions & 0 deletions source/package/adaptation_pathways/model/comparisons.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from enum import Enum

class SequenceComparison(Enum):
STARTS_WITH = 1
DOESNT_START_WITH = 2
CONTAINS = 3
DOESNT_CONTAIN = 4
ENDS_WITH = 5
DOESNT_END_WITH = 6

class NumberComparison(Enum):
EQUAL = 1
DOESNT_EQUAL = 2
LESS_THAN = 3
LESS_THAN_OR_EQUAL = 4
GREATER_THAN = 5
GREATER_THAN_OR_EQUAL = 6
13 changes: 13 additions & 0 deletions source/package/adaptation_pathways/model/filter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from comparisons import SequenceComparison, NumberComparison
from metric import Metric
from action import Action

class ActionFilter:
relation: SequenceComparison
actions: list[Action]
actions_in_order: bool

class MetricFilter:
metric: Metric
relation: NumberComparison
value: float
25 changes: 25 additions & 0 deletions source/package/adaptation_pathways/model/metric.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from enum import Enum

class MetricEstimate(Enum):
MANUAL = 1
SUM = 2
AVERAGE = 3
MINIMUM = 4
MAXIMUM = 5
LAST = 6

class MetricUnit:
symbol: str
place_after_value: bool
value_format: str

class Metric:
id: str
name: str
unit: MetricUnit
current_value: float
estimate: MetricEstimate

class MetricValue:
value: float
is_estimate: bool
Loading

0 comments on commit a5745a2

Please sign in to comment.