Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1b3c3a6

Browse files
committed
fix empty-dashboard preview
1 parent b331cbd commit 1b3c3a6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

plotly/dashboard_objs/dashboard_objs.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,9 @@ def get_preview(self):
322322
pprint.pprint(self)
323323
return
324324

325+
elif self['layout'] is None:
326+
return IPython.display.HTML(dashboard_html)
327+
325328
x = 0
326329
y = 0
327330
box_w = MASTER_WIDTH
@@ -445,7 +448,7 @@ def insert(self, box, side='above', box_id=None):
445448
box_ids_to_path = self._compute_box_ids()
446449

447450
# doesn't need box_id or side specified for first box
448-
if self['layout'] is None:
451+
if self['layout'] is None: # or
449452
self['layout'] = _container(box, _empty_box())
450453
else:
451454
if box_id is None:
@@ -515,7 +518,7 @@ def remove(self, box_id):
515518
raise exceptions.PlotlyError(ID_NOT_VALID_MESSAGE)
516519

517520
path = box_ids_to_path[box_id]
518-
if path != ['first']:
521+
if path != ('first',):
519522
container_for_box_id = self._path_to_box(path[:-1])
520523
if path[-1] == 'first':
521524
adjacent_path = 'second'
@@ -525,7 +528,7 @@ def remove(self, box_id):
525528

526529
self._insert(adjacent_box, path[:-1])
527530
else:
528-
self['layout'] = _empty_box()
531+
self['layout'] = None
529532

530533
self._set_container_sizes()
531534

0 commit comments

Comments
 (0)