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

Reordered attribute priming in Node.__init__ #239

Merged
merged 2 commits into from
Dec 2, 2024

Conversation

HalfWhitt
Copy link
Contributor

@HalfWhitt HalfWhitt commented Dec 2, 2024

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:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

Makes sense - 👍

@freakboy3742 freakboy3742 merged commit ca28d56 into beeware:main Dec 2, 2024
9 checks passed
@HalfWhitt HalfWhitt deleted the parent-order branch December 17, 2024 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants