Skip to content
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

Merged
merged 5 commits into from
Jan 15, 2025
Merged

Implement very basic widget inspector #820

merged 5 commits into from
Jan 15, 2025

Conversation

PoignardAzur
Copy link
Contributor

No description provided.

Copy link
Member

@DJMcNab DJMcNab left a 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?

masonry/src/passes/update.rs Show resolved Hide resolved
masonry/src/tracing_backend.rs Outdated Show resolved Hide resolved
masonry/src/passes/event.rs Show resolved Hide resolved
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}>")
Copy link
Member

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?

Copy link
Contributor Author

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.

widget_name.into()
};
println!("Widget selected in inspector: {widget_id} - {display_name}");
println!("{:#?}", state.item);
Copy link
Member

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);
}
Copy link
Member

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?)

Copy link
Contributor

@jaredoconnell jaredoconnell left a 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.

@PoignardAzur
Copy link
Contributor Author

Will probably merge tomorrow.

@jaredoconnell
Copy link
Contributor

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- A rudimentary widget inspector - toggled by F11 key.
- A rudimentary widget inspector - activated by F11 key.

Copy link
Contributor

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.

Copy link
Contributor Author

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.

@jaredoconnell
Copy link
Contributor

Do you think the Ubuntu failure has anything to do with Github Actions' switch from Ubuntu 22 to 24?

@waywardmonkeys
Copy link
Contributor

@jaredoconnell Yes, and it is fixed on main

@PoignardAzur
Copy link
Contributor Author

Alright, I'll rebase.

@PoignardAzur PoignardAzur added this pull request to the merge queue Jan 15, 2025
Merged via the queue into main with commit e7ed917 Jan 15, 2025
17 checks passed
@PoignardAzur PoignardAzur deleted the add_inspector_2 branch January 15, 2025 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants