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

Provide public API for accessing _props, _classes and _style. #3588

Merged
merged 10 commits into from
Aug 29, 2024
Merged

Conversation

falkoschindler
Copy link
Contributor

@falkoschindler falkoschindler commented Aug 24, 2024

This PR introduces a Props class derived from dict to replace the props() method. By implementing the __call__ method, the new .props property can be called like before, but also accessed like a dictionary. This allows reading and writing the props dictionary without accessing the private _props attribute. Furthermore it moves most of the rather complex parsing logic into a separate file, relieving the pretty long element.py module.

Currently this PR is only a draft. If we like the idea, we should

  • fix pytests
  • apply the same concept to .classes and .style
  • fix linting errors in ui.query
  • fix linting errors in ui.tree and ui.menu
  • use the new API in tests, documentation and examples

@falkoschindler falkoschindler added the enhancement New feature or request label Aug 24, 2024
@falkoschindler falkoschindler added this to the 2.x milestone Aug 24, 2024
tests/test_element.py Outdated Show resolved Hide resolved
@falkoschindler falkoschindler changed the title Provide public API for accessing the _props dictionary. Provide public API for accessing _props, _classes and _style. Aug 28, 2024
@falkoschindler falkoschindler marked this pull request as ready for review August 28, 2024 15:34
@falkoschindler falkoschindler modified the milestones: 2.x, 1.4.37 Aug 28, 2024
@rodja rodja merged commit 392e0d0 into main Aug 29, 2024
7 checks passed
@rodja rodja deleted the props branch August 29, 2024 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants