-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement very basic widget inspector #820
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should help make some things a bit easier to reason about.
Can we please also document this in Masonry's README/lib.rs?
let (widget, state) = self.render_root.widget_arena.get_pair(widget_id); | ||
let widget_name = widget.item.short_type_name(); | ||
let display_name = if let Some(debug_text) = widget.item.get_debug_text() { | ||
format!("{widget_name}<{debug_text}>") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unfortunately sparse for a lot of widgets. I suppose that makes a good follow-up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think I'll leave the exact format to a future follow-up. It can be a very self-contained future PR.
masonry/src/event_loop_runner.rs
Outdated
widget_name.into() | ||
}; | ||
println!("Widget selected in inspector: {widget_id} - {display_name}"); | ||
println!("{:#?}", state.item); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whereas this is extremely large. I don't necessarily think there's anything we can do about it though...
}; | ||
println!("Widget selected in inspector: {widget_id} - {display_name}"); | ||
println!("{:#?}", state.item); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There would be reasonable arguments for printing the broad shape of the children tree as well. Not necessarily the full widget state, but the names and debug text. Maybe? limited to a certain depth(/length?)
e40d86d
to
f282633
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a good basic inspector. It's nice that we can now toggle debug paint without messing with the environment variable.
Will probably merge tomorrow. |
I do agree with Daniel that some documentation in the README would be good. I needed to scan the code to find out how to use this. |
### Debugging features | ||
|
||
Masonry apps currently ship with two debugging features built in: | ||
- A rudimentary widget inspector - toggled by F11 key. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- A rudimentary widget inspector - toggled by F11 key. | |
- A rudimentary widget inspector - activated by F11 key. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically it can be toggled off with the key.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think "toggled" is right.
Do you think the Ubuntu failure has anything to do with Github Actions' switch from Ubuntu 22 to 24? |
@jaredoconnell Yes, and it is fixed on |
Alright, I'll rebase. |
73ea94e
to
87ba6af
Compare
No description provided.