Ejemplo n.º 1
0
def test_show():
    source = "https://github.com/MarcSkovMadsen/awesome-panel/blob/master/app.py"
    thumbnail = (
        "https://raw.githubusercontent.com/MarcSkovMadsen/awesome-panel/master/"
        "assets/images/thumbnails/awesome-panel-org.png")
    author = Author(
        name="panel",
        url="https://panel.pyviz.org/",
        github_url="https://github.com/holoviz/",
        github_avatar_url="https://avatars2.githubusercontent.com/u/51678735",
    )
    home_page_main = pn.pane.Markdown(name="Home")
    tags = [Tag(name="awesome")]
    home_page = Page(
        name="Home",
        author=author,
        description="The main page of the application",
        tags=tags,
        source_code_url=source,
        thumbnail_png_url=thumbnail,
        component=home_page_main,
    )

    reload_services = [
        ReloadService(component=GalleryPageComponent,
                      component_parameters={"page": home_page}),
        ReloadService(
            component=GalleryComponent,
            component_parameters={"pages": [home_page for i in range(0, 6)]},
        ),
    ]

    Designer(reload_services=reload_services).view.show()
Ejemplo n.º 2
0
def view() -> pn.Column:
    """The Designer with the Material Components

    Returns:
        pn.Column: A Column with the Designer and the Material Components
    """
    button_service = ReloadService(component=material.MWCButton,
                                   component_parameters={"name": "Click Me"})
    select_service = ReloadService(
        component=material.MWCSelect,
        component_parameters={
            "name": "Select Me",
            "options": {
                "a": "aaa",
                "b": "bbb",
                "c": "ccc"
            }
        },
    )

    reload_services = [select_service, button_service]
    designer = Designer(reload_services=reload_services)
    pn.config.js_files["mwc"] = material.MWC_JS

    return pn.Column(
        designer.view,
        material.fonts_pane,
        sizing_mode="stretch_both",
    )
Ejemplo n.º 3
0
def show():
    pandas_profiling_app = ReloadService(PandasProfilingApp)
    reload_services = [pandas_profiling_app]
    Designer(reload_services=reload_services).show()
Ejemplo n.º 4
0
import panel as pn

from awesome_panel.designer import Designer, ReloadService, components
from awesome_panel.designer.components.component_with_error import ComponentWithError
from awesome_panel.designer.views import ErrorView
from awesome_panel.express import Card
from awesome_panel.express.assets import BOOTSTRAP_PANEL_EXPRESS_CSS

FIXTURES = pathlib.Path(__file__).parent / "fixtures"
COMPONENT_CSS = FIXTURES / "component.css"
COMPONENT_JS = FIXTURES / "component.js"
COMPONENT2_JS = FIXTURES / "component2.js"

TITLE_COMPONENT = ReloadService(
    component=components.TitleComponent, css_path=COMPONENT_CSS, js_path=COMPONENT_JS,
)
EMPTY_COMPONENT = ReloadService(
    component=components.EmptyComponent, css_path=COMPONENT_CSS, js_path=COMPONENT2_JS,
)
CENTERED_COMPONENT = ReloadService(
    component=components.CenteredComponent,
    css_path=COMPONENT_CSS,
    js_path=COMPONENT_JS,
    component_parameters={"component": components.TitleComponent()},
)
STOPPED_COMPONENT = ReloadService(
    component=components.StoppedComponent, css_path=COMPONENT_CSS, js_path=COMPONENT_JS,
)
CARD_COMPONENT = ReloadService(
    component=Card,
Ejemplo n.º 5
0
        yy0,
        xx1,
        yy1,
        opacity=0.7,
        group=label,
        name=label,
        color=COLORS[class_id],
        showlegend=showlegend,
        text=text,
    )

    existing_classes.add(label)


# endregion plotly.py helper functions

if __name__.startswith("bokeh"):
    # Run using python -m panel serve 'application\pages\detr\detr.py' --dev --show
    # To get livereloda
    pn.config.sizing_mode = "stretch_width"
    view().servable()
if __name__.startswith("__main__"):
    # Run using python 'application\pages\detr\detr.py'
    # to edit using the Awesome Panel Designer
    from awesome_panel.designer import Designer, ReloadService

    pn.config.sizing_mode = "stretch_width"

    RELOADSERVICES = [ReloadService(component=DETRApp)]
    Designer(reload_services=RELOADSERVICES).view.show(port=5006)