Skip to content

Commit

Permalink
Simplify widget API for newer ipywidgets
Browse files Browse the repository at this point in the history
  • Loading branch information
fcollonval committed Aug 16, 2023
1 parent f039278 commit 79d5243
Showing 1 changed file with 3 additions and 26 deletions.
29 changes: 3 additions & 26 deletions beakerx_base/beakerx_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,6 @@ def __init__(self, **kwargs):

layout = InstanceDict(BeakerxLayout).tag(sync=True, **widget_serialization)

def _ipython_display_(self, **kwargs):
data = {
'application/vnd.jupyter.widget-view+json': {
'version_major': 2,
'version_minor': 0,
'model_id': self._model_id
}
}
display(data, raw=True)

self._handle_displayed(**kwargs)


class BeakerxBox(Box):
def __init__(self, **kwargs):
Expand All @@ -107,22 +95,11 @@ def __init__(self, **kwargs):

layout = InstanceDict(BeakerxLayout).tag(sync=True, **widget_serialization)

def _ipython_display_(self, **kwargs):
data = {
'application/vnd.jupyter.widget-view+json': {
'version_major': 2,
'version_minor': 0,
'model_id': self._model_id
},
'method': 'display_data'
}

def _repr_mimebundle_(self, **kwargs):
for component in self.components:
self.components[component].fireInit()

display(data, raw=True)

self._handle_displayed(**kwargs)

return super(BeakerxBox, self)._repr_mimebundle_(**kwargs)


class BeakerxTextArea(Textarea, EasyFormComponent):
Expand Down

0 comments on commit 79d5243

Please sign in to comment.