Esempio n. 1
0
def test_that_reference_docs_in_readme_are_up_to_date():
    filename = os.path.join(os.path.dirname(HERE), "README.md")
    assert os.path.isfile(filename)
    with open(filename, "rb") as f:
        text = f.read().decode()
    _, _, ref = text.partition(md_seperator)
    ref1 = ref.strip().replace("\r\n", "\n")
    ref2 = get_reference_docs().strip()
    assert (
        ref1 == ref2
    ), "Reference docs in readme are outdated. Run `python update_docs_in_readme.py`"
Esempio n. 2
0
def write_reference_docs():
    """Write the reference docs to the README."""
    # Prepare
    filename = os.path.join(HERE, "README.md")
    assert os.path.isfile(filename), "README.md not found"
    # Load first part of the readme
    with open(filename, "rb") as f:
        text = f.read().decode()
    text1, _, _ = text.partition(md_seperator)
    text1 = text1.strip()
    # Create second part of the readme
    text2 = "\n\n" + md_seperator + "\n\n" + get_reference_docs()
    if "\r" in text1:
        text2 = text2.replace("\n", "\r\n")
    # Wite
    with open(filename, "wb") as f:
        f.write(text1.encode())
        f.write(text2.encode())
    print("Updated the reference docs in README.md")
Esempio n. 3
0
def test_that_the_docs_build():
    x = get_reference_docs()
    assert "VolumeSlicer(app, vol" in x
    assert "create_overlay_data(mask" in x
    assert "performance" in x.lower()
Esempio n. 4
0
    Similarly, an `origin` can also be provided. You can zoom into the
    view on the right to see that the voxels are elongated.
    '''),
    rc.Markdown(examples['slicer_example3.py'][0],
                style=styles.code_container),
    html.Div(examples['slicer_example3.py'][1], className='example-container'),
    rc.Markdown('''

    ### Reacting to the slicer state

    This example illustrates how your application can react to the slicer's
    position and view by using the `state` store as an input. Note that the
    id of this store is a dict, which makes it possible to write a
    [pattern matching Input](https://dash.plotly.com/pattern-matching-callbacks)
    to collect the states of all slicers with a certain scene_id.
    See the reference docs for details.
    '''),
    rc.Markdown(examples['slicer_example4.py'][0],
                style=styles.code_container),
    html.Div(examples['slicer_example4.py'][1], className='example-container'),
    rc.Markdown('''

    ### More examples

    More examples are available at the
    [dash-slicer repository](https://github.com/plotly/dash-slicer/tree/main/examples).
    '''),
    html.H2('Reference'),
    rc.Markdown(get_reference_docs()),
])