-
Notifications
You must be signed in to change notification settings - Fork 23
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
replace() doesn't add the replaced screen onto the stack #63
Comments
Trying to use Expected outcome: Actual outcome: |
Ok, so first of all there was a a problem in the code where an error wasn't caught and handled properly. This has been fixed. BUT the new replace functionality is a bit tricky: When show() is called the first thing that happens is that any open popups are called, unless the new screen is also a popup and the "popup on popup" option is enabled on the current popup. The replace functionality comes into play first AFTER the popups are closed. This results in:
So the question is what the expected behavior is when popups exist? I mean, say you have a screen and then two popups in the stack: [S1, P1, P2]. What happens if you replace/pop with a normal screen? You can't expect to have [S1, P1, S2]. The only logical thing is for popups to first close and then replace which in the example would mean [S2] in the stack. But it also means that using replace() with popups is a bit weird: [S1, P1] - replace(P2) -> [P2]? Replace is the normal behavior when showing one popup on top of another (unless popup on popup is allowed). Thoughts on this @dapetcu21 ? |
Yes, I agree. In the case where you're replacing with another screen, we should definitely do the replace after all the popups are closed. As you pointed out, when you're replacing with a popup with popup on popup enabled, the situation is a bit tricky. We could either leave it as is, or I propose we do the following: Treat the popup and screen sections of the stack separately. If the screen that is to be shown/replaced is a popup, then do all the If the screen that is to be shown/replaced is a screen, then pop all the popups, then do all the |
Some examples of that behaviour: |
Yes, this is probably the way forward to properly handle all cases. |
I'll do a PR, then |
If you have the time that would be great! |
Can confirm that replace now works as I presumed it would! 👍 |
I noticed today that if I do Example: The stack will become |
I'm trying to reproduce this in the example that ships with Monarch by modifying the two popups "about" and "confirm":
If I understood your bug report it would mean that when the Confirm popup is on the top of the stack and when confirm.gui_script calls replace("confirm") it would get removed but not added back. Could you please create a small example? |
Not able to reproduce and no sample project provided. Closing. |
Calling replace doesn't seem to add the replaced screen on the stack
The print output is this
When I call
monarch.replace
twice in a row the second time the screen doesn't show. By explicitly sayingpop=0
I can get the item to show. Though I still do not get themonarch.dump_stack()
I expect.The text was updated successfully, but these errors were encountered: