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

Allow for perspective in ipywidgets layouts #702

Merged
merged 1 commit into from
Sep 2, 2019
Merged

Conversation

timkpaine
Copy link
Member

@timkpaine timkpaine commented Sep 2, 2019

fixes #694 without breaking in normal view

top: perspective in ipywidgets.HBox
bottom: normal

Screen Shot 2019-09-02 at 2 54 40 PM

@timkpaine
Copy link
Member Author

@vidartf

Copy link
Member

@texodus texodus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@texodus texodus merged commit cfca150 into master Sep 2, 2019
@texodus texodus deleted the ipywidgets_fix branch September 2, 2019 21:46
Copy link

@vidartf vidartf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good in principle. Added some comments that might make it a little cleaner.


_setElement(el: HTMLElement) {
if (this.el || el !== this.pWidget.node) {
// Accordions don't allow setting the element beyond the initial creation.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably shouldn't say "Accordions" ;)

@@ -119,98 +131,98 @@ class PerspectiveView extends DOMWidgetView {
this.model.on('msg:custom', this._update, this);

this.displayed.then(()=> {
this.psp._render();
(this.pWidget as PerspectiveWidget)._render();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be cleaner to override the declaration of pWidget for this class:

pWidget: PerspectiveWidget;

@@ -44,6 +44,7 @@ export type PerspectiveWidgetOptions = {
key?: string;
wrap?: boolean;
delete_?: boolean;
view?: any;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that it is also possible to extend PerspectiveWidget adding the view options similar to how JupyterPhosphorAccordionWidget does this in @jupyter-widgets/controls.

@timkpaine timkpaine mentioned this pull request Sep 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hook perspective into ipywidgets
4 participants