summaryrefslogtreecommitdiff
path: root/graph-checker/src/gui.rs
diff options
context:
space:
mode:
Diffstat (limited to 'graph-checker/src/gui.rs')
-rw-r--r--graph-checker/src/gui.rs18
1 files changed, 16 insertions, 2 deletions
diff --git a/graph-checker/src/gui.rs b/graph-checker/src/gui.rs
index 2a363e2..d18523c 100644
--- a/graph-checker/src/gui.rs
+++ b/graph-checker/src/gui.rs
@@ -2,9 +2,13 @@ use crate::compute;
use crate::geng::GengIterator;
use crate::graph;
use eframe::egui;
+use futures::executor::block_on;
use std::sync::mpsc;
use std::time::{Duration, Instant};
use tokio;
+// use tokio::sync::mpsc;
+
+pub enum ComputeMessage
pub fn run_gui(rt: tokio::runtime::Runtime) {
let options = eframe::NativeOptions::default();
@@ -52,21 +56,31 @@ impl<'a> ComputeWindow<'a> {
}
}
+ fn compute_graphs(&mut self) {}
+
fn update(&mut self, ui: &mut egui::Ui) {
if ui.button("Посчитать графы").clicked() {
- let gi = GengIterator::new(7);
+ let gi = GengIterator::new(4);
let _tasks: Vec<_> = gi
.map(|g| {
// let db = db.clone();
let tx = self.tx.clone();
self.rt.spawn(async move {
- tx.send(compute::async_theorems1(g).await).unwrap();
+ let res = compute::async_theorems1(g).await;
+ println!("{res:?}");
+ match tx.send(res) {
+ Ok(g) => println!("{g:?}"),
+ Err(e) => println!("{e}"),
+ }
})
})
.collect();
+ block_on(async { futures::future::join_all(_tasks).await });
+ // let res = futures::future::join_all(_tasks).await;
}
if let Ok(p) = self.rx.recv_timeout(Duration::from_millis(10)) {
+ println!("push");
self.computed.push(p);
}