Skip to content

Allow for perspective in ipywidgets layouts#702

Merged
texodus merged 1 commit intomasterfrom
ipywidgets_fix
Sep 2, 2019
Merged

Allow for perspective in ipywidgets layouts#702
texodus merged 1 commit intomasterfrom
ipywidgets_fix

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" ;)


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;

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

Development

Successfully merging this pull request may close these issues.

Hook perspective into ipywidgets

4 participants