silx
silx copied to clipboard
Added group item
This PR feature a Group plot item together with an example.
It is an intermediate implementation which doesn't stores the item as a tree representation, but instead still use the flat representation. In the other word, a group have no special meaning for a plot.
The link between a group and another item is just a relationship between 2 plot items.
This anyway allow to group items together.
- A group added/removed from a plot will update the plot with its childrens
- The visibility of the group will impact the visibility of the children
There is improvement that could be optionally tested:
- Expose the relationshit in the 2 directions (create a
Item.getParentItem()) - Handle the bouding box as a tree
- Handle the visibility as a tree
Changelog:
- Added a Group plot item
Adding a Group item while keeping the flat structure is not a good move IMO.
If the flat structure is maintained, the Group should not be an item of the plot, but more an object that allows to handle a couple of items (like changing visibility/adding-removing from plot) at once like matplotlib has Container to group Artists. That would be the intermediate step for me.
If Group is a plot item, then we need a proper tree structure of items.
A group which is not a plot item is pointless to me. Because anybody can already create such structure, but will still have to manage the life cycle of the children on it's own.
I would prefer not to create another extra layer of indirection in Flint. Because that's stuff which will never be shared back to silx.