scistag.vislog.visual_log_renderer.VisualLogRenderer

class VisualLogRenderer[source]

Bases: object

Defines an abstract interface for adding data to a log of any format

Methods

build_body

Assembles the sub logs and uses the body pieces to combine it to a delivarable files

build_body_pieces

Slices the new html template into pieces which can be quickly assembled to the full page using pre-encoded binary data.

build_page

Combines the head's header, body and footer to a full html page

set_body_template

Changes the current body template

set_footer_template

Sets a new footer template

set_header_template

Sets a new header template

set_sub_logs

Sets the new list of sub logs to be integrated

Attributes

__dict__

__doc__

__module__

__weakref__

list of weak references to the object (if defined)

body_template

The original body template to be parsed by Jinja

body_template_rendered

The rendered template with only place holders for content remaining

body_pieces

The single (binary_) pre-rendered body pieces or place holder names

sub_log_names

The names of the single sub logs to be inserted into the body template

title

The pages title

header_template

The template for the top of the page

footer_template

The template for the foot of the page

header_rendered

The encoded and rendered header

footer_rendered

The encoded and rendered footer

build_body(sub_log_data)[source]

Assembles the sub logs and uses the body pieces to combine it to a delivarable files

Parameters

sub_log_data (dict[str, bytes]) – The data for the single sub log entries

Return type

bytes

Returns

The final file data

build_body_pieces()[source]

Slices the new html template into pieces which can be quickly assembled to the full page using pre-encoded binary data.

build_page(body)[source]

Combines the head’s header, body and footer to a full html page

Parameters

body – The page’s body

Return type

bytes

Returns

The full, deliverable page

set_body_template(template, **params)[source]

Changes the current body template

Parameters
  • template (str) – The new Jinja template

  • sub_logs – The names of the sub logs to be inserted

  • params – Optional creation parameters

Sets a new footer template

Parameters
  • template (str) – The template’s string data

  • params – Parameters of content to be inserted

set_header_template(template, **params)[source]

Sets a new header template

Parameters
  • template (str) – The template’s string data

  • params – Parameters of content to be inserted

set_sub_logs(sub_logs)[source]

Sets the new list of sub logs to be integrated

Parameters

sub_logs – The name of the sub logs to be integrated into the final page.

body_pieces: list[bytes | str]

The single (binary_) pre-rendered body pieces or place holder names

body_template

The original body template to be parsed by Jinja

body_template_rendered

The rendered template with only place holders for content remaining

footer_rendered: bytes

The encoded and rendered footer

footer_template: str

The template for the foot of the page

header_rendered: bytes

The encoded and rendered header

header_template: str

The template for the top of the page

sub_log_names

The names of the single sub logs to be inserted into the body template

title

The pages title