diff --git a/bqplot/_version.py b/bqplot/_version.py index 51c6a169f..528f86d30 100644 --- a/bqplot/_version.py +++ b/bqplot/_version.py @@ -1,4 +1,4 @@ -version_info = (0, 12, 35, 'final', 0) +version_info = (0, 12, 36, 'final', 0) _specifier_ = {'alpha': 'a', 'beta': 'b', 'candidate': 'rc', 'final': ''} diff --git a/js/package.json b/js/package.json index f75953460..5d10a6cca 100644 --- a/js/package.json +++ b/js/package.json @@ -1,6 +1,6 @@ { "name": "bqplot", - "version": "0.5.36", + "version": "0.5.37", "description": "bqplot", "keywords": [ "jupyter", diff --git a/js/src/Figure.ts b/js/src/Figure.ts index 4aab89bc5..017944087 100644 --- a/js/src/Figure.ts +++ b/js/src/Figure.ts @@ -21,7 +21,7 @@ import * as popperreference from './PopperReference'; import popper from 'popper.js'; import * as THREE from 'three'; import { Dict, WidgetModel, WidgetView } from '@jupyter-widgets/base'; -import { applyAttrs, applyStyles } from './utils'; +import { applyAttrs, applyStyles, getLuminoWidget } from './utils'; import { Scale } from './Scale'; import { ScaleModel } from './ScaleModel'; import { AxisModel } from './AxisModel'; @@ -726,6 +726,7 @@ export class Figure extends widgets.DOMWidgetView { this.trigger('margin_updated'); } + // Phosphor shims update_plotarea_dimensions() { this.plotarea_width = this.width - this.margin.left - this.margin.right; this.plotarea_height = this.height - this.margin.top - this.margin.bottom; @@ -747,7 +748,7 @@ export class Figure extends widgets.DOMWidgetView { case 'resize': case 'after-show': case 'after-attach': - if (this.luminoWidget.isVisible) { + if (getLuminoWidget(this).isVisible) { this.debouncedRelayout(); } break; diff --git a/js/src/Mark.ts b/js/src/Mark.ts index 3e9efe372..a24a2cb2b 100644 --- a/js/src/Mark.ts +++ b/js/src/Mark.ts @@ -20,7 +20,7 @@ import { MessageLoop } from '@lumino/messaging'; import { Widget } from '@lumino/widgets'; -import { d3GetEvent } from './utils'; +import { d3GetEvent, getLuminoWidget } from './utils'; import * as _ from 'underscore'; import { MarkModel } from './MarkModel'; import { Figure } from './Figure'; @@ -316,7 +316,7 @@ export abstract class Mark extends widgets.WidgetView { null ); MessageLoop.sendMessage( - this.tooltip_view.luminoWidget, + getLuminoWidget(this.tooltip_view), Widget.Msg.AfterShow ); this.parent.popper.enableEventListeners(); @@ -366,9 +366,9 @@ export abstract class Mark extends widgets.WidgetView { this.create_child_view(tooltip_model).then((view) => { this.tooltip_view = view; - MessageLoop.sendMessage(view.luminoWidget, Widget.Msg.BeforeAttach); + MessageLoop.sendMessage(getLuminoWidget(view), Widget.Msg.BeforeAttach); this.tooltip_div.node().appendChild(view.el); - MessageLoop.sendMessage(view.luminoWidget, Widget.Msg.AfterAttach); + MessageLoop.sendMessage(getLuminoWidget(view), Widget.Msg.AfterAttach); }); } } diff --git a/js/src/MarketMap.ts b/js/src/MarketMap.ts index 29519e9cd..abcdcd3a4 100644 --- a/js/src/MarketMap.ts +++ b/js/src/MarketMap.ts @@ -28,7 +28,7 @@ import { Scale } from './Scale'; import { ColorScale } from './ColorScale'; import * as popperreference from './PopperReference'; import popper from 'popper.js'; -import { applyAttrs, applyStyles } from './utils'; +import { applyAttrs, applyStyles, getLuminoWidget } from './utils'; export class MarketMap extends Figure { protected renderImpl() { @@ -837,9 +837,9 @@ export class MarketMap extends Figure { tooltip_widget_creation_promise.then((view) => { that.tooltip_view = view as Tooltip; - MessageLoop.sendMessage(view.luminoWidget, Widget.Msg.BeforeAttach); + MessageLoop.sendMessage(getLuminoWidget(view), Widget.Msg.BeforeAttach); that.tooltip_div.node().appendChild(view.el); - MessageLoop.sendMessage(view.luminoWidget, Widget.Msg.AfterAttach); + MessageLoop.sendMessage(getLuminoWidget(view), Widget.Msg.AfterAttach); }); } } diff --git a/js/src/utils.ts b/js/src/utils.ts index ce7846f3b..b8742546f 100644 --- a/js/src/utils.ts +++ b/js/src/utils.ts @@ -13,6 +13,7 @@ * limitations under the License. */ +import { DOMWidgetView } from '@jupyter-widgets/base'; import * as d3 from 'd3'; // var d3 =Object.assign({}, require("d3-array"), require("d3-scale")); import isTypedArray from 'is-typedarray'; @@ -118,3 +119,8 @@ export function d3GetEvent() { // leading to a null event, for now we can use window.event as fallback. return require('d3-selection').event || window.event; } + +// Phosphor shim for ipywidgets 7 support +export function getLuminoWidget(ipywidget: DOMWidgetView) { + return ipywidget.pWidget ? ipywidget.pWidget : ipywidget.luminoWidget; +} diff --git a/js/yarn.lock b/js/yarn.lock index 21266142b..74c9c3744 100644 --- a/js/yarn.lock +++ b/js/yarn.lock @@ -1017,7 +1017,7 @@ base64-js "^1.2.1" sanitize-html "^2.3" -"@jupyter-widgets/base@^6.0.0": +"@jupyter-widgets/base@^2 || ^3 || ^4 || ^5 || ^6", "@jupyter-widgets/base@^6.0.0": version "6.0.0" resolved "https://registry.yarnpkg.com/@jupyter-widgets/base/-/base-6.0.0.tgz#e15047b383291715601eb1fc030c143bfd9e779e" integrity sha512-UntW6jBZtj4lrpgdUhd0QRPn13Ce8YeFVcSCp0dpTqjVwtz3ySn9OUiI++1iboDqzSGZ01w/y2HMj8HhqRVQSg==