Skip to content

Refactor EditorToaster, adding a Toast class and Actions#117700

Open
jaydensipe wants to merge 1 commit intogodotengine:masterfrom
jaydensipe:refactor-toast
Open

Refactor EditorToaster, adding a Toast class and Actions#117700
jaydensipe wants to merge 1 commit intogodotengine:masterfrom
jaydensipe:refactor-toast

Conversation

@jaydensipe
Copy link
Copy Markdown
Contributor

@jaydensipe jaydensipe commented Mar 21, 2026

Warning

This is now waiting on implementation approval to further proceed. Please leave any suggestions on the proposal linked below.

Closes godotengine/godot-proposals#14510.
Closes godotengine/godot-proposals#8155 _(a Copy button was implemented in the past).
Closes #57488 (Clear All button idea from @snailrhymer).
Closes godotengine/godot-proposals#8157 (implemented as a Clear All button).

This PR refactors the EditorToaster internals by introducing a Toast class that can be returned by push_toast(). This allows us to then specify Actions that can be attached to this toast notification.

These Actions are essentially buttons that can be assigned a Callable, which then allows you to implement a function call to do various things.

This PR also adds a Clear All button as a nicety to the notification menu.

--

  • Write Documentation (waiting on implementation approval).
  • instant_close or close(instant: bool)?
Screen.Recording.2026-03-24.052849.mp4
Old Video for Reference
Screen.Recording.2026-03-21.044334.mp4

@jaydensipe jaydensipe requested review from a team as code owners March 21, 2026 08:59
@Nintorch Nintorch added this to the 4.x milestone Mar 21, 2026
@Nintorch Nintorch requested a review from a team March 21, 2026 09:45
@arkology
Copy link
Copy Markdown
Contributor

  1. If window size is small, notification may go out of window.
Before After
Godot_v4 6 1-stable_win64_iLsOUhlMFp godot windows editor x86_64_sPrLpoIbbz
  1. Maybe this is intended, but now there's no "hide progressbar" (idk how to call it properly):
Before After
Godot_v4.6.1-stable_win64_RsgOsnCK5x.mp4
godot.windows.editor.x86_64_i7DoZkoxwZ.mp4
  1. As a suggestion - do not autohide notifications not only when they are hovered by mouse, but also when clear/silence buttons are hovered.

@jaydensipe
Copy link
Copy Markdown
Contributor Author

  1. If window size is small, notification may go out of window.

Fixed for now, but I do want the toast to support autowrap, instead of just cutting off the text.

  1. Maybe this is intended, but now there's no "hide progressbar" (idk how to call it properly):

Fixed, has a slightly ugly border when progress goes down, will fix soon.

  1. As a suggestion - do not autohide notifications not only when they are hovered by mouse, but also when clear/silence buttons are hovered.

Done!

@jaydensipe jaydensipe force-pushed the refactor-toast branch 3 times, most recently from a334618 to fc54268 Compare March 24, 2026 06:06
@jaydensipe
Copy link
Copy Markdown
Contributor Author

@AThousandShips Yo, thanks for the review, applied all changes!

Also just curious, what is the rationale behind PRs behind marked as breaks compat? This instance should be completely compatible with the existing system, as the new Action stuff is completely optional, but if there is a another reason I def wanna know for future reference.

@AThousandShips
Copy link
Copy Markdown
Member

You changed the return argument of the method, this isn't a critical change of compat but it's still relevant to flag

@jaydensipe jaydensipe marked this pull request as draft March 24, 2026 09:33
@jaydensipe
Copy link
Copy Markdown
Contributor Author

Code-wise this is pretty much done now I'd say. Now just waiting on review to write documentation and to see if this is the API we want to finalize.

@jaydensipe jaydensipe marked this pull request as ready for review March 24, 2026 10:12
@AThousandShips
Copy link
Copy Markdown
Member

I'd suggest fixing the documentation change and making the adjustments for compatibility, see here for instructions, so all the CI can complete and verify everything works

@jaydensipe jaydensipe requested a review from a team as a code owner March 25, 2026 05:06
@jaydensipe jaydensipe force-pushed the refactor-toast branch 2 times, most recently from 78b99b6 to 843e536 Compare March 25, 2026 05:41
@jaydensipe jaydensipe requested review from a team as code owners March 25, 2026 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

4 participants