Skip to content

Commit

Permalink
Updated dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-k committed Nov 9, 2023
1 parent e942fff commit efec562
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 25 deletions.
13 changes: 7 additions & 6 deletions tools/plotter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ argmin = { version = "0.8.0", path = "../../argmin", default-features = false, f
bytes = "1.4.0"
clap = { version = "4.1.7", features = ["derive"] }
dashmap = { version = "5.4", features = ["serde"], optional = true }
eframe = { version = "0.21", features = ["ron", "persistence"], optional = true }
egui_dock = { version = "0.4", optional = true }
egui_extras = { version = "0.21", optional = true }
itertools = { version = "0.10", optional = true }
eframe = { version = "0.23", features = ["ron", "persistence"], optional = true }
egui_dock = { version = "0.8", optional = true }
egui_extras = { version = "0.23", optional = true }
egui_plot = { version = "0.23", optional = true }
itertools = { version = "0.11", optional = true }
rmp-serde = "1.1.1"
serde = { version = "1.0", features = ["derive"] }
time = { version = "0.3", features = ["serde"] }
Expand All @@ -32,10 +33,10 @@ tokio-stream = { version = "0.1", optional = true }
tokio-util = { version = "0.7", features = ["codec"], optional = true }
tracing = { version = "0.1", features = ["log"], optional = true }
tracing-bunyan-formatter = { version = "0.3", optional = true }
tracing-log = { version = "0.1", optional = true }
tracing-log = { version = "0.2", optional = true }
tracing-subscriber = { version = "0.3", features = ["registry", "env-filter"], optional = true }
uuid = { version = "1.3.0", features = ["v4"], optional = true }

[features]
default = ["plotter"]
plotter = ["dashmap", "tracing", "tracing-bunyan-formatter", "tracing-log", "tracing-subscriber", "eframe", "egui_dock", "egui_extras", "itertools", "tokio", "tokio-stream", "tokio-util", "uuid"]
plotter = ["dashmap", "tracing", "tracing-bunyan-formatter", "tracing-log", "tracing-subscriber", "eframe", "egui_dock", "egui_extras", "egui_plot", "itertools", "tokio", "tokio-stream", "tokio-util", "uuid"]
6 changes: 3 additions & 3 deletions tools/plotter/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::{

use argmin::core::TerminationStatus;
use dashmap::DashMap;
use egui_dock::Tree;
use egui_dock::DockState;
use itertools::Itertools;
use time::Duration;

Expand Down Expand Up @@ -130,11 +130,11 @@ impl Run {

pub struct Storage {
pub runs: DashMap<RunName, Run>,
pub tree: Arc<Mutex<Tree<RunName>>>,
pub tree: Arc<Mutex<DockState<RunName>>>,
}

impl Storage {
pub fn new(tree: Arc<Mutex<Tree<String>>>) -> Self {
pub fn new(tree: Arc<Mutex<DockState<String>>>) -> Self {
Storage {
runs: DashMap::new(),
tree,
Expand Down
32 changes: 16 additions & 16 deletions tools/plotter/src/plotter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@ use std::{

use argmin::core::TerminationStatus;
use eframe::{
egui::{
self,
plot::{Bar, BarChart, Legend, Line, Plot, PlotPoints},
CentralPanel, Id, LayerId, Ui, WidgetText,
},
egui::{self, CentralPanel, Id, LayerId, Ui, WidgetText},
epaint::Color32,
};
use egui_dock::{DockArea, Node, Style, TabViewer, Tree};
use egui_dock::{DockArea, DockState, Node, Style, TabViewer};
use egui_extras::{Column, TableBuilder};
use egui_plot::{Bar, BarChart, Legend, Line, Plot, PlotPoints};

use crate::{
connection::server,
Expand All @@ -44,7 +41,7 @@ struct MyContext {

pub struct PlotterApp {
context: MyContext,
tree: Arc<Mutex<Tree<String>>>,
dock_state: Arc<Mutex<DockState<String>>>,
}

impl PlotterApp {
Expand All @@ -53,7 +50,7 @@ impl PlotterApp {
host: String,
port: u16,
) -> Result<Self, anyhow::Error> {
let tree: Tree<String> = Tree::new(vec![]);
let dock_state: DockState<String> = DockState::new(vec![]);
// tree.push_to_first_leaf("Blah".to_owned());
// let [a, b] = tree.split_left(NodeIndex::root(), 0.3, vec!["Inspector".to_owned()]);
// let [_, _] = tree.split_below(
Expand All @@ -65,15 +62,15 @@ impl PlotterApp {

let mut open_tabs = HashSet::new();

for node in tree.iter() {
for node in dock_state.iter_main_surface_nodes() {
if let Node::Leaf { tabs, .. } = node {
for tab in tabs {
open_tabs.insert(tab.clone());
}
}
}

let tree = Arc::new(Mutex::new(tree));
let dock_state = Arc::new(Mutex::new(dock_state));

// NEEDS TO BE PART OF STORAGE
// let selected = if let Some(storage) = cc.storage {
Expand All @@ -82,7 +79,7 @@ impl PlotterApp {
// HashMap::new()
// };

let storage = Arc::new(Storage::new(Arc::clone(&tree)));
let storage = Arc::new(Storage::new(Arc::clone(&dock_state)));
let db2 = Arc::clone(&storage);
let egui_ctx = cc.egui_ctx.clone();
std::thread::spawn(move || server(db2, egui_ctx, host, port));
Expand All @@ -93,7 +90,10 @@ impl PlotterApp {
storage,
views: HashMap::new(),
};
Ok(Self { context, tree })
Ok(Self {
context,
dock_state,
})
}
}

Expand Down Expand Up @@ -381,15 +381,15 @@ impl eframe::App for PlotterApp {
let id = Id::new("egui_dock::DockArea");
let mut ui = Ui::new(ctx.clone(), layer_id, id, max_rect, clip_rect);

let mut style = self
let style = self
.context
.style
.get_or_insert(Style::from_egui(&ui.ctx().style()))
.clone();
style.show_close_buttons = true;
let mut tree = self.tree.lock().unwrap();
DockArea::new(&mut tree)
let mut dock_state = self.dock_state.lock().unwrap();
DockArea::new(&mut dock_state)
.style(style)
.show_close_buttons(true)
.show_inside(&mut ui, &mut self.context);
});
}
Expand Down

0 comments on commit efec562

Please sign in to comment.