Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: manually invoke display_preview_on_jupyter #599

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading