def get_pic_bar(mt, sku, data): if not all([mt, (sku != 'none'), data, sku]): return [] else: asin_dict = df_pro[df_pro['SKU'] == sku].to_dict('list') empty_list = ['未注明'] godos_name = asin_dict.get('名称', empty_list)[0] pic_url = asin_dict.get('链接', empty_list)[0] asin = asin_dict.get('sub_asin', empty_list)[0] goods_url = 'https://www.amazon.co.jp/dp/' + asin color = asin_dict.get('颜色', empty_list)[0] size = asin_dict.get('SIZE', empty_list)[0] on_shelf_time = asin_dict.get('上架时间', empty_list)[0] # url = asin_pic_dict.get(sub_asin, '') children = html.Div([ html.Div( className='columns', children=[ html.Div( html.Img(src=pic_url, width=160, height=160, style={"referrer": "no-referrer"})), # html.Tbody([ # html.Th('属性'), # html.Th('属性值'), # html.Tr([ # html.Td(''), # html.Td(id='daily_filename_td'), # ]), # html.Tr([ # html.Td(id='ad_file_td'), # html.Td(id='ad_filename_td'), # ]) # ]) html.Div(children=[ html.Ul(className='my_ul', children=[ html.Li( html.A('商品链接', href=goods_url, target='blank')), html.Li('名称:' + str(godos_name)), html.Li('颜色:' + str(color)), html.Li('尺寸:' + str(size)), html.Li('上架时间:' + str(on_shelf_time)) ]) ]) ]) ]) return children
def draw_left_nav(): return html.Div([ dbc.Card( dbc.CardBody( [ html.Label('Condition:'), html.Ul( [ html.Li( 'Good', style={'background': 'Green'}, className='circle', ), html.Li( 'Fair', style={'background': 'Yellow'}, className='circle', ), html.Li( 'Poor', style={'background': 'Orange'}, className='circle', ), html.Li( 'Critical', style={'background': 'Red'}, className='circle', ), ], className='condition_ul', ), html.Label(children=['Select: ']), dcc.Checklist( id='condition_status', options=[{ 'label': str(c), 'value': c, } for c in df['CONDITION'].unique() if c != 'nan'], value=[c for c in df['CONDITION'].unique()], ), html.Label(children=['County:']), dcc.Dropdown( id='county', options=[{ 'label': str(x), 'value': x, } for x in sorted(df['COUNTY'].unique())], ), ], className='legend_container', ), ), ])
def get_metadata(oid, dr): meta = find_ztf_oid.get_meta(oid, dr).copy() meta['coord_string'] = find_ztf_oid.get_coord_string(oid, dr) items = [ f'**{k}**: {to_str(meta[k])}' for k in METADATA_FIELDS if k in meta ] column_width = max(map(len, items)) - 2 div = html.Div( html.Ul([html.Li(dcc.Markdown(text)) for text in items], style={'list-style-type': 'none'}), style={'columns': f'{column_width}ch'}, ) return div
def make_header(**kwargs): return dbc.Navbar( id="header", className="sticky-top", color="dark", dark=True, children=[ make_brand(), html.Ul(id=server.config["NAVBAR_CONTAINER_ID"], className="navbar-nav ml-auto"), ], **kwargs, )
def get_contents(content): if not isinstance(content, (list, dict)): return [dcc.Markdown(content)] if isinstance(content, list): return [html.Ul([html.Li(item) for item in content])] return dbc.Row([ dbc.Col([html.H6(item), html.Div(get_contents(content[item]))], md=12, lg=6) for item in content.keys() ])
def shopping_layout() -> html.Div: return html.Div( children=[ html.H1("Shopping List"), html.Ul( id="my-shopping-ul", children=list_items(data_store["items"]) ), dcc.Input(id="my-shopping-input"), html.Button( id="my-shopping-button", n_clicks=0, children="Add Item" ), ] )
def get_color_legend(): """ color legend beneath the table to identify meaning of highlights :return: unordered list with color information """ return html.Ul(children=[ html.Li("No data sent for 2 days", className='red'), html.Li("Sensor was not chosen", className='not-clean'), html.Li("Left study too early", className='blue'), html.Li("Study duration reached, not left", className='light-green'), html.Li("Study duration reached, left", className='dark-green'), html.Li("Multiple QR Codes of one user active", className='orange') ])
def base_layout() -> html.Div: """Return a Dash Component which will serve as the top-level layout.""" # register the layout return html.Div([ dcc.Location(id='url', refresh=False), ] + [ html.Div( html.Ul([ html.Li(dcc.Link(route["label"], href=path), ) for path, route in App._ROUTES.items() ])), html.Div(id="page_content", children="Click link to continue"), ])
def layout(): return html.Div(children = [ html.Div(id = "fromToTimestampsDiv", className = "btn-group", role = "group", children = [ "From: ", dcc.Input(id = "fromTimestampInput", type = "datetime-local", step = "1"), " to: ", dcc.Input(id = "toTimestampInput", type = "datetime-local", step = "1") ]), html.Div(id = "quickTimeRangePickerDiv", className = "btn-group", role = "group", children = [ html.Button(id = "timestampRangePickerButton", className = "btn btn-default dropdown-toggle btn-sm", **{"data-toggle": "dropdown", "aria-haspopup": "true", "aria-expanded": "false"}, children = ["Quick time range"]), html.Ul(className = "dropdown-menu", children = [ html.Li(id = "lastFiveMinutesLi", children = html.A("Last 5 minutes")), html.Li(id = "lastFifthteenMinutesLi", children = html.A("Last 15 minutes")), html.Li(id = "lastThirtyMinutesLi", children = html.A("Last 30 minutes")), html.Li(id = "lastOneHourLi", children = html.A("Last 1 hour")), html.Li(id = "lastThreeHoursLi", children = html.A("Last 3 hours")), html.Li(id = "lastSixHoursLi", children = html.A("Last 6 hours")), html.Li(id = "lastTwelveHoursLi", children = html.A("Last 12 hours")), html.Li(id = "lastTwentyFourHoursLi", children = html.A("Last 24 hours")), html.Li(id = "lastTwoDaysLi", children = html.A("Last 2 days")), html.Li(id = "lastSevenDaysLi", children = html.A("Last 7 days")), html.Li(id = "lastThirtyDaysLi", children = html.A("Last 30 days")), html.Li(id = "lastNinetyDaysLi", children = html.A("Last 90 days")), html.Li(id = "lastSixMonthsLi", children = html.A("Last 6 months")), html.Li(id = "lastOneYearLi", children = html.A("Last 1 year")), html.Li(id = "lastTwoYearsLi", children = html.A("Last 2 years")), html.Li(id = "lastFiveYearsLi", children = html.A("Last 5 years")), html.Li(id = "yesterdayLi", children = html.A("Yesterday")), html.Li(id = "dayBeforeYesterdayLi", children = html.A("Day before yesterday")), html.Li(id = "thisDayLastWeekLi", children = html.A("This day last week")), html.Li(id = "previousWeekLi", children = html.A("Previous week")), html.Li(id = "previousMonthLi", children = html.A("Previous month")), html.Li(id = "previousYearLi", children = html.A("Previous year")), html.Li(id = "todayLi", children = html.A("Today")), html.Li(id = "todaySoFarLi", children = html.A("Today so far")), html.Li(id = "thisWeekLi", children = html.A("This week")), html.Li(id = "thisWeekSoFarLi", children = html.A("This week so far")), html.Li(id = "thisMonthLi", children = html.A("This month")), html.Li(id = "thisMonthSoFarLi", children = html.A("This month so far")), html.Li(id = "thisYearLi", children = html.A("This year")), html.Li(id = "thisYearSoFarLi", children = html.A("This year so far")) ]) ]), refreshButton.layout(), refreshInterval.layout() ])
def checkInput(n, n_close, genome_selected, pam, text_guides, mms, dna, rna, is_open): if n is None: raise PreventUpdate if is_open is None: is_open = False classname_red = 'missing-input' genome_update = None pam_update = None text_update = {'width':'450px', 'height':'160px'} mms_update = None dna_update = None rna_update = None update_style = False miss_input_list = [] if genome_selected is None or genome_selected is '': genome_update = classname_red update_style = True miss_input_list.append('Genome') if pam is None or pam is '': pam_update = classname_red update_style = True miss_input_list.append('PAM') if text_guides is None or text_guides is '': text_update = {'width':'450px', 'height':'160px','border': '1px solid red'} update_style = True miss_input_list.append('crRNA sequence(s)') if mms is None or str(mms) is '': mms_update = classname_red update_style = True miss_input_list.append('Allowed Mismatches') if dna is None or str(dna) is '': dna_update = classname_red update_style = True miss_input_list.append('Bulge DNA size') if rna is None or str(rna) is '': rna_update = classname_red update_style = True miss_input_list.append('Bulge RNA size') miss_input = html.Div( [ html.P('The following inputs are missing:'), html.Ul([html.Li(x) for x in miss_input_list]), html.P('Please fill in the values before submitting the job') ] ) if not update_style: return 1, False, genome_update, pam_update, text_update, mms_update, dna_update, rna_update, miss_input return None, not is_open, genome_update, pam_update, text_update, mms_update, dna_update, rna_update, miss_input
def renderClickData(renderObject=None): if(renderObject is not None): row = renderObject['row'] sectors = renderObject['sectors'] year = renderObject['year'] print(row) score = html.Ul([ html.Li(style={'flex-basis': '60%'}, children=[ html.H6('Tournament: {0} {1}'.format(sectors[0], year)), ]), html.Li(style={'flex-basis': '40%'}, children=[ html.H6('Round: {0}'.format(row['round'].values[0])), ]), html.Li(style={'flex-basis': '100%'}, children=[ html.H6('Match score:{0}'.format(row['score'].values[0])) ]) ]) header = [html.Tr(children=[ html.Th('Stats'), html.Th('Winner'), html.Th('Loser'), ])] datarows = [ html.Tr([html.Td('Name'),html.Td(row['winner_name']), html.Td(row['loser_name'])]), html.Tr([html.Td('Country'),html.Td(row['winner_ioc']), html.Td(row['loser_ioc'])]), html.Tr([html.Td('Rank'),html.Td(row['winner_rank']), html.Td(row['loser_rank'])]), html.Tr([html.Td('Hand'),html.Td(row['winner_hand']), html.Td(row['loser_hand'])]), html.Tr([html.Td('Age'),html.Td(math.floor(row['winner_age'].values[0])), html.Td(math.floor(row['loser_age']))]), html.Tr([html.Td('Height'),html.Td(row['winner_ht']), html.Td(row['loser_ht'])]), html.Tr([html.Td('Ace'),html.Td(row['w_ace']), html.Td(row['l_ace'])]), html.Tr([html.Td('Serve Points'),html.Td(row['w_svpt']), html.Td(row['l_svpt'])]), html.Tr([html.Td('Break Point Saved'),html.Td(row['w_bpSaved']), html.Td(row['l_bpSaved'])]), html.Tr([html.Td('Break Point Faced'),html.Td(row['w_bpFaced']), html.Td(row['l_bpFaced'])]), html.Tr([html.Td('Double Fault'),html.Td(row['w_df']), html.Td(row['l_df'])]), html.Tr([html.Td('1st serve in'),html.Td(row['w_1stIn']), html.Td(row['l_1stIn'])]), html.Tr([html.Td('Points won on 1st serve'),html.Td(row['w_1stWon']), html.Td(row['l_1stWon'])]), html.Tr([html.Td('Points won on 2nd serve'),html.Td(row['w_2ndWon']), html.Td(row['l_2ndWon'])]), html.Tr([html.Td('Serve games'),html.Td(row['w_SvGms']), html.Td(row['l_SvGms'])]), ] if (len(row) == 1) else [html.Tr([html.Td(''),html.Td(''), html.Td('')])] clickDataHtml = html.Div([ html.Div(id='score', children=[score]), html.Table(style={ 'width': '100%'},children=[ html.Thead(id='matchstats', children=header), html.Tbody(id='matchdatarows', children=datarows) ]) ]) else: clickDataHtml = html.Div([]) return clickDataHtml
def display_page(pathname): if pathname is None: return '' elif pathname == '/': global days # Get all the days for which we have gathered data (we need # to read each time from the disk because new data might be stored # on disk while the server is running) days = getAvailableDays() daysHtmlList = [ html.Li([ dcc.Link(day, href=day), dcc.Link( [ html.Button('View stats', style={ 'verticalAlign': 'middle', 'margin-left': '2vw' }) ], href='/stats/' + day, ), ], style={'font-size': '2vw'}) for day in days ] # This is the index (a.k.a. main) page of the app index_page = html.Div([ html.Center(html.H1("Available days")), html.Center(html.Ul(daysHtmlList)) ]) return index_page elif len(pathname) > 7 and pathname[:7] == '/stats/': # Remove the '/stats/' from the beginning of the pathname in order # to get the day day = pathname[7:] if day not in days: return '404' return statistics_vis.getTabsLayout(day) else: # Remove the '/' from the beginning of the pathname in order # to get the day day = pathname[1:] if day in days: return timeline_vis.getTimelineLayout(day) return '404'
def chart_menu(): return html.Ul(className='nav justify-content-end', children=[ html.Li(className='nav-item', children=[ html.A(className='nav-link', href='/candidates/line', children=['Linha']), ]), html.Ul(className='nav nav-pills mb-3', children=[ html.Li(className='nav-item', children=[ html.A(className='nav-link', href='/candidates/bar', children=['Barra']), ]), ]), html.Ul(className='nav nav-pills mb-3', children=[ html.Li(className='nav-item', children=[ html.A( className='nav-link', href='/candidates/bubble', children=['Bolha']), ]), ]), html.Ul(className='nav nav-pills mb-3', children=[ html.Li(className='nav-item', children=[ html.A(className='nav-link', href='/candidates/pie', children=['Pizza']), ]), ]), ])
def update_selected_feature_div(value): result = [] for key, values in dictionary[value].items(): result.append('{}:{}'.format(key, values)) div = html.Div([ html.Div([ html.H3('Feature Informatation') ]), html.Div([ html.Ul([html.Li(x) for x in result]) ]), ]) return div
def node_show(click): with open('G.pkl', 'rb') as Gn: G = pickle.load(Gn) node=click['points'][0]['text'] connections=G.neighbors(node) count=len([n for n in connections]) children=[html.H2('Character: {}'.format(node)), html.Br(), html.H2('Number of Connections: {}'.format(count)), html.Br(), html.H2('Shared a scene with:'), html.Br(), html.Ul([html.Li(x) for x in G.neighbors(click['points'][0]['text'])])] return children
def todo_layout() -> html.Div: return html.Div( children=[ html.H1("To Do List"), html.Ul( id="my-todo-ul", children=list_tasks(data_store["tasks"]), ), dcc.Input(id="my-todo-input"), html.Button( id="my-todo-button", n_clicks=0, children="Add Task" ), ] )
def generateList(self, sort_by, dark_theme): listItems = self.listItem.generateItems(sort_by) if dark_theme: background_color = 'rgb(34, 34, 34)' else: background_color = 'rgb(255, 255, 255)' return html.Div([ html.Div( [ html.Span(['Sort By:'], style={'width': '80px'}), dcc.Dropdown(id='sort-list', options=[{ 'label': 'Deaths per 1 million', 'value': 'DeathsPerMil' }, { 'label': 'Total number of deaths', 'value': 'NumberOfDeaths' }, { 'label': 'Accidents per 1 million', 'value': 'AccidentsPerMil' }, { 'label': 'Total number of accidents', 'value': 'NumberOfAccidents' }, { 'label': 'EMT arrival time to scene', 'value': 'AvgArrivalTime' }, { 'label': 'EMT arrival time to hospital', 'value': 'AvgHospitalArrivalTime' }], value=sort_by, searchable=False, clearable=False, style={ 'fontSize': '14px', 'width': '-webkit-fill-available' }) ], style={ 'position': 'sticky', 'top': 0, 'zIndex': 10, 'display': 'flex', 'alignItems': 'center', 'backgroundColor': background_color }), html.Ul(listItems, style={'marginTop': '10px'}) ])
def _preview(n_clicks): if n_clicks is None or n_clicks == 0: return _dash.no_update jd = [ _html.H2('Structures Foreman'), _html.H6('The Company:'), _html.P('Our company is a boutique multi award winning building contractor ' + 'with a fantastic history of success and a very low turnover of staff.'), _html.H6('Purpose of the role:'), _html.P(_purpose_of_the_role), _html.H6('Main Duties / Responsibilities:'), _html.Ul( [_html.Li(duty) for duty in _duties.values()] ), _html.H6('Skills:'), _html.Ul( [_html.Li(skill) for skill in list(_skills.values())[:-1]] ), _html.H6('Qualifications & Experience:'), _html.Ul( [_html.Li(qual) for qual in _qualifications.values()] ), _html.H6('Salary Range: $120,000 - $150,000'), _html.P('If you have the relevant skill set and experience as set out above ' + 'and are interested in discussing this opportunity further, ' + 'please send across your CV to XXX XXX or call 02 XXXX XXXX.') ] children = [ _html.Div(jd), _html.Div( _html.Button('Publish', id='publish_button'), id='publish_status_div', style={'display': 'inline-block', 'margin-right': '20px'} ), _html.Div(style={'margin': '20px'}), ] return children
def get_keyindex(color, unit, list_elt): list_elt_display = [] for i, elt in enumerate(list_elt): if i == 0: elt_li = html.Li(children=[elt[0]]) elt_li2 = html.Li(className="big-num", children=[html.H4("{} {}".format(elt[2], unit))]) elt_ul = html.Ul(children=[elt_li, elt_li2]) elt_header = html.Header(children=[elt_ul]) elt_li = html.Li( children=[html.I(className="fa fa-fw fa-calendar-o"), elt[1]]) elt_ul = html.Ul(children=[elt_li]) elt_list = html.Li(className="list", children=[elt_ul]) elt_sections = html.Ul(className="sections", children=[elt_list]) elt_article = html.Article(children=[elt_sections]) list_elt_display += [elt_header, elt_article] else: elt_i2 = html.I(className="fa fa-fw fa-clock-o") elt_li3 = html.Li(children=[elt_i2, elt[0]]) elt_i3 = html.I(className=elt[1]) elt_li4 = html.Li(className="big-num", children=[elt_i3, "{} {}".format(elt[2], unit)]) elt_group = html.Ul(className="sections", children=[elt_li3, elt_li4]) elt_footer = html.Footer(children=elt_group) list_elt_display += [elt_footer] elt_section = html.Section(className="bubble", style={"background-color": color}, children=list_elt_display) return elt_section
def get_navbar(): """Returns the navigation bar.""" items = [] for i, section_name in enumerate(sections): list_item = html.Li( html.A( section_name.capitalize(), href=f'/{section_name}', id=f'_nav-bar-{section_name}', ), ) items.append(list_item) # Add a logout button to send the user somewhere items.append(html.Li(html.A('Logout', href=f'/logout'))) navbar = html.Ul(items) return navbar
def get_navbar(): """ Create the website wide navigation bar in Dash. :return: The dash based navigation bar element. :rtype: dash_html_components.html.Ul """ return html.Ul(className="topnav", children=[ html.Li(html.A('Home', href='/')), html.Li(html.A('Cursas', href='', className="active")), html.Li(html.A('Repositories', href='/cgit')), html.Li(html.A('Contact', href='/contact.html'), style={'float': 'right'}), ])
def display_click_data(clickData, word_query, facet): import re word_query = json.loads(word_query) word = word_query['word'] compare_word = word_query['compare'] try: facet_value_select = clickData['points'][0]['y'] year_select = int(clickData['points'][0]['x']) except: return html.Ul(html.Li(html.Em("Nothing selected"))) if compare_word and compare_word.strip() != '': word = word + "," + compare_word q = word.split(",") bw_html.search_limits = { facet: [facet_value_select], 'date_year': year_select, 'word': q } results = bw_html.run() # Format results links = [] for result in results.json(): try: groups = re.search("href=(.*)><em>(.*?)</em> \((.*?)\)", result).groups() link = html.Li( html.A(href=groups[0], target='_blank', children=["%s (%s)" % (groups[1], groups[2])])) links.append(link) except: raise print(links) return html.Ul(links)
def rec_list(n): # read data from cloud sql con = pymysql.connect(host="34.87.57.222", user="******", passwd="", db="movies") query = "SELECT * FROM reco" rec_df_small = pd.read_sql(query, con) children = html.Div( html.Ul( id="sample-list", children=[html.Li(i) for i in rec_df_small.title.sample(10)], )) con.close() return children
def ArgumentsList(component_props, component_name): if component_name is not None: heading = f"Keyword arguments for {component_name}" else: heading = "Keyword arguments" component_props = reorder_props(filter_props(component_props)) arguments = [] for name, metadata in component_props.items(): arguments.append(Argument(name, metadata)) if not arguments: return [] return [ html.H4(heading, className="mt-5 mb-2"), html.Ul(arguments, className="list-unstyled"), ]
def header(): """Generate header with navlinks""" navbar = dbc.Navbar( className="pt-0 pb-0 pr-0 pl-0 mb-1", children=[ html.Div( className="navbar-collapse header-koruza", children=[ html.Ul( id="nav", className="navbar-nav mr-auto", children=[ html.Li( style={"height": "33px"}, children=[ dbc.NavItem( dbc.NavLink( id="info-navlink", className="custom-nav-link", children="KORUZA Link Information", href="/info", active="exact")) ]), html.Li(style={"height": "33px"}, children=[ dbc.NavItem( dbc.NavLink( id="dashboard-navlink", className="custom-nav-link", children="Unit Dashboard", href="/dashboard", active="exact")) ]), html.Li(style={"height": "33px"}, children=[ dbc.NavItem( dbc.NavLink( id="calibration-navlink", className="custom-nav-link", children="Unit Calibration", href="/calibration", active="exact")) ]), ]) ]) ]) return navbar
def lista_proyectos(df, name_institucion, estatus_btn, compare): dff = df.loc[df['entidad/institucion'].isin([name_institucion])] dff = dff.loc[df['estatus_proyecto'].isin(estatus_btn)] dff = dff.reset_index(drop=True) x = [] codigo = [] if estatus_btn[0] in compare: for i in range(len(dff)): x.append( html.Div([ html.Br(), html.Li(html.A(id='hola', children=dff.loc[i, 'codigo_proyecto'], href=dff.loc[i, 'codigo_proyecto']), style={'color': 'blue'}), html.Ul( html.Div( html.Li( ['Nombre: ', dff.loc[i, 'nombre_proyecto']]))), html.Ul( html.Div( html.Li([ 'Estatus: ', dff.loc[i, 'estatus_proyecto'] ]))), html.Ul( html.Div( html.Li(['Indice de gestion: ', dff.loc[i, 'ig'] ]))), html.Ul( html.Div( html.Li([ 'Indice de planificacion: ', dff.loc[i, 'ip'] ]))), html.Ul( html.Div( html.Li( ['Indice de ejecucion: ', dff.loc[i, 'ie']]))) ], className="ml-5 col-md-9")) codigo.append(dff.loc[i, 'codigo_proyecto']) else: x.append( html.Div([ html.Br(), html.Li(html.A('Proyecto no encontrado'), style={'color': 'blue'}), html.Ul( html.Div(html.Li(['Nombre: ', 'Proyectos no encontrados' ]))) ], className="ml-5 col-md-9")) return x, codigo
def file_uploader(): return html.Div(id="file-upload", className="container-div", children=[ dcc.Upload(className="file-uploader", id='upload-data', children=html.Div(['Drop file to upload']), multiple=True), html.Ul(id='file-list', className='file-list'), html.Button('Remove Upload Data', id='remove-upload', n_clicks=0, className="btn-primary"), html.Div(className="hr"), dcc.Store(id='output_dir') ])
def get_breadcrumb(parts): if not parts: return html.Div() breadcrumbs = html.Nav( html.Ul([ html.Li( html.A(name, href=link), className=(None if idx != len(parts) - 1 else "is-active"), ) for idx, (name, link) in enumerate(parts.items()) ]), className="breadcrumb", ) return breadcrumbs
def __unwrap_section_and_points(self, section, points): layout = html.Div([ html.Div( html.H5( self.__format_string(section, self.data), style={"color": self.colors["subtitle"]}, )), html.Div( html.Ul([ html.Li(html.P(self.__format_string(item, self.data))) for item in points ]), style={"color": self.colors["text"]}, ), ]) return layout
def Navbar(app: Dash, download: bool = False) -> html.Nav: return html.Nav([ html.Div([ dcc.Link([ html.Img(src=app.get_asset_url("logo-black.png")), html.Span("Compliance: The Basics") ], href="/home", className="nav-brand"), html.Ul(generate_nav_links(download=download), className="nav-links", id="nav-list") ], className="nav-container") ], className="navigation bg-nav")