Reordered attribute priming in Node.__init__ #239
Merged
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.
One more minor thing... while testing beeware/toga#2942 against multiple versions of Travertino, I'd mistakenly been ignoring some RuntimeWarnings on main, not just on 0.3.0.
Toga doesn't normally provide an applicator to
Node.__init__
, but ExampleNode in the tests does. When that happens, styles are applied, meaning the logic for setting hiddenness checks the node's parent, and that attribute wasn't being primed until afterward.(An alternative would be to alter the property to return
getattr(self, "_parent", None)
, which I've avoided here for consistency with explicit priming. But it could be an option down the line for node attributes, if complexities in Pack and/or other layout engines cause any conflicting needs for the order in which they're available.)There's no reason root needs to be primed earlier as well, but conceptually I wanted to keep the "up" direction grouped together. Makes a nice "above - here - below" order now.
PR Checklist: