Coverage for src/ipyvizzustory/env/pn/story.py: 100%
10 statements
« prev ^ index » next coverage.py v7.5.4, created at 2024-07-10 10:22 +0000
« prev ^ index » next coverage.py v7.5.4, created at 2024-07-10 10:22 +0000
1"""A module for working with presentation stories in `Panel` environment."""
3from typing import Optional
5from panel.pane import HTML
7from ipyvizzu import Data, Style
9from ipyvizzustory.storylib.story import Story as StoryLib
12class Story(StoryLib):
13 """A class for representing a presentation story in `Panel` environment."""
15 def __init__(self, data: Data, style: Optional[Style] = None):
16 """
17 Presentation Story constructor.
19 Args:
20 data: Data set for the whole presentation story.
21 After initialization `data` can not be modified,
22 but it can be filtered.
23 style: Style settings for the presentation story.
24 `style` can be changed at each presentation step.
25 """
27 super().__init__(data=data, style=style)
29 def play(self) -> None:
30 """A method for displaying the assembled `HTML` code in `Panel` environment."""
32 _width, _height = self._size.get_width_height_in_pixels()
34 HTML(
35 self.to_html(),
36 width=_width,
37 height=_height,
38 ).servable()