dash-frontend: tabs, other fixes (desc)

- set rustfmt line width to 120 columns by default for wgui
- dashboard tabs
- wgui: `remove_children`
This commit is contained in:
Aleksander
2025-09-15 20:37:55 +02:00
parent f115d2d2cf
commit 54767d75da
30 changed files with 624 additions and 191 deletions

View File

@@ -1,25 +1,32 @@
use crate::testbed::Testbed;
use wgui::{event::EventListenerCollection, layout::Layout};
use crate::testbed::{Testbed, TestbedUpdateParams};
use dash_frontend::Frontend;
use wgui::{event::EventListenerCollection, layout::RcLayout};
pub struct TestbedDashboard {
frontend: dash_frontend::Frontend,
layout: RcLayout,
frontend: dash_frontend::RcFrontend,
}
impl TestbedDashboard {
pub fn new(listeners: &mut EventListenerCollection<(), ()>) -> anyhow::Result<Self> {
Ok(Self {
frontend: dash_frontend::Frontend::new(dash_frontend::FrontendParams { listeners })?,
})
let (frontend, layout) =
dash_frontend::Frontend::new(dash_frontend::FrontendParams { listeners })?;
Ok(Self { frontend, layout })
}
}
impl Testbed for TestbedDashboard {
fn update(&mut self, width: f32, height: f32, timestep_alpha: f32) -> anyhow::Result<()> {
self.frontend.update(width, height, timestep_alpha)?;
Ok(())
fn update(&mut self, params: TestbedUpdateParams) -> anyhow::Result<()> {
Frontend::update(
&self.frontend,
params.listeners,
params.width,
params.height,
params.timestep_alpha,
)
}
fn layout(&mut self) -> &mut Layout {
self.frontend.get_layout()
fn layout(&self) -> &RcLayout {
&self.layout
}
}