-
Notifications
You must be signed in to change notification settings - Fork 780
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
Implements screen modes #2540
Implements screen modes #2540
Conversation
@rodrigogiraoserrao Where are we with this? Is it in progress or are you blocked? |
I'm waiting for you to give feedback on this iteration of the API. |
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.
Looks good! just one request.
src/textual/app.py
Outdated
@@ -680,15 +728,17 @@ def screen(self) -> Screen: | |||
ScreenStackError: If there are no screens on the stack. | |||
""" | |||
try: | |||
return self._screen_stack[-1] | |||
return self._screen_stacks[self._current_mode][-1] |
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.
Could you have a property for self._screen_stacks[self._current_mode][-1]
? Seems to pop up in a few places. It could be name _screen_stack
?
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.
Did you mean to ask for a property for self._screen_stacks[self._current_mode]
?
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 is already a screen_stack
property that returns a copy of the current stack but in some places I want the actual stack.
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.
How about a _screen_stack
property then?
@@ -159,6 +159,38 @@ class ScreenStackError(ScreenError): | |||
"""Raised when trying to manipulate the screen stack incorrectly.""" | |||
|
|||
|
|||
class ModeError(Exception): |
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 just noticed while looking in app.py at something else (a week or so after this PR was merged), all of the ModeError
classes seem to have been duplicated.
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.
Fixed in #2715.
What a weird thing, though...
As it stands, the modes "work" but the API feels a bit rough.
Discussion in the related issue: #2327
The app below lets you play with modes.
Press 1 and 2 to switch between modes 1 and 2.
Press P to push random fruit modals into the screen.
Press O to pop a screen from the stack.
Demo code.
This will close #2327