Skip to content

Commit

Permalink
Rebase fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ajkolenc committed Jan 26, 2025
1 parent ca57608 commit 76af681
Show file tree
Hide file tree
Showing 19 changed files with 75 additions and 757 deletions.
40 changes: 0 additions & 40 deletions source/package/pathways_app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,6 @@

import flet as ft
from pathways_app.cli.app import main
import theme
from controls.editor_page import EditorPage
from controls.menu_bar import MenuBar
from pathways_app.app import App


locale.setlocale(locale.LC_ALL, "")


def main(page: ft.Page):
# bitdojo_window could make a custom title bar
# page.window.frameless = True
# page.window.width = 1200
# page.window.height = 800
page.theme = theme.theme
page.theme_mode = ft.ThemeMode.LIGHT

page.window.resizable = True
page.window.alignment = ft.alignment.center
page.window.maximized = True

page.title = "Pathways Generator"
page.fonts = theme.fonts
page.bgcolor = theme.colors.primary_darker
page.padding = 1
page.spacing = 0

app = App(page)
page.appbar = MenuBar(app)
page.overlay.append(app.file_picker)

page.add(
ft.Container(
expand=True,
padding=theme.variables.panel_spacing,
content=EditorPage(app.project),
bgcolor=theme.colors.primary_lighter,
border_radius=ft.border_radius.only(bottom_left=8, bottom_right=8),
)
)


logging.basicConfig(level=logging.CRITICAL)
Expand Down
117 changes: 13 additions & 104 deletions source/package/pathways_app/pathways_app/cli/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,133 +2,42 @@

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 .. import theme
from ..controls.editor_page import EditorPage
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
from ..pathways_app import PathwaysApp


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.theme = theme.theme
page.theme_mode = ft.ThemeMode.LIGHT

page.window.width = 1200
page.window.height = 800
page.window.resizable = True
page.window.alignment = ft.alignment.center
page.window.maximized = 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)
app = PathwaysApp(page)
page.appbar = MenuBar(app)
page.overlay.append(app.file_picker)

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,
),
],
),
],
),
content=EditorPage(app.project),
bgcolor=theme.colors.primary_lighter,
border_radius=ft.border_radius.only(bottom_left=8, bottom_right=8),
)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@
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.styled_table import StyledTable, TableCell, TableColumn, TableRow
from pathways_app.controls.panel_header import PanelHeader

from adaptation_pathways.app.model.action import Action
from adaptation_pathways.app.model.pathways_project import PathwaysProject
Expand All @@ -18,9 +11,8 @@
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
from .panel_header import PanelHeader
from .styled_table import StyledTable, TableCell, TableColumn, TableRow


class ActionsEditor(ft.Column):
Expand Down
Loading

0 comments on commit 76af681

Please sign in to comment.