-
Notifications
You must be signed in to change notification settings - Fork 42
Conversation
the main goal of allowing to collapse the data attached to a node has been achieved, although this makes #91 worse for me (the workaround of manually setting an arbitrary but sufficient absolute width works, though, so I'd expect this to be a relatively small fix). The tests are failing because they check equality with a predetermined expected string (which is called acceptance testing, apparently), so they either need to be updated or rewritten to use something similar to |
something that just occurred to me is that instead of (or in addition to?) adding a new "data" section we might want to collapse the entire node by clicking on its name. I'd imagine that to be a bit more difficult than the data section, though. Edit: actually, I see that's what was suggested in #91 Edit: and if we do use the data section we might want to disable it if there's no data? A collapsed |
Thanks for taking a stab at this @keewis !
Useful to know.
Yes I just went with something simple that worked as a test initially. |
@keewis could you upload some screenshots? It will be easier for the review. A more general comment: why not having a clearer distinction between the data sections and the tree node headers in the repr? Something like https://jsfiddle.net/98k7trvy/. This is a rough example that could be much improved, but it has the advantage of fixing #91 (data sections are less indented than headers, and subtle borders are used to distinguish between data sections). |
my knowledge of HTML and CSS is pretty limited, so I just used whatever was already available in Edit: oh, but we might want to keep the tree lines at the left |
No worries! The second screenshot looks already pretty nice. I'd set Even with the tree lines on the left, I still find that the current repr emphasizes the node data much more than the tree structure (perhaps this could be already improved using a darker gray for the node names), but maybe this is intentional? Also, I don't find Some nits:
|
the fixed width is a hack, as I had no idea how to fix it otherwise. I'm not sure how exactly Since fixing that might involve a fair amount of debugging (even though I expect the fix to be pretty small), maybe it would be better to just reimplement the whole repr using your suggestions? Those do sound good to me, and I had been somewhat discontent with the collapsible |
@keewis sorry I forgot about this. Is it still relevant? |
yes it is, but I think we're better off redesigning the HTML repr. This is something I wouldn't know too much about (I'm not very familiar with HTML / CSS), but maybe we can make use of |
FWIW, https://github.com/benbovy/xarray-fancy-repr uses |
I agree, we should put this on hold until the merge is done (and no worries if it ends up taking longer) |
Closing this as potentially useful but tracked upstream by pydata/xarray#9343. Feel free to re-open a new PR upstream. |
groups
DataTree #145pre-commit run --all-files
docs/source/whats-new.rst
In the process I refactored the code to:
xarray
's html formatting codeHowever, I'm not proficient with CSS so I'd appreciate someone looking over this. @benbovy, might I ask you for a review when you have time?
Some new issues:
the attrs of the node data seem to now be connected to the data vars: only attrs disappear when toggled if the data vars are collapsed.fixed by putting the sections into<ul>
/<li>
tagsSome old issues:
xr-sections
class of the sections withwidth: 1200px
temporarily fixes that issue for me, so I'd assume there's not enough space for the data?