Skip to content

msaJustPyUI Module

.jpcore.template


Created on 2022-09-02 modified version, original from JustPy @author: wf (modification swelcker)

Classes

Context

legacy context handler, encapsulates context

Attributes

component_engine_type instance-attribute
component_engine_type = context_dict["frontend_engine_type"]
context_dict instance-attribute
context_dict = context_dict
display_url_js instance-attribute
display_url_js = self.get_js_option('display_url', '')
frontend_engine_libs instance-attribute
frontend_engine_libs = context_dict['frontend_engine_libs']
justpy_dict_js instance-attribute
justpy_dict_js = justpy_dict_js.replace(
    "</" + "script>", '</" + "script>'
)
page_id_js instance-attribute
page_id_js = context_dict['page_id']
page_options instance-attribute
page_options = PageOptions(
    context_dict.get("page_options", {})
)
redirect_js instance-attribute
redirect_js = self.get_js_option('redirect', '')
title_js instance-attribute
title_js = self.get_js_option('title', 'JustPy')
use_websockets_js instance-attribute
use_websockets_js = self.context_dict.get(
    "use_websockets", "true"
)

Functions

__init__
__init__(context_dict: dict)

constructor

PARAMETER DESCRIPTION
context_dict

a context dict in legacy format

TYPE: dict

as_html_lines
as_html_lines(indent: str = '  ')

generate the html lines for justpy to work

as_javascript_constructor
as_javascript_constructor(indent: str = '    ')

generate my initial JavaScript

as_javascript_setup
as_javascript_setup(indent)

generate the java script setup code

as_script_src
as_script_src(
    file_name: str, indent: str = "  ", subdir=""
)
as_script_srcs
as_script_srcs(indent: str = '  ')

generate a list of javascript files to be imported

get_js_option
get_js_option(key, default_value)

get the page_option with the given key as javascript using the default value in case the value is not set or none

get_url_for
get_url_for(name: str, path: str = None)

get url for the given route name

PARAMETER DESCRIPTION
name

name of the route

TYPE: str

path

path params

TYPE: str DEFAULT: None

PageOptions

legacy page_options handler, encapsulating page_options

Attributes

events instance-attribute
events: List[str] = page_options_dict.get('events', [])
page_options_dict instance-attribute
page_options_dict = page_options_dict

Functions

__init__
__init__(page_options_dict: dict)

constructor

get_debug
get_debug()

Get debug status of the PageOptions

get_page_ready
get_page_ready()
get_reload_interval_ms
get_reload_interval_ms() -> float
get_result_ready
get_result_ready()

Last update: September 28, 2022
Created: September 28, 2022