-
-
Notifications
You must be signed in to change notification settings - Fork 517
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
Interactive layout fixes #136
Conversation
23041da
to
466a908
Compare
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.
Looks good. What does the representation of an interactive object look like now?
@@ -118,8 +138,7 @@ def _get_model(self, doc, root=None, parent=None, comm=None): | |||
objects = self._get_objects(model, [], doc, root, comm) | |||
|
|||
# HACK ALERT: Insert Spacer if last item in Column has no height | |||
if (isinstance(self, Column) and objects and not isinstance(objects[-1], (BkWidgetBox, BkBox)) | |||
and getattr(objects[-1], 'height', False) is None): | |||
if (isinstance(self, Column) and objects and no_height(objects[-1])): | |||
objects.append(BkSpacer(height=50)) |
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.
Add a parameter default_height
? Could be useful e.g. for the report mode dashboards...
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.
Where would the parameter live, on Column? I'd be happy to add it but maybe in a separate PR.
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.
Well, height=50 is used here on Panel, so presumably on Panel, so that it can be height=self.default_height
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.
It's specifically behind an isinstance check for Column to avoid having to duplicate the whole method there.
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.
That said I could add an equivalent check for Row:
(isinstance(self, Row) and objects and not any(has_height(o) for o in objects))
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.
Merging this, but I can follow up on this tomorrow.
ea6b564
to
40bc2ba
Compare
I'm seeing errors on this PR with "ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()" with https://anaconda.org/jbednar/datashadercliffordinteract/notebook |
Not sure how that could be caused by this PR. |
Not sure either, just that it works with master (v0.2.0a4-1-ge98e151) and not with this branch (v0.2.0a4-6-g40bc2ba). |
Looks like an issue in the repr. |
5508757
to
8ef9984
Compare
8ef9984
to
a383e5b
Compare
Codecov Report
@@ Coverage Diff @@
## master #136 +/- ##
==========================================
+ Coverage 89.88% 89.92% +0.04%
==========================================
Files 28 28
Lines 4181 4209 +28
==========================================
+ Hits 3758 3785 +27
- Misses 423 424 +1
Continue to review full report at Codecov.
|
This change really improved the usability of what's returned by interact(), and I've updated https://anaconda.org/jbednar/datashadercliffordinteract/notebook to reflect that. Now, the repr is something even more clear and clearly usable:
So it's now obvious that one can do |
The interactive layout was previously self-referential which causes issues when trying to display the plot/display component on its own. Additionally this ensures that a small fixes to assign a minimal height when no height is specified for the last item in a Column.