Skip to content

Commit

Permalink
fix: manually invoke display_preview_on_jupyter
Browse files Browse the repository at this point in the history
  • Loading branch information
longxiaofei committed Jul 30, 2024
1 parent 3400733 commit 6e2e2dc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pygwalker/api/pygwalker.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def display_preview_on_jupyter(self):
"""
Display preview on jupyter notebook/lab.
"""
display_html(self._get_gw_preview_html())
display_html(self._get_gw_preview_html(True))

@property
def chart_list(self) -> List[str]:
Expand Down Expand Up @@ -581,7 +581,10 @@ def _get_render_iframe(
else:
return html

def _get_gw_preview_html(self) -> str:
def _get_gw_preview_html(self, manual: bool = False) -> str:
"""
'manual' represents the user actively calling to obtain preview_html. It will randomly generate a gid, keeping it separate from the logic of walker automatically generating the preview part.
"""
if not self.workflow_list:
return ""
datas = []
Expand All @@ -594,7 +597,7 @@ def _get_gw_preview_html(self) -> str:
self.vis_spec,
datas,
self.theme_key,
self.gid,
self.gid if not manual else self.gid + rand_str(),
self.appearance
)

Expand Down

0 comments on commit 6e2e2dc

Please sign in to comment.