Пример #1
0
def test_pn_navigation_with_font_awesome():
    """# Manual Test of the Navigation Component with Font Awesome

    - The first button has no icon as we specified None
    - The second button has no icon as we specified an empty list
    - The third button has a twitter icon as specified
    """
    pnx.fontawesome.extend()
    page1 = pnx.Markdown("## None", name="Page None")
    page2 = pnx.Markdown("## Empty", name="Page Empty")
    page3 = pnx.Markdown("## Twitter", name=" Page Twitter")

    pages = [page1, page2, page3]
    content = pn.Column()
    sidebar = pn.Column()
    app = pn.Column(pnx.Markdown(test_pn_navigation_with_font_awesome.__doc__),
                    sidebar, content)

    css_classes = [None, [], ["pab", "pa-twitter"]]

    menu = pnx.NavigationMenu(pages=pages,
                              page_outlet=content,
                              css_classes=css_classes)
    sidebar.append(menu)
    app.servable("test_pn_navigation_with_font_awesome")
Пример #2
0
def test_pn_navigation_button():
    """# Manual Test of the Navigation Buttons

    - Ordinary Button
    - Button With Font Awesome
    """
    # Given:
    pnx.fontawesome.extend()
    page = pnx.Header("Button Page", name="Button")
    page_font_awesome = pnx.Header("Font Awesome Page", name=" Font Awesome")
    page_outlet = pn.Column(page)
    button = pnx.NavigationButton(page=page, page_outlet=page_outlet)
    button_font_awesome = pnx.NavigationButton(
        page=page_font_awesome,
        page_outlet=page_outlet,
        css_classes=["pab", "pa-twitter"])
    app = pn.Column(
        pnx.Markdown(test_pn_navigation_button.__doc__),
        button,
        button_font_awesome,
        page_outlet,
        width=400,
    )
    # When
    app.servable("test_pn_navigation")
Пример #3
0
def test_pn_navigation():
    """# Manual Test of the Navigation Component

    - Page 1 is shown by default.
    - Can navigate to Page 1 and Page 2
    """
    page1 = pnx.Markdown("## Page 1", name="Page 1")
    page2 = pnx.Markdown("## Page 2", name="Page 2")

    pages = [page1, page2]
    content = pn.Column()
    sidebar = pn.Column()
    app = pn.Column(pnx.Markdown(test_pn_navigation.__doc__), sidebar, content)

    menu = pnx.NavigationMenu(pages=pages, page_outlet=content)
    sidebar.append(menu)
    app.servable("test_pn_navigation")
Пример #4
0
def test_pn_file():
    """## test_pn_file

    Manual test that

    [x] A path to a markdown file can be specified and shown
    """
    app = pn.Column(test_pn_file.__doc__, pnx.Markdown(path=TEST_MD_FILE, name="test"),)
    app.servable("test_pn_file")
Пример #5
0
    def __init__(self):
        warning = pnx.WarningAlert(
            """\
Please **resize this window** in order to see the full content. The Bokeh layout engine used by
Paneldoes not identify the  page height correctly when showing markdown with images.
It's a limitation of Panel :-)""", )
        limitations = pnx.Markdown(path=LIMITATIONS_PATH)

        super().__init__(
            warning,
            limitations,
            sizing_mode="stretch_width",
            name="Limitations",
        )
Пример #6
0
def test_error_alert():
    """## test_error_alert

    - Red Div with normal and bold text
    - Curently not full width
    """
    pn.config.raw_css.append(pnx.ErrorAlert.raw_css)
    app = pn.Column(
        pnx.Markdown(test_error_alert.__doc__),
        pnx.ErrorAlert("This is an **Error Alert**!"),
        sizing_mode="stretch_width",
    )

    app.servable(test_error_alert.__name__)
Пример #7
0
def test_pn_original():
    """## test_pn_original

    Manual test that

    - [] A "Header is shown"
    - [] The background is blue
    - [] The sizing_mode is "stretch_width" by default
    """
    app = pn.Column(
        test_pn_original.__doc__,
        pnx.Markdown("# Header", name="test", background="blue"),
        sizing_mode="stretch_width",
        background="lightgray",
        max_width=600,
    )
    app.servable("test_pn_original")
Пример #8
0
    def __init__(self):
        about = pnx.Markdown(path=ABOUT_PATH)
        image = pn.pane.PNG(str(IMAGE_PATH),
                            max_width=600,
                            sizing_mode="scale_both")
        info = pnx.InfoAlert(
            """\
Navigate to the **Dashboard Page** via the **Sidebar** to see the result.
Or Navigate to the **Limitations Page** to learn of some of the limitations of Panel that
I've experienced.""", )
        super().__init__(
            about,
            image,
            info,
            sizing_mode="stretch_width",
            name="About",
        )
Пример #9
0
def test_info_alert_height_problem():
    """## test_info_alert_height_problem

    We saw that the height of InfoAlert Div was much greater than it needed to be.
    See [Issue 829](https://github.com/holoviz/panel/issues/829)
    """
    pn.config.raw_css.append(pnx.InfoAlert.raw_css)
    text = """\
Navigate to the **Dashboard Page** via the **Sidebar** to see the result.
Or Navigate to the **Limitations Page** to learn of some of the limitations of Panel that
I've experienced."""
    app = pn.Column(
        pnx.Markdown(test_info_alert_height_problem.__doc__),
        pnx.InfoAlert(text, sizing_mode="stretch_width"),
        sizing_mode="stretch_width",
    )

    app.servable(test_info_alert.__name__)