예제 #1
0
def links_list():
    return Col([
        Row(A(href=LINKS[i], children=i.split('_')[1], target='_blank'))
        for i in sorted(list(LINKS.keys()), key=lambda x: int(x.split('_')[0]))
    ],
               bp='md',
               size=3)
예제 #2
0
    def serve_layout(self):
        if db_has_records():
            layout = self.layout
        else:
            layout = Div([
                'No data found. Make sure to first import your ',
                A('Takeout', href=url_for('records.index'))
            ])

        return Response(json.dumps(layout, cls=plotly.utils.PlotlyJSONEncoder),
                        mimetype='application/json')
예제 #3
0
def get_top_navbar(busgrps):
    navbar = Navbar(id='top-nav-bar',
                    children=[
                        get_tabs_container(busgrps),
                        Button(
                            A('Download to Excel',
                              id='download-link',
                              download='export.csv')), search_collapse
                    ],
                    fixed='top')
    # top_navbar = Col(id='top-navbar-col-12', children=[navbar, search_collapse])
    return navbar
예제 #4
0
def load_app(app):
    """
    Callback loading given app into the appropriate :class:`Div` class
    instance.

    Parameters
    ----------
    app : unicode
        App path.

    Returns
    -------
    Div
        :class:`Div` class instance of the app layout.
    """

    if app == app_1.APP_PATH:
        return app_1.LAYOUT
    elif app == app_2.APP_PATH:
        return app_2.LAYOUT
    else:
        return Div([
            P([
                'Various colour science ',
                A('Dash', href='https://dash.plot.ly/', target='_blank'),
                ' apps built on top of \n',
                A('Colour',
                  href='https://github.com/colour-science/colour',
                  target='_blank'), '.'
            ]),
            H3([
                Link(app_1.APP_NAME, href=app_1.APP_PATH, className='app-link')
            ]),
            Markdown(app_1.APP_DESCRIPTION.replace('This app c', 'C')),
            H3([
                Link(app_2.APP_NAME, href=app_2.APP_PATH, className='app-link')
            ]),
            Markdown(app_2.APP_DESCRIPTION.replace('This app c', 'C')),
        ])
예제 #5
0
파일: header.py 프로젝트: saitara/chime-ja
 def get_html(self) -> List[ComponentMeta]:
     """Initializes the header dash html
     """
     content = self.content
     return [
         Div(
             className="penn-medicine-header__content",
             children=[
                 A(
                     href="https://www.pennmedicine.org",
                     className="penn-medicine-header__logo",
                     title=content["logo-title"],
                     children=content["logo-text"],
                 ),
                 A(
                     className="penn-medicine-header__title",
                     id="title",
                     children=content["title"],
                 ),
             ],
         )
     ]
예제 #6
0
def get_logs(max_rows=20):
    p = api_request_to_json('logs')['posts']
    headers = ['Post', 'Author', 'Date']
    d = sorted(p, key=itemgetter('date'), reverse=True)
    link = 'https://hvointernal.wr.usgs.gov/hvo_logs/read?id={}'
    return [[Tr([Th(col) for col in headers])] + [
        Tr([
            Td(
                A(href=link.format(d[i]['id']),
                  children='%s' % d[i]['subject'],
                  target='_blank')),
            Td(children='%s' % d[i]['user']),
            Td(children='%s' % d[i]['date'])
        ]) for i in range(0, max_rows)
    ]]
예제 #7
0
 def get_html(self) -> List[ComponentMeta]:
     """Initializes the header dash html
     """
     content = self.content
     return [
         Div(
             className="penn-medicine-header__content",
             children=[
                 A(
                     className="penn-medicine-header__title",
                     id="title",
                     children=content["title"],
                 ),
             ],
         )
     ]
예제 #8
0
    })
    return inventory_DF



# UI layout - DASH app

app.layout = Div([
        
        H3('Inventory Management using Discrete Event Simulation created by Karthik Anumalasetty'),
        Div([A([Img(
                src='data:image/png;base64,{}'.format(linkedin_image.decode()),
                style={
                    'height' : '4%',
                    'width' : '4%',
                    'float' : 'right',
                    'position' : 'relative',
                    'padding-top' : 0,
                    'padding-right' : 0
                })], href="https://www.linkedin.com/in/karthikanumalasetty/", target="_blank", 
               )]),
        Div([A([Img(
                src='data:image/jpg;base64,{}'.format(github_image.decode()),
                style={
                    'height' : '8%',
                    'width' : '8%',
                    'float' : 'right',
                    'padding-top' : 0,
                    'padding-right' : 0
                })], href="https://github.com/KKAnumalasetty/simulation-app-heroku", target="_blank", 
               )]),
예제 #9
0
 def get_html(self) -> List[ComponentMeta]:
     """Initializes the header dash html
     """
     today = date.today().strftime(self.content["date-format"])
     return [
         Container(
             className="mt-5",
             children=[
                 H2(self.content["new-admissions-title"]),
                 Markdown(self.content["new-admissions-text"]),
             ]
         ),
         Container(fluid=True, children=Graph(id="new_admissions_graph")),
         Container([
             A(
                 self.content["download-text"],
                 id="new_admissions_download",
                 download="admissions_{}.csv".format(today),
                 href="",
                 target="_blank",
                 className="btn btn-sm btn-info",
             ),
             Div(
                 children=Button(
                     "Lock Zoom", 
                     id="new_admissions_lock_zoom", 
                     color="info", 
                     outline=False,
                     className="btn btn-sm"
                     ),
                 style={"display": "inline-block", "padding": 10}
             ),
             Div(
                 className="row justify-content-center",
                 children=Div(
                     id="new_admissions_table_container",
                     className="col-auto",
                     children=Table(
                         id="new_admissions_table",
                         className="table-responsive mx-auto"
                     ),
                 ),
             ),
         ]),
         Container(
             className="mt-5",
             children=[
                 H2(self.content["admitted-patients-title"]),
                 Markdown(self.content["admitted-patients-text"]),
             ],
         ),
         Container(fluid=True, children=Graph(id="admitted_patients_graph")),
         Container([
             A(
                 self.content["download-text"],
                 id="admitted_patients_download",
                 download="census_{}.csv".format(today),
                 href="",
                 target="_blank",
                 className="btn btn-sm btn-info",
             ),
             Div(
                 children=Button(
                     "Lock Zoom", 
                     id="admitted_patients_lock_zoom", 
                     color="info", 
                     outline=False, 
                     className="btn btn-sm"
                     ),
                 style={"display": "inline-block", "padding": 10}
             ),
             Div(
                 className="row justify-content-center",
                 children=Div(
                     id="admitted_patients_table_container",
                     className="col-auto",
                     children=Table(
                         id="admitted_patients_table",
                         className="table-responsive"
                     ),
                 ),
             ),
         ]),
         Container(
             className="mt-5",
             children=[
                 H2(self.content["SIR-title"]),
                 Markdown(self.content["SIR-text"]),
             ],
         ),
         Container(fluid=True, children=Graph(id="SIR_graph")),
         Container([
             A(
                 self.content["download-text"],
                 id="SIR_download",
                 download="SIR_{}.csv".format(today),
                 href="",
                 target="_blank",
                 className="btn btn-sm btn-info my-4",
             ),
             Div(
                 children=Button(
                     "Lock Zoom", 
                     id="SIR_lock_zoom", 
                     color="info", 
                     outline=False, 
                     className="btn btn-sm"
                     ),
                 style={"display": "inline-block", "padding": 10}
             ),
             Div(
                 className="row justify-content-center",
                 children=Div(
                     id="SIR_table_container",
                     className="col-auto",
                     children=Table(
                         id="SIR_table",
                         className="table-responsive"
                     ),
                 ),
             ),
         ])
     ]
예제 #10
0
        Slider(id='decimals-{0}'.format(APP_UID),
               min=1,
               max=15,
               step=1,
               value=10,
               marks={i + 1: str(i + 1)
                      for i in range(15)},
               className='app-widget'),
        Pre([Code(id='primaries-{0}'.format(APP_UID), className='code shell')],
            className='app-widget app-output'),
        Ul([
            Li([Link('Back to index...', href='/', className='app-link')],
               className='list-inline-item'),
            Li([
                A('Permalink',
                  href=urlparse.urljoin(SERVER_URL, APP_PATH),
                  target='_blank')
            ],
               className='list-inline-item'),
            Li([
                A('colour-science.org',
                  href='https://www.colour-science.org',
                  target='_blank')
            ],
               className='list-inline-item'),
        ],
           className='list-inline text-center'),
    ],
        className='col-6 mx-auto')
])
"""
예제 #11
0
def wordloud_controls(id_prefix, default_mask=None, min_font_size=4):

    c = Div([
        Div([
            Div([
                Div([
                    Button('Build', className="btn btn-success", n_clicks=1, id='{0}-generate-wordcloud'.format(id_prefix), style={'width': '100%'})
                ], className='col mb-2')
            ], className='row'),
            Div([
                Div([
                    Div([Span('Stop Words', className='input-group-text')], className='input-group-prepend'),
                    dcc.Input(id='{0}-stopwords'.format(id_prefix), value='show,episode,season,series,episodes,time,first,character,characters', placeholder='Stop Words (,)', className='form-control')
                ], className='col input-group mb-2')
            ], className='row'),
            Div([
                Div([
                    Div([
                        Div([Span('Width', className='input-group-text')], className='input-group-prepend'),
                        dcc.Input(id='{0}-width'.format(id_prefix), value=1000, inputMode='numeric', type='number', min=200, max=2000, className='form-control'),

                    ], className='input-group mb-2 pr-0 pl-0')
                ], className='col-12 col-md-6'),
                    Div([
                        Div([
                            Div([Span('Height', className='input-group-text')], className='input-group-prepend'),
                            dcc.Input(id='{0}-height'.format(id_prefix), value=500, inputMode='numeric', type='number', min=200, max=2000, className='form-control'),

                        ], className='input-group mb-2 pr-0 pl-0')
                    ], className='col-12 col-md-6'),

            ], className='row'),
            Div([
                Div([
                    Div([
                        Div([Span('Colorscale', className='input-group-text')], className='input-group-prepend'),
                        dbc.Select(options=[{'label': i, 'value': i} for i in plt.colormaps()], value='viridis', id='{0}-colormap'.format(id_prefix), className='form-control')
                    ], className='input-group mb-2')
                ], className='col-lg-6 col-md-6'),
                Div([
                    Div([
                        Div([Span('Background', className='input-group-text')], className='input-group-prepend'),
                        dbc.Input(id='{0}-background-color'.format(id_prefix), value='#ffffff', type='color', className='form-control', style={'padding': 0, 'height': 38})
                    ], className='input-group mb-2'),
                ], className='col-lg-6 col-md-6'),
            ], className='row')
        ], className='col-lg-6'),
        Div([
            Div([
                Div([
                    Div([
                        Div([Span('Max font', className='input-group-text')], className='input-group-prepend'),
                        dcc.Input(id='{0}-max-font'.format(id_prefix), value=0, inputMode='numeric', type='number', min=0, max=100, className='form-control'),
                    ], className='input-group mb-2')
                ], className='col-6'),
                    Div([
                        Div([
                            Div([Span('Min font', className='input-group-text')], className='input-group-prepend'),
                            dcc.Input(id='{0}-min-font'.format(id_prefix), value=min_font_size, inputMode='numeric', type='number', min=1, max=100, className='form-control'),
                        ], className='input-group mb-2')
                    ], className='col-6')
            ], className='row'),
            Div([
                Div([
                    Div([
                        Div([Span('Frq/Rnk', className='input-group-text')], className='input-group-prepend'),
                        dcc.Input(id='{0}-scaling'.format(id_prefix), value=0.5, min=0, max=1, step=0.01, inputMode='numeric', type='number',
                        className='form-control pb-0'),
                    ], className='input-group mb-2')
                ], className='col-lg-6 col-md-6'),
                Div([
                    Div([
                        Div([Span('Max Words', className='input-group-text')], className='input-group-prepend'),
                        dcc.Input(id='{0}-nwords'.format(id_prefix), value=200, inputMode='numeric', type='number', min=10, max=500, step=10, className='form-control'),
                    ], className='input-group mb-2')
                ], className='col-lg-6 col-md-6')
            ], className='row'),
            Div([
                Div([
                    Div([
                        Div([Span('Mask URL', className='input-group-text')], className='input-group-prepend'),
                        dcc.Input(id='{0}-image-mask-url'.format(id_prefix), value=default_mask,
                        inputMode='url', type='search', className='form-control'),
                    ], className='input-group mb-2')
                ], className='col-lg-12 col-md-12'),

            ], className='row'),
            Div([
                Div([
                    Div([
                        Div([Span('Scale', className='input-group-text')], className='input-group-prepend'),
                        dcc.Input(id='{0}-scale'.format(id_prefix), value=1, inputMode='numeric', type='number', min=1, max=10, className='form-control'),
                    ], className='input-group mb-2 pr-0 pl-0')
                ], className='col-12 col-md-6'),
                Div([
                    A('Save', download='wordcloud.png', href="", target="_blank", className="btn btn-primary", id='{0}-save-wordcloud'.format(id_prefix), style={'width': '100%'})
                ], className='col-md-6 mb-2')
            ], className='row')
        ], className='col-lg-6'),
        Div([
            Details([
                Summary('Help'),
                dcc.Markdown(instructions)
            ], className='col-sm-12')
        ])
    ], className='row')

    return c
app.layout = Div(
    [
        Div([Store(x + "-store-" + str(i)) for x in TAB_DICT.keys() for i in [1, 2]]),
        # header
        Div(
            Div(
                children=[
                    Span(
                        "Using an ‘agent based model’ for data policy decision-making"
                    ),
                    Div(
                        A(
                            Img(
                                src="/assets/basic-W-48px.png",
                                height="80%",
                                style={"align": "center"},
                            ),
                            href="https://theodi.org",
                            target="_blank",
                        ),
                        className="brandimage",
                    ),
                ],
                className="insideheader",
            ),
            className="header",
        ),
        Div(
            Details(
                [
                    Summary(
예제 #13
0
def get_layout(app):
    row_0 = Div([
        H2("Upload to Database (excel file)", style={'textAlign': 'left'}),
        Upload(
            id='upload-data',
            children=Div(['Drag and Drop or ',
                          A('Select Files')]),
            style={
                'width': '100%',
                'height': '60px',
                'lineHeight': '60px',
                'borderWidth': '1px',
                'borderStyle': 'dashed',
                'borderRadius': '5px',
                'textAlign': 'center',
                'margin': '10px'
            },
            # Allow multiple files to be uploaded
            multiple=False),
        Loading(
            id="loading",
            children=[Div(id='output-data-upload')],
            type="default",
        ),
    ])
    row_1 = Div([
        Div([
            H2("Text input", style={'textAlign': 'left'}),
            RadioItems(id='radio1',
                       options=[{
                           'label': 'Partial match',
                           'value': 'PMATCH'
                       }, {
                           'label': 'Exact match',
                           'value': 'EMATCH'
                       }],
                       value='EMATCH',
                       labelStyle={
                           'display': 'inline-block',
                       }),
            Input(id="input1", type="text", placeholder="Query"),
            Br(),
            Button('Start text search', id='button')
        ],
            className='col-6'),
        Div([
            H2("Search field", style={'textAlign': 'left'}),
            RadioItems(id='radio2',
                       options=[{
                           'label': 'Chemical name',
                           'value': 'NAME'
                       }, {
                           'label': 'CAS Number',
                           'value': 'CAS'
                       }, {
                           'label': 'IASO Barcode No.',
                           'value': 'BAR'
                       }],
                       value='NAME',
                       labelStyle={
                           'display': 'inline-block',
                       }),
        ],
            className='col-6')
    ],
                className='row')
    row_2 = Div([
        Div([
            H2("Graphical search type", style={'textAlign': 'left'}),
            RadioItems(id='radio3',
                       options=[{
                           'label': 'Similarity ',
                           'value': 'SIM'
                       }, {
                           'label': 'Substructural ',
                           'value': 'SUB'
                       }, {
                           'label': 'Exact ',
                           'value': 'EX'
                       }],
                       value='SIM',
                       labelStyle={
                           'display': 'inline-block',
                       }),
            DashMarvinJS(id='editor',
                         marvin_url=app.get_asset_url('mjs/editor.html'),
                         marvin_width='100%')
        ],
            className='col-6'),
        Div([
            H2("Search results", style={'textAlign': 'left'}),
            DataTable(
                id='table',
                columns=fields1,
                fixed_rows={
                    'headers': True,
                    'data': 0
                },
                row_selectable='single',
                style_data={
                    'whiteSpace': 'normal',
                    'height': 'auto',
                    'width': 'auto'
                },
                style_table={
                    'overflowY': 'hidden',
                    'overflowX': 'hidden',
                    'margin-left': '0px'
                },
                style_cell={
                    'textAlign': 'left',
                    'padding': '5px',
                    'height': 'auto',
                    'padding-left': '17px',
                    'whiteSpace': 'normal',
                    'minWidth': '10px',
                    'maxWidth': '150px'
                },
                style_as_list_view=True,
                style_cell_conditional=[
                    {
                        'if': {
                            'column_id': 'Picture'
                        },
                        'width': '60%'
                    },
                    {
                        'if': {
                            'column_id': 'Brutto formula'
                        },
                        'width': '10%'
                    },
                    {
                        'if': {
                            'column_id': 'Chemical name'
                        },
                        'width': '15%'
                    },
                    {
                        'if': {
                            'column_id': 'CAS No.'
                        },
                        'width': '10%'
                    },
                ],
            )
        ],
            className='col-6')
    ],
                className='row')
    row_3 = DataTable(
        id='table2',
        columns=fields2,
        fixed_rows={
            'headers': True,
            'data': 0
        },
        #row_selectable='single',
        editable=True,
        row_deletable=True,
        style_data={
            'whiteSpace': 'normal',
            'height': 'auto'
        },
        style_table={
            'maxHeight': '500px',
            'overflowY': 'hidden',
            'overflowX': 'hidden',
            'margin-left': '0px'
        },
        style_cell={
            'textAlign': 'left',
            'padding': '10px',
            'padding-left': '20px',
            'height': 'auto',
            'whiteSpace': 'normal',
            'minWidth': '120px',
            'width': '150px'
        },
        #style_cell_conditional=[
        #    {'if': {'column_id': 'Quantity'},
        #     'width': '150px'},
        #   {'if': {'column_id': 'Quantity unit'},
        #     'width': '150px'},
        #],
        style_as_list_view=True)
    row_4 = Div([
        Button('Add Row', id='addrow', n_clicks=0),
        Button('Submit changes', id='submit', n_clicks=0),
        ConfirmDialog(
            id='confirm',
            message=
            'All changes will be applied from now! Are you sure you want to continue?',
        )
    ])

    layout = Div([
        H1("Chemicals Storage", style={'textAlign': 'center'}), row_0,
        Hr(), row_1,
        Hr(), row_2,
        Hr(), row_3,
        Hr(), row_4
    ])
    return layout
예제 #14
0
from dash_html_components import Iframe, Div, Script, A, Img


img = Img(src="//ws-na.amazon-adsystem.com/widgets/q?_encoding=UTF8&MarketPlace=US&ASIN=B071ZTJWM7&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL250_&tag=1071a1-20", style={"margin":"0 auto", "display": "block"})
a = A(img, target="_blank", href="https://www.amazon.com/gp/product/B071ZTJWM7/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=B071ZTJWM7&linkCode=as2&tag=1071a1-20&linkId=3ec0629eca960378dc9f3d5e4de50601")
img2 = Img(src="//ir-na.amazon-adsystem.com/e/ir?t=1071a1-20&l=am2&o=1&a=B071ZTJWM7", width="1", height="1", alt="", style={"border": "none !important", "margin":"0px !important"})
amazonMusicProduct = Div([
    a,img2
])


img = Img(src="//ws-na.amazon-adsystem.com/widgets/q?_encoding=UTF8&MarketPlace=US&ASIN=B00N28818A&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL250_&tag=1071a1-20", style={"margin":"0 auto", "display": "block"})
a = A(img, target="_blank", href="https://www.amazon.com/gp/product/B00N28818A/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=B00N28818A&linkCode=as2&tag=1071a1-20&linkId=188e6e60a5d7dc73a5b047453861d955")
img2 = Img(src="//ir-na.amazon-adsystem.com/e/ir?t=1071a1-20&l=am2&o=1&a=B00N28818A", width="1", height="1", alt="", style={"border": "none !important", "margin":"0px !important"})
amazonPrimeVideoProduct = Div([
    a,img2
])

 def get_html(self) -> List[ComponentMeta]:
     """Initializes the header dash html
     """
     today = date.today().strftime(self.content["date-format"])
     return [
         H2(self.content["new-admissions-title"]),
         Markdown(self.content["new-admissions-text"]),
         Graph(id="new_admissions_graph"),
         A(
             self.content["download-text"],
             id="new_admissions_download",
             download="admissions_{}.csv".format(today),
             href="",
             target="_blank",
             className="btn btn-sm btn-info my-2",
         ),
         Div(
             className="row justify-content-center",
             children=Div(
                 id="new_admissions_table_container",
                 className="col-auto",
                 children=[
                     Table(id="new_admissions_table",
                           className="table-responsive"),
                 ],
             ),
         ),
         H2(self.content["admitted-patients-title"]),
         Markdown(self.content["admitted-patients-text"]),
         Graph(id="admitted_patients_graph"),
         A(
             self.content["download-text"],
             id="admitted_patients_download",
             download="census_{}.csv".format(today),
             href="",
             target="_blank",
             className="btn btn-sm btn-info my-4",
         ),
         Div(
             className="row justify-content-center",
             children=Div(
                 id="admitted_patients_table_container",
                 className="col-auto",
                 children=[
                     Table(id="admitted_patients_table",
                           className="table-responsive"),
                 ],
             ),
         ),
         H2(self.content["SIR-title"]),
         Markdown(self.content["SIR-text"]),
         Graph(id="SIR_graph"),
         A(
             self.content["download-text"],
             id="SIR_download",
             download="SIR_{}.csv".format(today),
             href="",
             target="_blank",
             className="btn btn-sm btn-info my-4",
         ),
         Div(
             className="row justify-content-center",
             children=Div(
                 id="SIR_table_container",
                 className="col-auto",
                 children=[
                     Table(id="SIR_table", className="table-responsive"),
                 ],
             ),
         ),
     ]