mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 04:40:03 -04:00
Add egui_inspection protocol and plugin (#8234)
Introduces live inspection for running egui apps over a small TCP request/response protocol, plus the `egui::Plugin` that serves it. This is the minimal surface to get the egui mcp in, we may want to extend this in the future to add support for the inspection gui. --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -72,6 +72,9 @@ serde = { workspace = true, optional = true }
|
||||
|
||||
# native:
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
# Always enable eframe's `inspection` feature on native so `EGUI_INSPECTION=1 cargo run -p
|
||||
# egui_demo_app` opens an inspection port for `egui_mcp` (no-op when the env var is unset).
|
||||
eframe = { workspace = true, features = ["inspection"] }
|
||||
env_logger = { workspace = true, features = ["auto-color", "humantime"] }
|
||||
mimalloc.workspace = true
|
||||
rfd = { workspace = true, optional = true }
|
||||
|
||||
@@ -5,8 +5,8 @@ use accesskit_consumer::{FilterResult, Node, NodeId, Tree, TreeChangeHandler};
|
||||
|
||||
use eframe::epaint::text::TextWrapMode;
|
||||
use egui::{
|
||||
Button, Color32, Event, Frame, FullOutput, Id, Key, KeyboardShortcut, Label, Modifiers, Panel,
|
||||
RawInput, RichText, ScrollArea, Ui, collapsing_header::CollapsingState,
|
||||
Button, Color32, Context, Event, Frame, FullOutput, Id, Key, KeyboardShortcut, Label,
|
||||
Modifiers, Panel, RawInput, RichText, ScrollArea, Ui, collapsing_header::CollapsingState,
|
||||
};
|
||||
|
||||
/// This [`egui::Plugin`] adds an inspector panel.
|
||||
@@ -46,7 +46,7 @@ impl egui::Plugin for AccessibilityInspectorPlugin {
|
||||
"Accessibility Inspector"
|
||||
}
|
||||
|
||||
fn input_hook(&mut self, input: &mut RawInput) {
|
||||
fn input_hook(&mut self, _ctx: &Context, input: &mut RawInput) {
|
||||
if let Some(queued_action) = self.queued_action.take() {
|
||||
input
|
||||
.events
|
||||
@@ -54,7 +54,7 @@ impl egui::Plugin for AccessibilityInspectorPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
fn output_hook(&mut self, output: &mut FullOutput) {
|
||||
fn output_hook(&mut self, _ctx: &Context, output: &mut FullOutput) {
|
||||
if let Some(update) = output.platform_output.accesskit_update.clone() {
|
||||
self.tree = match mem::take(&mut self.tree) {
|
||||
None => {
|
||||
|
||||
Reference in New Issue
Block a user