Skip to content

jlgui

JLGui

Provides UI for interacting with tiers in JupyterLab.

Parameters:

Name Type Description Default
tier TierABC

Tier to provide a gui for.

required
Source code in cassini/jlgui.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
class JLGui:
    """
    Provides UI for interacting with tiers in JupyterLab.

    Parameters
    ----------
    tier: TierABC
        Tier to provide a gui for.

    """

    def __init__(self, tier: "TierABC"):
        self.tier = tier

    def header(self):
        """
        Display header widget.
        """
        publish_display_data({"application/cassini.header+json": {}})

    def meta_editor(self, name: Union[str, List[str]]):
        """
        Display meta editor widget.

        Parameters
        ----------
        name: Union[str, List[str]]
            name or names of the meta attributes to edit.
        """
        if isinstance(name, str):
            name = [name]

        publish_display_data({"application/cassini.metaeditor+json": {"values": name}})

header

header()

Display header widget.

Source code in cassini/jlgui.py
24
25
26
27
28
def header(self):
    """
    Display header widget.
    """
    publish_display_data({"application/cassini.header+json": {}})

meta_editor

meta_editor(name)

Display meta editor widget.

Parameters:

Name Type Description Default
name Union[str, List[str]]

name or names of the meta attributes to edit.

required
Source code in cassini/jlgui.py
30
31
32
33
34
35
36
37
38
39
40
41
42
def meta_editor(self, name: Union[str, List[str]]):
    """
    Display meta editor widget.

    Parameters
    ----------
    name: Union[str, List[str]]
        name or names of the meta attributes to edit.
    """
    if isinstance(name, str):
        name = [name]

    publish_display_data({"application/cassini.metaeditor+json": {"values": name}})

extend_project

extend_project(project)

Extend a project to insert JLGui as the TierBase.gui_class. Not usually required as the JLGui is the default.

Parameters:

Name Type Description Default
project Project

The project to extend.

required

Returns:

Name Type Description
project Project

The extended project.

Example
...
from cassini import jlgui

project = Project(...)
jlgui.extend_project(project)
Source code in cassini/jlgui.py
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
def extend_project(project: "Project"):
    """
    Extend a project to insert JLGui as the `TierBase.gui_class`. Not usually required as the JLGui is the default.

    Parameters
    ----------
    project: Project
        The project to extend.

    Returns
    -------
    project: Project
        The extended project.

    Example
    -------
    ```python
    ...
    from cassini import jlgui

    project = Project(...)
    jlgui.extend_project(project)
    ```
    """
    for tier_class in project.hierarchy:
        tier_class.gui_cls = JLGui

    return project