diff --git a/Cargo.lock b/Cargo.lock index b3e6ac3..417f4df 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -345,7 +345,7 @@ checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.35", + "syn 2.0.36", ] [[package]] @@ -367,7 +367,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.35", + "syn 2.0.36", ] [[package]] @@ -384,7 +384,7 @@ checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.35", + "syn 2.0.36", ] [[package]] @@ -585,7 +585,7 @@ checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.35", + "syn 2.0.36", ] [[package]] @@ -697,7 +697,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.35", + "syn 2.0.36", ] [[package]] @@ -928,7 +928,7 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "ecolor" version = "0.22.0" -source = "git+https://github.com/emilk/egui?rev=481f448#481f44828cea1a679c5c65665ffc050e65b775f2" +source = "git+https://github.com/emilk/egui?rev=481f448#9c4f55b1f4c87362decada09dffece832eea40aa" dependencies = [ "bytemuck", "serde", @@ -937,7 +937,7 @@ dependencies = [ [[package]] name = "eframe" version = "0.22.0" -source = "git+https://github.com/emilk/egui?rev=481f448#481f44828cea1a679c5c65665ffc050e65b775f2" +source = "git+https://github.com/emilk/egui?rev=481f448#9c4f55b1f4c87362decada09dffece832eea40aa" dependencies = [ "bytemuck", "cocoa", @@ -952,6 +952,7 @@ dependencies = [ "js-sys", "log", "objc", + "parking_lot", "percent-encoding", "raw-window-handle", "ron", @@ -968,7 +969,7 @@ dependencies = [ [[package]] name = "egui" version = "0.22.0" -source = "git+https://github.com/emilk/egui?rev=481f448#481f44828cea1a679c5c65665ffc050e65b775f2" +source = "git+https://github.com/emilk/egui?rev=481f448#9c4f55b1f4c87362decada09dffece832eea40aa" dependencies = [ "accesskit", "ahash", @@ -979,19 +980,28 @@ dependencies = [ "serde", ] +[[package]] +name = "egui-notify" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d57ed9c398e24c1b9faf2c52cdc305dd29cb1d9dfa12a0166d254582bc47727a" +dependencies = [ + "egui", +] + [[package]] name = "egui-winit" version = "0.22.0" -source = "git+https://github.com/emilk/egui?rev=481f448#481f44828cea1a679c5c65665ffc050e65b775f2" +source = "git+https://github.com/emilk/egui?rev=481f448#9c4f55b1f4c87362decada09dffece832eea40aa" dependencies = [ "accesskit_winit", "arboard", "egui", - "instant", "log", "raw-window-handle", "serde", "smithay-clipboard", + "web-time", "webbrowser", "winit", ] @@ -999,16 +1009,19 @@ dependencies = [ [[package]] name = "egui_extras" version = "0.22.0" -source = "git+https://github.com/emilk/egui?rev=481f448#481f44828cea1a679c5c65665ffc050e65b775f2" +source = "git+https://github.com/emilk/egui?rev=481f448#9c4f55b1f4c87362decada09dffece832eea40aa" dependencies = [ "egui", + "enum-map", + "log", + "mime_guess", "serde", ] [[package]] name = "egui_glow" version = "0.22.0" -source = "git+https://github.com/emilk/egui?rev=481f448#481f44828cea1a679c5c65665ffc050e65b775f2" +source = "git+https://github.com/emilk/egui?rev=481f448#9c4f55b1f4c87362decada09dffece832eea40aa" dependencies = [ "bytemuck", "egui", @@ -1037,7 +1050,7 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "emath" version = "0.22.0" -source = "git+https://github.com/emilk/egui?rev=481f448#481f44828cea1a679c5c65665ffc050e65b775f2" +source = "git+https://github.com/emilk/egui?rev=481f448#9c4f55b1f4c87362decada09dffece832eea40aa" dependencies = [ "bytemuck", "serde", @@ -1052,6 +1065,27 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "enum-map" +version = "2.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c188012f8542dee7b3996e44dd89461d64aa471b0a7c71a1ae2f595d259e96e5" +dependencies = [ + "enum-map-derive", + "serde", +] + +[[package]] +name = "enum-map-derive" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04d0b288e3bb1d861c4403c1774a6f7a798781dfc519b3647df2a3dd4ae95f25" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.36", +] + [[package]] name = "enumflags2" version = "0.7.8" @@ -1070,7 +1104,7 @@ checksum = "f95e2801cd355d4a1a3e3953ce6ee5ae9603a5c833455343a8bfe3f44d418246" dependencies = [ "proc-macro2", "quote", - "syn 2.0.35", + "syn 2.0.36", ] [[package]] @@ -1081,7 +1115,7 @@ checksum = "c2ad8cef1d801a4686bfd8919f0b30eac4c8e48968c437a6405ded4fb5272d2b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.35", + "syn 2.0.36", ] [[package]] @@ -1100,7 +1134,7 @@ dependencies = [ [[package]] name = "epaint" version = "0.22.0" -source = "git+https://github.com/emilk/egui?rev=481f448#481f44828cea1a679c5c65665ffc050e65b775f2" +source = "git+https://github.com/emilk/egui?rev=481f448#9c4f55b1f4c87362decada09dffece832eea40aa" dependencies = [ "ab_glyph", "ahash", @@ -1291,7 +1325,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.35", + "syn 2.0.36", ] [[package]] @@ -1979,6 +2013,16 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "mime_guess" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +dependencies = [ + "mime", + "unicase", +] + [[package]] name = "minimal-lexical" version = "0.2.1" @@ -2197,7 +2241,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.35", + "syn 2.0.36", ] [[package]] @@ -2293,7 +2337,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.35", + "syn 2.0.36", ] [[package]] @@ -2409,7 +2453,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.35", + "syn 2.0.36", ] [[package]] @@ -2524,6 +2568,7 @@ dependencies = [ "clap", "eframe", "egui", + "egui-notify", "egui_extras", "egui_json_tree", "env_logger", @@ -2884,7 +2929,7 @@ checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.35", + "syn 2.0.36", ] [[package]] @@ -2906,7 +2951,7 @@ checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.35", + "syn 2.0.36", ] [[package]] @@ -3079,9 +3124,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.35" +version = "2.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59bf04c28bee9043ed9ea1e41afc0552288d3aba9c6efdd78903b802926f4879" +checksum = "91e02e55d62894af2a08aca894c6577281f76769ba47c94d5756bec8ac6e7373" dependencies = [ "proc-macro2", "quote", @@ -3133,7 +3178,7 @@ checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" dependencies = [ "proc-macro2", "quote", - "syn 2.0.35", + "syn 2.0.36", ] [[package]] @@ -3216,7 +3261,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.35", + "syn 2.0.36", ] [[package]] @@ -3378,7 +3423,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.35", + "syn 2.0.36", ] [[package]] @@ -3418,6 +3463,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "unicase" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" +dependencies = [ + "version_check", +] + [[package]] name = "unicode-bidi" version = "0.3.13" @@ -3487,7 +3541,7 @@ checksum = "f7e1ba1f333bd65ce3c9f27de592fcbc256dafe3af2717f56d7c87761fbaccf4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.35", + "syn 2.0.36", ] [[package]] @@ -3560,7 +3614,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.35", + "syn 2.0.36", "wasm-bindgen-shared", ] @@ -3594,7 +3648,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.35", + "syn 2.0.36", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3700,6 +3754,17 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "web-time" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19353897b48e2c4d849a2d73cb0aeb16dc2be4e00c565abfc11eb65a806e47de" +dependencies = [ + "js-sys", + "once_cell", + "wasm-bindgen", +] + [[package]] name = "webbrowser" version = "0.8.11" diff --git a/Cargo.toml b/Cargo.toml index 1128e8c..2b4cd88 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,13 +15,12 @@ opt-level = 2 # fast and small wasm [profile.dev.package."*"] opt-level = 2 - [patch.crates-io] - -# If you want to use the bleeding edge version of egui and eframe: -# egui = { git = "https://github.com/emilk/egui", branch = "master" } -# eframe = { git = "https://github.com/emilk/egui", branch = "master" } - -# If you fork https://github.com/emilk/egui you can test with: -# egui = { path = "../egui/crates/egui" } -# eframe = { path = "../egui/crates/eframe" } +egui = { git = "https://github.com/emilk/egui?rev=481f448" } +egui_extras = { git = "https://github.com/emilk/egui?rev=481f448" } +eframe = { git = "https://github.com/emilk/egui?rev=481f448" } + +[patch."https://github.com/emilk/egui"] +egui = { git = "https://github.com/emilk/egui?rev=481f448" } +egui_extras = { git = "https://github.com/emilk/egui?rev=481f448" } +eframe = { git = "https://github.com/emilk/egui?rev=481f448" } diff --git a/pubsubman/Cargo.toml b/pubsubman/Cargo.toml index a3ff4c7..28318dd 100644 --- a/pubsubman/Cargo.toml +++ b/pubsubman/Cargo.toml @@ -8,9 +8,9 @@ rust-version = "1.71" [dependencies] chrono = { workspace = true } -egui = { git = "https://github.com/emilk/egui", rev = "481f448" } -egui_extras = { git = "https://github.com/emilk/egui", rev = "481f448" } -eframe = { git = "https://github.com/emilk/egui", rev = "481f448", default-features = false, features = [ +egui = "0.22.0" +egui_extras = "0.22.0" +eframe = { version = "0.22.0", default-features = false, features = [ "accesskit", # Make egui comptaible with screen readers. NOTE: adds a lot of dependencies. "default_fonts", # Embed the default egui fonts. "glow", # Use the glow rendering backend. Alternative: "wgpu". @@ -27,3 +27,4 @@ tokio-util = { workspace = true } pubsubman_backend = { version = "0.1.0", path = "../pubsubman_backend" } serde_json = "1.0.104" clap = { version = "4.4.0", features = ["derive"] } +egui-notify = "0.9.0" diff --git a/pubsubman/src/app.rs b/pubsubman/src/app.rs index 64803e6..63ad9fa 100644 --- a/pubsubman/src/app.rs +++ b/pubsubman/src/app.rs @@ -1,5 +1,6 @@ use std::collections::{HashMap, HashSet}; +use egui_notify::Toasts; use pubsubman_backend::{ message::{BackendMessage, FrontendMessage}, model::{PubsubMessage, SubscriptionName, TopicName}, @@ -33,6 +34,7 @@ pub struct App { memory: Memory, front_tx: Sender, back_rx: Receiver, + toasts: Toasts, } impl App { @@ -63,6 +65,7 @@ impl App { memory, front_tx, back_rx, + toasts: Toasts::default(), } } @@ -72,6 +75,10 @@ impl App { BackendMessage::ClientInitialised => {} BackendMessage::TopicsUpdated(topic_names) => { self.topic_names = topic_names; + self.toasts + .info("Hello world!") + .set_show_progress_bar(false); + refresh_topics(&self.front_tx, Some(5000)); } BackendMessage::SubscriptionCreated(topic_name, sub_name) => { @@ -282,6 +289,12 @@ impl eframe::App for App { self.render_topics_panel(ctx); self.render_central_panel(ctx); self.handle_exit(ctx, frame); + + let ctx = ctx.clone(); + let mut style: egui::Style = (*ctx.style()).clone(); + style.visuals.widgets.noninteractive.bg_fill = egui::Color32::from_rgb(50, 50, 50); + ctx.set_style(style); + self.toasts.show(&ctx); } fn save(&mut self, storage: &mut dyn eframe::Storage) {