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

Closing modal on "Next" pressed in editors #4486

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

CoreyHendrey
Copy link
Contributor

@CoreyHendrey CoreyHendrey commented Sep 21, 2023

Brief Description of What This PR Does

Editors will now attempt to close all their open modals before continuing.
It will not let the editor continue if there is an exclusive modal open that refuses to close.

Closes #4470

Related Issues

Progress Checklist

Note: before starting this checklist the PR should be marked as non-draft.

  • PR author has checked that this PR works as intended and doesn't
    break existing features:
    https://wiki.revolutionarygamesstudio.com/wiki/Testing_Checklist
    (this is important as to not waste the time of Thrive team
    members reviewing this PR)
  • Initial code review passed (this and further items should not be checked by the PR author)
  • Functionality is confirmed working by another person (see above checklist link)
  • Final code review is passed and code conforms to the
    styleguide.

Before merging all CI jobs should finish on this PR without errors, if
there are automatically detected style issues they should be fixed by
the PR author. Merging must follow our
styleguide.

@hhyyrylainen hhyyrylainen added this to the Release 0.6.4 milestone Sep 21, 2023
@hhyyrylainen hhyyrylainen requested review from athariqk and a team September 21, 2023 08:33
/// Attempt to clear all open modals.
/// </summary>
/// <returns>Returns true if all modals were closed, false otherwise.</returns>
public bool ClearModals()
Copy link
Member

Choose a reason for hiding this comment

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

Would CloseAllOpenModals be a better name?

Copy link
Member

Choose a reason for hiding this comment

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

I think the current one is already good. This indeed clears modalStack by closing all.

Copy link
Member

@athariqk athariqk left a comment

Choose a reason for hiding this comment

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

The overall logical changes makes sense to me, but it had few things that needs to be addressed.

src/gui_common/ModalManager.cs Outdated Show resolved Hide resolved
src/gui_common/ModalManager.cs Outdated Show resolved Hide resolved
src/gui_common/ModalManager.cs Show resolved Hide resolved
@@ -125,6 +130,25 @@ public bool HideTopMostPopup()
return null;
}

/// <summary>
/// Attempts to hide the given modal.
/// This won't hide the modal if it's exclusive and doesn't allow closing on escape.
Copy link
Member

Choose a reason for hiding this comment

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

This bit is no longer true.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Woops! Good catch :)

/// <summary>
/// Attempt to clear all open modals.
/// </summary>
public void ClearModals()
Copy link
Member

Choose a reason for hiding this comment

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

Does the HideModal method cause a modal to be removed from the stack? If so doesn't the foreach cause a crash by continuing to iterate? Maybe instead the loop should check if the stack is empty and if not attempt to close the top most one.

If this doesn't remove the modals in the stack, then I'm still of the opinion that the name of this method is wrong and should really be something like ForceHideModals.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nah it doesn't remove from the stack, happy to rename it.

Copy link
Member

Choose a reason for hiding this comment

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

Alright, then the foreach doesn't crash. And yeah I'd really like it to be renamed if the method doesn't even "clear" the modals from the data structure.

@revolutionary-bot
Copy link

We are currently in feature freeze until the next release.
If your PR is not just a simple fix, then it may take until the release to get reviewed and merged.

@hhyyrylainen
Copy link
Member

What's the status on this? As far as I can quickly see my latest review comments weren't addressed yet.

@hhyyrylainen hhyyrylainen removed this from the Release 0.7.1 milestone Oct 25, 2024
@hhyyrylainen hhyyrylainen added this to the Release 0.8.0 milestone Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: started but stuck (help wanted)
Development

Successfully merging this pull request may close these issues.

Exiting the editor while organelle popup is open is possible and crashes the game
4 participants