-
Notifications
You must be signed in to change notification settings - Fork 46
Constraints-based layout #88
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
Conversation
enable/component.py
Outdated
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.
Not 100% sure, but these feel like they maybe should live on CoordinateBox (or a subclass of CoordinateBox) which Component inherits.
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.
Noted. Perhaps now is a good time to remove all the layout cruft from Component? CoordinateBox is a better place than Interactor...
|
Looking this over, this is an excellent addition, and important. The things that I wonder about:
We want to get this right, as if we do it will have important consequences for Enable and Chaco. |
|
Responses to each of your points:
|
They were never used by anything.
No references to this code were found in Enable or Chaco.
examples/enable/constraints_demo.py
Outdated
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.
Is a potential solution to the string problem here to have layout_box override __getattr__ for 'left', 'right', etc. to return layout_box.primitive('left'), etc. so we can say:
container.layout_box.left == one.layout_box.left
Not perfect, but it could be refined further, and would allow layout helpers to be added more easily.
- Implement contents constraints in the container - Expand layout helpers in the user-specified constraints
This should help with the layout helper debugging...
This means that layout helpers can accept components directly instead of a reference to the constraints namespace of the component.
We can revisit this once Components have a more robust way of supplying their size preferences.
- Supporting code was already removed from the layout manager.
|
I feel like this is ready for a full code review now. It does all the things I think it should do for a first cut. I've created several layouts with it in a reasonably complex customer project and it seems to be holding up well. |
|
I'm going to close this request and reopen with the target branch as "feature/layout-refactor" so that we can accumulate all these disruptive changes over time. |
This PR implements constraints-based layout of components in Enable.