示例#1
0
def test_upca001_upload_children_gallery(dash_dcc):
    app = Dash(__name__)
    app.layout = html.Div([
        html.Div(id="waitfor"),
        html.Label("Empty"),
        dcc.Upload(),
        html.Label("Button"),
        dcc.Upload(html.Button("Upload File")),
        html.Label("Text"),
        dcc.Upload("Upload File"),
        html.Label("Link"),
        dcc.Upload(html.A("Upload File")),
        html.Label("Style"),
        dcc.Upload(
            ["Drag and Drop or ", html.A("Select a File")],
            style={
                "width": "100%",
                "height": "60px",
                "lineHeight": "60px",
                "borderWidth": "1px",
                "borderStyle": "dashed",
                "borderRadius": "5px",
                "textAlign": "center",
            },
        ),
    ])
    dash_dcc.start_server(app)
    time.sleep(0.5)
    dash_dcc.percy_snapshot("upca001 children gallery")

    assert dash_dcc.get_logs() == []
示例#2
0
 def __init__(self, project_name, description):
     super().__init__()
     self.card = html.A(html.Button(
         dbc.Card(
             dbc.CardBody(
                 [
                     html.H4("Project : {}".format(project_name), className="card-title"),
                     html.H6("Description : {}".format(description), className="card-subtitle",
                             style={"margin-bottom": "8px"}),
                     html.Div([
                         dbc.CardLink(dbc.Button("Test", style={"margin-right": "16px"}, color="primary"),
                                      href="{}/test".format(project_name), style={"float": "left"}),
                         # dbc.CardLink(dbc.Button("Open", style={"margin-right": "20px"}, color="info"),
                         #              href=project_name),
                         html.A(dbc.Button("Export CSV", style={"margin-right": "32px"}, color="secondary"),
                                href="{}/export/csv".format(project_name)),
                         html.A(dbc.Button("Export Excel", style={"margin-right": "32px"}, color="secondary"),
                                href="{}/export/excel".format(project_name)),
                         dbc.CardLink(dbc.Button("Delete", color="danger", style={"margin-right": "16px"}),
                                      href="{}/delete".format(project_name), style={"float": "right"}),
                         # dbc.Badge("Success", style={"float": "right"})
                     ], )
                 ]
             ),
             style={"width": "65rem"},
         )
     ), href=project_name
     )
示例#3
0
    def welcomePage(self):
        title = html.H1(
            "Recount",
            style={
                "marginBottom": "-1rem",
                "fontSize": "8rem",
                "fontWeight": "bold",
            },
        )
        subtext_title = html.Strong("Gonna check dat budget!",
                                    style={"fontSize": "3rem"})
        upper_welcome = html.Div([title, subtext_title],
                                 style={"textAlign": "center"})

        welcome = html.H2([html.Br(), "Welcome"],
                          style={
                              "fontSize": "6rem",
                              "fontWeight": "bold"
                          })
        paraf1 = html.P([
            "Bonjour et bienvenu sur ",
            html.Strong("Recount"),
            ", une application qui permet de visualiser ses dépenses.",
        ])
        paraf2 = html.P([
            html.Br(),
            "La ",
            "version 0.1",
            " viens de sortir, et ",
            html.Strong("vous avez été choisi pour la tester!"),
        ])
        paraf3 = html.P([
            "Testez, jouez avec les données, et faites moi des retours par mail quand vous le souhaitez à ",
            html.A("*****@*****.**"),
        ])
        paraf4 = html.P([
            "Si vous voulez un petit ",
            html.Strong("tuto"),
            " pour vous lancer, j'ai préparé ",
            html.A("celui-ci."),
        ])
        paraf5 = html.P([
            html.Br(),
            "Niveau sécurité, tout les fichiers sont chiffrés et les connexions sécurisées. Mais je ne vais pas mentir : tout est cadenassé, mais les clefs ne sont pas cachées. Il faut partir du principe qu'",
            html.Strong("une fuite de données peut arriver TRÈS facilement."),
            " Si cela vous dérange d'entrer vos dépenses personnelles, utilisez les données de l'exemple ou inventez vos propres données.",
        ])
        paraf6 = html.P([
            html.Br(),
            "Je reste joignable sur mon téléphone, mail ou via facebook."
        ])
        paraf7 = html.P([html.Br(), "Amusez vous bien!"])

        list_parafs = [paraf1, paraf2, paraf3, paraf4, paraf5, paraf6, paraf7]
        for i in range(len(list_parafs)):
            list_parafs[i].style = {"fontSize": "xx-large"}
        parafs = html.Div(list_parafs)

        return html.Div([upper_welcome, welcome, parafs])
示例#4
0
def get_about_html():
    text = """
           This is the implementation of our Data Science Project. The aim of this project is to provide 
           suggestions on suitable relocation areas in Finland, based on housing prices and demographics.
           """
    return html.Div([
        html.H1("About"),
        html.H3(text, id="about_text"),
        html.H1("Team"),
        html.Table([
            html.Thead(
                html.Tr([
                    html.Th("Letizia"),
                    html.Th("Taige"),
                    html.Th("Roope"),
                    html.Th("Trang"),
                    html.Th("Thong")
                ])),
            html.Tbody(
                html.Tr([
                    html.Td(
                        html.A(html.Img(
                            src=
                            "https://avatars1.githubusercontent.com/u/45148109?s=200&v=4",
                            alt="Letizia"),
                               href="https://github.com/letiziaia")),
                    html.Td(
                        html.A(html.Img(
                            src=
                            "https://avatars2.githubusercontent.com/u/16875716?s=200&v=4",
                            alt="Taige"),
                               href="https://github.com/xiaoxiaobt")),
                    html.Td(
                        html.A(html.Img(
                            src=
                            "https://avatars2.githubusercontent.com/u/43811718?s=200&v=4",
                            alt="Roope"),
                               href="https://github.com/rooperuu")),
                    html.Td(
                        html.A(html.Img(
                            src=
                            "https://avatars3.githubusercontent.com/u/55182434?s=200&v=4",
                            alt="Trang"),
                               href="https://github.com/trangmng")),
                    html.Td(
                        html.A(html.Img(
                            src=
                            "https://avatars0.githubusercontent.com/u/32213097?s=200&v=4",
                            alt="Thong"),
                               href="https://github.com/trananhthong"))
                ]))
        ],
                   id="team_table")
    ],
                    id="about_info")
示例#5
0
def app_page_layout(page_layout,
                    app_title="Dash Bio App",
                    app_name="",
                    light_logo=True,
                    standalone=False,
                    bg_color="#506784",
                    font_color="#F3F6FA"):
    return html.Div(
        id='main_page',
        children=[
            dcc.Location(id='url', refresh=False),
            html.Div(
                id='app-page-header',
                children=[
                    html.A(id='dashbio-logo',
                           children=[
                               html.Img(src='data:image/png;base64,{}'.format(
                                   base64.b64encode(
                                       open(
                                           os.path.join(
                                               ASSETSPATH,
                                               'plotly-dash-bio-logo.png'),
                                           'rb').read()).decode()))
                           ],
                           href="/Portal" if standalone else "/dash-bio"),
                    html.H2(app_title),
                    html.A(id='gh-link',
                           children=['View on GitHub'],
                           href="https://github.com/cytham/variantmap",
                           style={
                               'color':
                               'white' if light_logo else 'black',
                               'border':
                               'solid 1px white'
                               if light_logo else 'solid 1px black'
                           }),
                    html.Img(src='data:image/png;base64,{}'.format(
                        base64.b64encode(
                            open(
                                os.path.join(ASSETSPATH,
                                             'GitHub-Mark-{}64px.png').
                                format('Light-' if light_logo else ''),
                                'rb').read()).decode()))
                ],
                style={
                    'background': bg_color,
                    'color': font_color,
                }),
            html.Div(id='app-page-content', children=page_layout)
        ],
    )
示例#6
0
        def run_robocrys_analysis(new_store_contents):

            struct = self.from_data(new_store_contents)

            try:

                condenser = StructureCondenser()
                describer = StructureDescriber(fmt="unicode")

                condensed_structure = condenser.condense_structure(struct)

                description = describer.describe(condensed_structure)

            except Exception as exc:

                description = str(exc)

            return MessageContainer(
                MessageBody(
                    [
                        f"{description} – ",
                        html.A(
                            f"🤖 robocrys v{robocrys_version}",
                            href="https://github.com/hackingmaterials/robocrystallographer",
                            style={"white-space": "nowrap"},
                        ),
                    ]
                ),
                kind="dark",
            )
示例#7
0
    def _sub_layouts(self):

        search = html.Div(self._make_search_box(),
                          id=self.id("search_container"))

        random_link = html.A("get random mp-id",
                             className="is-text is-size-7",
                             id=self.id("random"))

        dropdown = dcc.Dropdown(id=self.id("dropdown"), clearable=False)
        dropdown_container = html.Div(
            [
                html.Label("Multiple results found, please select one:"),
                dropdown
            ],
            id=self.id("dropdown-container"),
            style={"display": "none"},
        )

        warning = html.Div(style={"display": "none"}, id=self.id("warning"))

        search = html.Div([search, random_link],
                          style={"marginBottom": "0.75rem"})

        search = html.Div([search, warning, dropdown_container])

        return {"search": search}
示例#8
0
def generate_table(dataframe, max_rows=100, download_link=False):

    components = []
    if download_link:
        csv_string = dataframe.to_csv(index=False,
                                      encoding='utf-8',
                                      float_format='%.2f')
        link = html.A('Download CSV',
                      download="synthesis_conditions.csv",
                      href="data:text/csv;charset=utf-8," +
                      urllib.parse.quote(csv_string),
                      target="_blank",
                      className='button')
        components.append(link)

    components.append(
        html.Table(
            # Header
            [html.Tr([html.Th(col) for col in dataframe.columns])] +

            # Body
            [
                html.Tr([
                    html.Td(cell_format(dataframe.iloc[i][col]))
                    for col in dataframe.columns
                ]) for i in range(min(len(dataframe), max_rows))
            ]))

    return components
示例#9
0
def update_reports_list(iso_code):
    reports = reliefweb_api.get_reports_for_country(iso_code)
    if not reports:
        return ''
    images = [
        html.A(children=[
            html.Img(src=report['thumbnail'],
                     style={
                         'height': '180px',
                         'padding': '3',
                         'marginRight': 40,
                         'marginLeft': 40,
                         'boxShadow': '10px 10px 5px 0px #656565',
                         'background': '#FFF'
                     }),
            html.P(report['title'][0:50],
                   style={
                       'font-size': 'small',
                       'text-align': 'center'
                   })
        ],
               href=report['file'],
               target='_blank') for report in reports
    ]
    return html.Div([
        html.H3('Humanitarian Reports'),
        html.Div(children=images,
                 style={
                     'display': 'flex',
                     'align': 'middle',
                     'flexDirection': 'row',
                     'justifyContent': 'center'
                 })
    ])
示例#10
0
 def terms_check_box():
     return frm.Checkbox(label=[
         "I agree to the ",
         html.A("Terms and Conditions", href="#")
     ],
                         id='terms',
                         name='terms')
示例#11
0
def show_distribution_info(distribution: str) -> list:
    """Get a brief summary of the selected distribution.

    Parameters
    ----------
    distribution : str
        The name of the current distribution

    Returns
    -------
    list
        A brief summary of the distribution, and a link to it's page on
        Wikipedia.
    """
    dist_data = distribution_data[distribution]
    summary = [
        html.P(paragraph) for paragraph in dist_data["summary"].split(">")
    ]
    wiki_link = [
        html.A(
            "Learn more...",
            className="wiki-link",
            href=dist_data["wiki_link"],
        )
    ]
    return [summary + wiki_link]
示例#12
0
 def get_references():
     return html.Div([
         html.Br(),
         html.Br(),
         html.H2("References "),
         html.Ul([
             html.Li(
                 html.A(
                     "Energy Usage Reports: Environmental awareness as part of algorithmic accountability",
                     href="https://arxiv.org/pdf/1911.08354.pdf",
                 )),
             html.Li(
                 html.A(
                     "Quantifying the Carbon Emissions of Machine Learning",
                     href="https://arxiv.org/pdf/1910.09700.pdf",
                 )),
         ]),
         html.Br(),
         html.Br(),
     ])
示例#13
0
def show_document(match: dict):
    url = f"/pdf/{match['pdf']}"
    iframe = dbc.Row(
        dbc.Col(html.Iframe(src=url, style={
            "width": "100%",
            "height": "100%"
        })),
        style={
            "resize": "vertical",
            "overflow-y": "hidden",
            "height": "1000px",
            "min-height": "100px",
        },
    )
    title = match["title"].replace("_", " ")
    title = " ".join([w.capitalize() for w in title.split()])
    title = dbc.Row(dbc.Col(html.H3(title)))
    date = html.A(
        match["date"],
        id={
            "type": "link_date",
            "date": match["date"]
        },
        href="#",
        n_clicks=0,
        style={
            "text-decoration": "none",
            "color": "inherit"
        },
    )
    tags = html.P([
        dbc.Badge(
            tag,
            id={
                "type": "link_tag",
                "tag": tag
            },
            href="#",
            n_clicks=0,
            color="primary",
            className="mr-1",
        ) for tag in match["tags"]
    ])
    data = dbc.Table(
        [
            html.Tbody([
                html.Tr([html.Td("Date"), html.Td(date)]),
                html.Tr([html.Td("Tags"), html.Td(tags)]),
            ])
        ],
        striped=True,
    )
    return dbc.Row([dbc.Col([title, data], width=4), dbc.Col(iframe)])
示例#14
0
    def make_description(self):

        text = """This tool displays the successful response rate for each DNS server for the past 24 hours.
A successful response means that the RTT of the query is less than 1.5 seconds for TCP and 
less than 0.5 seconds for UDP. For more information, please refer the following tool : """

        description = html.Div([
            html.H2("Description"),
            html.Div([text, html.A("https://rtt.dns.mtcq.jp/", href="https://rtt.dns.mtcq.jp/")],
                     id="main-content-description",
                     style=dict(whiteSpace="pre-wrap",
                                display="inline-block")) ])
        return description
示例#15
0
    def serve(self):
        assert(self._built)

        self._app.layout = html.Div(children=[
            dcc.Location(id="url", refresh=False),
            html.H1(["WARA-SW TEP Dashboard"]),
            html.Main([
                html.Div([
                    html.A(dashboard.title, href="/" + name),
                ])
                for (name, dashboard) in self._dashboards.items()
            ]),
            html.Div([], id="dashboard-area")
        ])
        self._app.run_server(debug=True, host="0.0.0.0")
示例#16
0
def patient_information():
    """ Return: Card with patient information """
    information = [
        dcc.Tab(label='About',
                value='what-is',
                children=html.Div(
                    className='control-tab',
                    children=[
                        html.H4(className='what-is',
                                children='Information about patient'),
                        html.A('Download data', id='my-link2'),
                        html.P(id="text", className="card-text"),
                    ]))
    ]
    return information
def test_upft001_test_upload_with_different_file_types(filetype, dash_dcc):

    filepath = os.path.join(
        os.path.dirname(__file__),
        "upload-assets",
        f"upft001.{filetype}",
    )

    app = Dash(__name__)

    app.layout = html.Div(
        [
            html.Div(filepath, id="waitfor"),
            html.Div(
                id="upload-div",
                children=dcc.Upload(
                    id="upload",
                    children=html.Div(["Drag and Drop or ", html.A("Select a File")]),
                    style={
                        "width": "100%",
                        "height": "60px",
                        "lineHeight": "60px",
                        "borderWidth": "1px",
                        "borderStyle": "dashed",
                        "borderRadius": "5px",
                        "textAlign": "center",
                    },
                ),
            ),
            html.Div(id="output"),
            html.Div(DataTable(data=[{}]), style={"display": "none"}),
        ]
    )

    @app.callback(Output("output", "children"), [Input("upload", "contents")])
    def update_output(contents):
        if contents is not None:
            return load_data_by_type(filetype, contents)

    dash_dcc.start_server(app)

    upload_div = dash_dcc.wait_for_element("#upload-div input[type=file]")
    upload_div.send_keys(filepath)

    dash_dcc.wait_for_text_to_equal("#raw-title", "Raw Content")
    dash_dcc.percy_snapshot("Core" + filepath)

    assert dash_dcc.get_logs() == []
示例#18
0
def getHeader(active):
    header_logo = html.Div([html.A(className="header__logo", href='/')])
    header_items = [
        html.Li(dcc.Link("Team", href="/team", className="header__link"),
                className="header__item {0}".format("is-active" if active ==
                                                    "team" else "")),
        html.Li(dcc.Link("Players", href="/players", className="header__link"),
                className="header__item {0}".format("is-active" if active ==
                                                    "players" else "")),
    ]
    header_list = html.Ul(header_items, className="header__list")

    return html.Div([
        header_logo,
        header_list,
    ], className="header t-sans")
示例#19
0
def serve_layout():
    return html.Div([
        html.A(id='api-help-link',
               children='?',
               href=f'{request.url_root}help' if has_request_context() else '',
               target='_blank',
               title='View the API documentation',
               style={
                   'color': '#fff',
                   'background-color': '#f15A29',
                   'width': 16,
                   'height': 16,
                   'display': 'inline-block',
                   'border-radius': '100%',
                   'font-size': 16,
                   'text-align': 'center',
                   'text-decoration': 'none',
                   'box-shadow': 'inset -2px -2px 1px 0px rgba(0,0,0,0.25)',
                   'margin-left': '98%',
                   'margin-bottom': 4,
               }),
        dcc.Dropdown(
            id='omega-dropdown',
            options=dropdown_options,
            multi=True,
            placeholder='Select the OMEGA iServer(s)...',
        ),
        DatetimeRangePicker(id='datetime-range',
                            **datetime_range_picker_kwargs(cfg)),
        dcc.Tabs(
            id='tabs',
            value='temperature',
            children=[
                dcc.Tab(label='Current Readings', value='current-readings'),
                dcc.Tab(label='Temperature', value='temperature'),
                dcc.Tab(label='Humidity', value='humidity'),
                dcc.Tab(label='Dewpoint', value='dewpoint'),
            ],
            style={'display': 'inline-block'},
        ),
        html.Div(id='plot-viewer'),
        html.Div(id='current-readings-viewer'),
        dcc.Interval(
            id='current-readings-interval',
            interval=cfg.value('current_readings/interval', 10) * 1000,
        ),
    ])
示例#20
0
def cite_me(doi: str = None,
            manual_ref: str = None,
            cite_text: str = "Cite me") -> html.Div:
    """
    Create a button to show users how to cite a particular resource.
    :param doi: DOI
    :param manual_ref: If DOI not available
    :param cite_text: Text to show as button label
    :return: A button
    """
    if doi:
        if doi in DOI_CACHE:
            ref = DOI_CACHE[doi]
        else:
            try:
                ref = content_negotiation(ids=doi, format="text",
                                          style="ieee")[3:]
                DOI_CACHE[doi] = ref
                dumpfn(DOI_CACHE, MODULE_PATH / "apps/assets/doi_cache.json")
            except Exception as exc:
                print("Error retrieving DOI", doi, exc)
                ref = f"DOI: {doi}"
        tooltip_text = f"If this analysis is useful, please cite {ref}"
    elif manual_ref:
        warnings.warn("Please use the DOI if available.")
        tooltip_text = (f"If this analysis is useful, please cite the "
                        f"relevant publication: {manual_ref}")
    else:
        tooltip_text = (f"If this analysis is useful, please cite the "
                        f"relevant publication (publication pending).")

    reference_button = html.A(
        [
            Button(
                [Icon(kind="book"), html.Span(cite_text)],
                size="small",
                kind="link",
                style={"height": "1.5rem"},
            )
        ],
        href=f"https://dx.doi.org/{doi}",
        target="_blank",
    )

    with_tooltip = get_tooltip(reference_button, tooltip_text, underline=False)

    return with_tooltip
示例#21
0
def get_graph_content():
    graph_content = []

    #for r in os.listdir(REPORTDIR):
    if not os.path.exists('assets'):
        os.mkdir('assets')
    else:
        _time = time.ctime(os.path.getmtime('assets'))
        _time = datetime.strptime(_time, "%a %b %d %H:%M:%S %Y")
        _txt = 'Updated {} at {}'.format(humanize.naturaltime(_time), _time)
        graph_content.append(html.P(
            _txt,
            style={
                'padding-top': '30px',
                'padding-bottom': '20px',
                'padding-left': '200px',
                'padding-right': ' 200px'}))

        report_list = os.listdir('assets')
        report_list = sorted(report_list)
        report_list = [x for x in report_list if x.endswith('_report.pdf')]
        for r in report_list:
            # Add a link to project PDF
            graph_content.append(
                html.Div(
                    html.A(r, download=r, href='assets/'+r),
                    style={
                        'padding-top': '10px',
                        'padding-bottom': '10px',
                        'padding-left': '50px'}))

    # Add some space
    graph_content.append(html.Br())

    # Wrap in a tab
    tab0 = dcc.Tab(
        label='Monthly',
        value='0',
        children=[html.Div(graph_content)],
        style={'width': '900px'})

    # Concat the tabs
    tabs = [tab0]

    # Return the tabs
    return tabs
示例#22
0
def get_footer():
    """ """
    return html.Footer(
        [
            html.Div(
                [
                    html.P([f"{k}: "]),
                    html.A([html.Img(src=v)], href=v.split(".svg")[0]),
                ],
                className="col",
            ) for k, v in BUILD_STATUS_MAPPING
        ] + [
            dcc.Interval(
                id=BUILD_STATUS_INTERVAL, interval=60 * 1000, n_intervals=0)
        ],
        className="page-footer text-center row p-3",
    )
示例#23
0
def test_loca001_callbacks(dash_dcc):
    app = Dash(__name__)
    app.layout = html.Div([
        dcc.Location(id="location", refresh=False),
        html.A("Anchor Link 1", href="#div"),
        html.Div(id="div"),
    ])

    @app.callback(Output("div", "children"), [Input("location", "pathname")])
    def update_path(path):
        return path

    dash_dcc.start_server(app)

    dash_dcc.wait_for_text_to_equal("#div", "/")

    assert dash_dcc.get_logs() == []
示例#24
0
def connectPSA(n_clicks, app_name, email, password, countrycode):  # pylint: disable=unused-argument
    ctx = callback_context
    if ctx.triggered:
        try:
            res = firstLaunchConfig(app_name, email, password, countrycode)
            config.load_app()
            config.start_remote_control()
            return dbc.Alert([
                res,
                html.A(" Go to otp config",
                       href=request.url_root + "config_otp")
            ],
                             color="success")
        except Exception as e:
            res = str(e)
            return dbc.Alert(res, color="danger")
    else:
        return ""
示例#25
0
def finishOtp(n_clicks, code_pin, sms_code):  # pylint: disable=unused-argument
    ctx = callback_context
    if ctx.triggered:
        try:
            otp_session = new_otp_session(sms_code, code_pin,
                                          config.myp.remote_client.otp)
            config.myp.remote_client.otp = otp_session
            config.myp.save_config()
            config.start_remote_control()
            return dbc.Alert([
                "OTP config finish !!! ",
                html.A("Go to home", href=request.url_root)
            ],
                             color="success")
        except Exception as e:
            res = str(e)
            logger.exception("finishOtp:")
            return dbc.Alert(res, color="danger")
    raise PreventUpdate()
示例#26
0
def warming():
    return html.Div([
        dbc.Row([
            dbc.Col([
                dcc.Markdown(global_md),
                html.A("View details",
                       href='https://datahub.io/core/global-temp#readme',
                       className="btn btn-secondary"),
            ],
                    md=3),
            dbc.Col(
                [

                    # https://dash.plot.ly/dash-core-components/graph
                    dcc.Graph(
                        figure={
                            "data": [{
                                "y": data['Mean'].tolist(),
                                "x": data['Year'].tolist()
                            }],
                            'layout': {
                                'title': 'Global Temperature Change (°C)',
                                'xaxis': {
                                    'title': 'Year'
                                }
                            }
                        },
                        config={'displayModeBar': False},
                    ),
                ],
                md=9),
        ]),
        dbc.Row([
            dbc.Col([
                dcc.Link("State Solar",
                         href=spa.url_for('solar'),
                         className="btn btn-primary float-end")
            ],
                    md=12)
        ])
    ])
def getSummaryText(df, now):
    return [
        html.P([
            "These are the test results for the ",
            html.A("Traceability Interop Profile",
                   href="https://w3id.org/traceability/interoperability",
                   target="_blank"), " as of:" + now
        ]),
        html.P([
            "The highest current % of passed tests by a single provider is: ",
            str(df['Passing'].min()),
            html.Br(),
            "The lowest is: ",
            str(df['Passing'].max()),
            html.Br(),
            "Across all providers the average % of passed tests is: ",
            "{:.1%}".format(
                df['Passing'].str.replace("\%", "").astype(float).mean() /
                100),
        ])
    ]
示例#28
0
def test_mdcap001_dcc_components_as_props(dash_dcc):
    app = Dash(__name__)

    app.layout = html.Div(
        [
            dcc.Checklist(
                [
                    {"label": html.H2("H2 label"), "value": "h2"},
                    {"label": html.A("Link in checklist", href="#"), "value": "a"},
                ],
                id="checklist",
            ),
            dcc.RadioItems(
                [
                    {"label": html.H3("on"), "value": "on"},
                    {"label": html.P("off"), "value": "off"},
                ],
                id="radio-items",
            ),
            dcc.Dropdown(
                [
                    {"label": html.H4("h4"), "value": "h4"},
                    {"label": html.H6("h6"), "value": "h6"},
                ],
                id="dropdown",
            ),
        ]
    )

    dash_dcc.start_server(app)

    dash_dcc.wait_for_text_to_equal("#checklist h2", "H2 label")
    dash_dcc.wait_for_text_to_equal("#checklist a", "Link in checklist")

    dash_dcc.wait_for_text_to_equal("#radio-items h3", "on")
    dash_dcc.wait_for_text_to_equal("#radio-items p", "off")

    dash_dcc.find_element("#dropdown").click()
    dash_dcc.wait_for_text_to_equal("#dropdown h4", "h4")
    dash_dcc.wait_for_text_to_equal("#dropdown h6", "h6")
示例#29
0
def make_subheading(label, link):
    slug = label.replace(" ", "")

    heading = html.H2(
        html.Span([
            label,
            html.A(
                html.I(className="fas fa-book fa-xs ms-2"),
                href=f"{DBC_DOCS}{link}",
                target="_blank",
                id=f"tooltip_target_{slug}",
            ),
        ], ), )

    return html.Div(
        [
            heading,
            dbc.Tooltip(f"See {label} documentation",
                        target=f"tooltip_target_{slug}"),
        ],
        className="mt-3",
    )
示例#30
0
               AntdImage(
                   alt='fac源码仓库,欢迎star',
                   src=
                   'https://img.shields.io/github/stars/CNFeffery/feffery-antd-components?style=social',
                   preview=False,
                   fallback=None,
                   style=
                   {'transform': 'translateY(0px) scale(1.25)'}),
               href=
               'https://github.com/CNFeffery/feffery-antd-components',
               target='_blank',
               style={'cursor': 'pointer'}),
             html.A('皖ICP备2021012734号-1',
                    href='https://beian.miit.gov.cn/',
                    target='_blank',
                    style={
                        'fontSize': '10px',
                        'marginLeft': '50px',
                        'color': '#494f54'
                    })
         ],
         style={
             'float': 'right',
             'paddingRight': '20px',
             'marginTop': '20.5px'
         }),
                 flex='auto')
 ],
 align="middle",
 style={
     'height': '64px',
     'boxShadow': 'rgb(240 241 242) 0px 2px 14px',