From e6eceeb2a809a538da15b4fbf99d389ede534908 Mon Sep 17 00:00:00 2001 From: Sylvain Corlay Date: Wed, 8 Jan 2020 11:11:16 +0100 Subject: [PATCH] Remove deprecated overflow properties --- docs/source/examples/Variable Inspector.ipynb | 10 +++--- docs/source/examples/Widget Styling.ipynb | 2 -- ipywidgets/widgets/widget_layout.py | 9 ----- packages/base/src/widget_layout.ts | 36 ------------------- packages/schema/jupyterwidgetmodels.latest.md | 2 -- 5 files changed, 4 insertions(+), 55 deletions(-) diff --git a/docs/source/examples/Variable Inspector.ipynb b/docs/source/examples/Variable Inspector.ipynb index 3350e3d3e1..fe62c1c90e 100644 --- a/docs/source/examples/Variable Inspector.ipynb +++ b/docs/source/examples/Variable Inspector.ipynb @@ -58,7 +58,7 @@ " self.namespace.shell = ipython.kernel.shell\n", " \n", " self._box = widgets.Box()\n", - " self._box.layout.overflow_y = 'scroll'\n", + " self._box.layout.overflow = 'visible scroll'\n", " self._table = widgets.HTML(value = 'Not hooked')\n", " self._box.children = [self._table]\n", " \n", @@ -80,10 +80,8 @@ " ''.join(['{0}{1}{2}'.format(v, type(eval(v)).__name__, str(eval(v))) for v in values]) + \\\n", " ''\n", "\n", - " def _ipython_display_(self):\n", - " \"\"\"Called when display() or pyout is used to display the Variable \n", - " Inspector.\"\"\"\n", - " self._box._ipython_display_()\n" + " def _repr_mimebundle_(self, **kwargs):\n", + " return self._box._repr_mimebundle_(**kwargs)" ] }, { @@ -181,7 +179,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.2" + "version": "3.7.3" } }, "nbformat": 4, diff --git a/docs/source/examples/Widget Styling.ipynb b/docs/source/examples/Widget Styling.ipynb index 8f8432091d..260c89d1b6 100644 --- a/docs/source/examples/Widget Styling.ipynb +++ b/docs/source/examples/Widget Styling.ipynb @@ -52,8 +52,6 @@ "- `visibility`\n", "- `display`\n", "- `overflow`\n", - "- `overflow_x` (deprecated) \n", - "- `overflow_y` (deprecated)\n", "\n", "#### Box model\n", "\n", diff --git a/ipywidgets/widgets/widget_layout.py b/ipywidgets/widgets/widget_layout.py index 7e56428004..692bdbb3bb 100644 --- a/ipywidgets/widgets/widget_layout.py +++ b/ipywidgets/widgets/widget_layout.py @@ -54,8 +54,6 @@ class Layout(Widget): min_height = Unicode(None, allow_none=True, help="The min-height CSS attribute.").tag(sync=True) min_width = Unicode(None, allow_none=True, help="The min-width CSS attribute.").tag(sync=True) overflow = Unicode(None, allow_none=True, help="The overflow CSS attribute.").tag(sync=True) - overflow_x = CaselessStrEnum(['visible', 'hidden', 'scroll', 'auto'] + CSS_PROPERTIES, allow_none=True, help="The overflow-x CSS attribute (deprecated).").tag(sync=True) - overflow_y = CaselessStrEnum(['visible', 'hidden', 'scroll', 'auto'] + CSS_PROPERTIES, allow_none=True, help="The overflow-y CSS attribute (deprecated).").tag(sync=True) order = Unicode(None, allow_none=True, help="The order CSS attribute.").tag(sync=True) padding = Unicode(None, allow_none=True, help="The padding CSS attribute.").tag(sync=True) right = Unicode(None, allow_none=True, help="The right CSS attribute.").tag(sync=True) @@ -77,13 +75,6 @@ class Layout(Widget): grid_column = Unicode(None, allow_none=True, help="The grid-column CSS attribute.").tag(sync=True) grid_area = Unicode(None, allow_none=True, help="The grid-area CSS attribute.").tag(sync=True) - @validate('overflow_x', 'overflow_y') - def _validate_overflows(self, proposal): - if proposal.value is not None: - import warnings - warnings.warn("Layout properties overflow_x and overflow_y have been deprecated and will be dropped in a future release. Please use the overflow shorthand property instead", DeprecationWarning) - return proposal.value - class LayoutTraitType(Instance): diff --git a/packages/base/src/widget_layout.ts b/packages/base/src/widget_layout.ts index a52bc85f24..961cc58b03 100644 --- a/packages/base/src/widget_layout.ts +++ b/packages/base/src/widget_layout.ts @@ -32,8 +32,6 @@ let css_properties: {[key: string]: string} = { min_height: null, min_width: null, overflow: null, - overflow_x: null, // deprecated - overflow_y: null, // deprecated order: null, padding: null, right: null, @@ -91,19 +89,6 @@ class LayoutView extends WidgetView { registerTrait(trait: string) { this._traitNames.push(trait); - // Treat overflow_x and overflow_y as a special case since they are deprecated - // and interact in special ways with the overflow attribute. - if (trait === 'overflow_x' || trait === 'overflow_y') { - // Listen to changes, and set the value on change. - this.listenTo(this.model, 'change:' + trait, (model: any, value: any) => { - this.handleOverflowChange(trait, value); - }); - - // Set the initial value on display. - this.handleOverflowChange(trait, this.model.get(trait)); - return; - } - // Listen to changes, and set the value on change. this.listenTo(this.model, 'change:' + trait, (model: LayoutModel, value: any) => { this.handleChange(trait, value); @@ -139,27 +124,6 @@ class LayoutView extends WidgetView { } } - /** - * Handles when the value of overflow_x or overflow_y changes - */ - handleOverflowChange(trait: string, value: any) { - // This differs from the default handleChange method - // in that setting `overflow_x` or `overflow_y` to null - // when `overflow` is null removes the attribute. - let parent = this.options.parent as DOMWidgetView; - if (parent) { - if (value === null) { - if (this.model.get('overflow') === null) { - parent.el.style.removeProperty(this.css_name(trait)); - } - } else { - parent.el.style[this.css_name(trait)] = value; - } - } else { - console.warn('Style not applied because a parent view does not exist'); - } - } - /** * Remove the styling from the parent view. */ diff --git a/packages/schema/jupyterwidgetmodels.latest.md b/packages/schema/jupyterwidgetmodels.latest.md index 9e11795f98..9ea57c2101 100644 --- a/packages/schema/jupyterwidgetmodels.latest.md +++ b/packages/schema/jupyterwidgetmodels.latest.md @@ -50,8 +50,6 @@ Attribute | Type | Default | Help `object_position` | `null` or string | `null` | The object-position CSS attribute. `order` | `null` or string | `null` | The order CSS attribute. `overflow` | `null` or string | `null` | The overflow CSS attribute. -`overflow_x` | `null` or string (one of `'visible'`, `'hidden'`, `'scroll'`, `'auto'`, `'inherit'`, `'initial'`, `'unset'`) | `null` | The overflow-x CSS attribute (deprecated). -`overflow_y` | `null` or string (one of `'visible'`, `'hidden'`, `'scroll'`, `'auto'`, `'inherit'`, `'initial'`, `'unset'`) | `null` | The overflow-y CSS attribute (deprecated). `padding` | `null` or string | `null` | The padding CSS attribute. `right` | `null` or string | `null` | The right CSS attribute. `top` | `null` or string | `null` | The top CSS attribute.