Explain self.app
in the guide more explicitly [Documentation]
#5975
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please review the following checklist.
So a bit of explanation, I noticed from combing through the guide, and from general experience helping people in the Discord server, that the
self.app
attribute is not explicitly explained anywhere in the guide. I figured a PR would be in order to add an explicit explanation somewhere (If there is already a place in the guide whereself.app
is actually explained, please do point it out. But I'm pretty sure there is no explanation.)self.app
is used in 3 examples: The first two are in the Screens section,modal01.py
andmodal02.py
(which are two versions of the same example). The third is in the Command Palette section, in thecommand02.py
example.I figured the place it would make most sense to explain it would be right after its first used in the Screens section. There I added a paragraph that is a normal in-line section of the guide. I thought that was appropriate here, since in my opinion it is fairly essential information pertaining to the example.
I also placed a second admonition in the Command Palette section. That's because Command Providers are not widgets or screens (don't inherit from Message Pump), yet they have the self.app attribute tacked on anyway, and they're I believe one of 2 or 3 Textual objects that also have it added. So I thought an extra admonition here would be appropriate to make it clear that this is not on every Textual object, it was just added on here.
What do you think? I have a feeling this should be explained more explicitly somewhere at least. Happy to change any wording or move stuff around.