From 7cd3f5b604ff04b7d2997679b22b0ced18519662 Mon Sep 17 00:00:00 2001 From: Jack Crump-Leys <51773589+JackCrumpLeys@users.noreply.github.com> Date: Mon, 29 Jul 2024 10:14:45 +1200 Subject: [PATCH] update egui (#638) Update egui. Ticks off #620 point 3 --- Cargo.toml | 34 +++++++++---------- tools/packet_inspector/src/app/packet_list.rs | 26 ++++++++++---- tools/packet_inspector/src/main.rs | 2 +- tools/packet_inspector/src/tri_checkbox.rs | 1 + 4 files changed, 39 insertions(+), 24 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4c798bd5d..ba241e2d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -110,7 +110,7 @@ aes = "0.8.4" anyhow = { version = "1.0.86", features = ["backtrace"] } approx = "0.5.1" arrayvec = "0.7.4" -async-trait = "0.1.80" +async-trait = "0.1.81" atty = "0.2.14" base64 = "0.22.1" bevy_app = { version = "0.14.0", default-features = false } @@ -125,32 +125,32 @@ bevy_utils = { version = "0.14.0" } bitfield-struct = "0.8.0" bitvec = "1.0.1" byteorder = "1.5.0" -bytes = "1.6.0" +bytes = "1.6.1" cesu8 = "1.1.0" cfb8 = "0.8.1" -clap = { version = "4.5.7", features = ["derive"] } +clap = { version = "4.5.11", features = ["derive"] } derive_more = "1.0.0-beta.6" directories = "5.0.1" divan = "0.1.14" -eframe = { version = "0.27.2" } -egui = "0.27.2" -egui_dock = "0.12" +eframe = { version = "0.28.1" } +egui = "0.28.1" +egui_dock = "0.13" flate2 = "1.0.30" flume = "0.11.0" fs_extra = "1.3.0" glam = "0.28.0" heck = "0.5.0" hmac = "0.12.1" -image = "0.25.1" +image = "0.25.2" indexmap = "2.2.6" itertools = "0.13.0" java_string = { path = "crates/java_string", version = "0.1.2" } lru = "0.12.3" noise = "0.9.0" num = "0.4.3" -num-bigint = "0.4.5" +num-bigint = "0.4.6" owo-colors = "4.0.0" -ordered-float = "4.2.0" +ordered-float = "4.2.1" parking_lot = "0.12.3" paste = "1.0.15" petgraph = "0.6.5" @@ -165,22 +165,22 @@ rfd = "0.14.1" rsa = "0.9.6" rsa-der = "0.3.0" rustc-hash = "2.0.0" -serde = "1.0.203" +serde = "1.0.204" serde-value = "0.7.0" -serde_json = "1.0.117" +serde_json = "1.0.121" sha1 = "0.10.6" sha2 = "0.10.8" -syn = "2.0.67" +syn = "2.0.72" syntect = { version = "5.2.0", default-features = false } tempfile = "3.10.1" -thiserror = "1.0.61" +thiserror = "1.0.63" time = "0.3.36" -tokio = { version = "1.38.0", features = ["full"] } -toml = "0.8.14" +tokio = { version = "1.39.2", features = ["full"] } +toml = "0.8.16" tracing = "0.1.40" tracing-subscriber = "0.3.18" url = { version = "2.5.2", features = ["serde"] } -uuid = "1.8.0" +uuid = "1.10.0" valence = { path = ".", version = "0.2.0-alpha.1" } valence_advancement = { path = "crates/valence_advancement", version = "0.2.0-alpha.1" } valence_anvil = { path = "crates/valence_anvil", version = "0.1.0" } @@ -209,7 +209,7 @@ valence_server_common = { path = "crates/valence_server_common", version = "0.2. valence_text = { path = "crates/valence_text", version = "0.2.0-alpha.1" } valence_weather = { path = "crates/valence_weather", version = "0.2.0-alpha.1" } valence_world_border = { path = "crates/valence_world_border", version = "0.2.0-alpha.1" } -zip = "2.1.3" +zip = "2.1.5" [workspace.lints.rust] # missing_debug_implementations = "warn" # TODO: enable me.` diff --git a/tools/packet_inspector/src/app/packet_list.rs b/tools/packet_inspector/src/app/packet_list.rs index 574e5f963..aa1b9366d 100644 --- a/tools/packet_inspector/src/app/packet_list.rs +++ b/tools/packet_inspector/src/app/packet_list.rs @@ -1,6 +1,7 @@ use eframe::epaint::PathShape; use egui::{ - Color32, Pos2, Rect, Response, Rgba, Sense, Shape, Stroke, TextStyle, Ui, Vec2, WidgetText, + Color32, Pos2, Rect, Response, Rgba, Sense, Shape, Stroke, TextStyle, TextWrapMode, Ui, Vec2, + WidgetText, }; use packet_inspector::Packet; use valence_protocol::PacketSide; @@ -155,15 +156,28 @@ fn draw_packet_widget(ui: &mut Ui, packet: &Packet, selected: bool) -> Response let identifier: WidgetText = format!("0x{:0>2X?}", packet.id).into(); - let identifier = - identifier.into_galley(ui, Some(false), rect.width() - 21.0, TextStyle::Button); + let identifier = identifier.into_galley( + ui, + Some(TextWrapMode::Truncate), + rect.width() - 21.0, + TextStyle::Button, + ); let label: WidgetText = packet.name.into(); - let label = label.into_galley(ui, Some(false), rect.width() - 60.0, TextStyle::Button); + let label = label.into_galley( + ui, + Some(TextWrapMode::Truncate), + rect.width() - 60.0, + TextStyle::Button, + ); let timestamp: WidgetText = systemtime_strftime(packet.timestamp.unwrap()).into(); - let timestamp = - timestamp.into_galley(ui, Some(false), rect.width() - 60.0, TextStyle::Button); + let timestamp = timestamp.into_galley( + ui, + Some(TextWrapMode::Truncate), + rect.width() - 60.0, + TextStyle::Button, + ); let id_and_timestamp_color = if selected { text_color diff --git a/tools/packet_inspector/src/main.rs b/tools/packet_inspector/src/main.rs index 4d8e049eb..529f1f2ba 100644 --- a/tools/packet_inspector/src/main.rs +++ b/tools/packet_inspector/src/main.rs @@ -22,7 +22,7 @@ async fn main() -> Result<(), Box> { Box::new(move |cc| { let gui_app = app::GuiApp::new(cc); - Box::new(gui_app) + Ok(Box::new(gui_app)) }), )?; diff --git a/tools/packet_inspector/src/tri_checkbox.rs b/tools/packet_inspector/src/tri_checkbox.rs index 7b57a3cff..ec76b3264 100644 --- a/tools/packet_inspector/src/tri_checkbox.rs +++ b/tools/packet_inspector/src/tri_checkbox.rs @@ -80,6 +80,7 @@ impl<'a> Widget for TriCheckbox<'a> { WidgetInfo::selected( WidgetType::Checkbox, *checked == TriCheckboxState::Enabled, + false, text.as_ref().map_or("", |x| x.text()), ) });