def fuelTable(data): html = Airium() if data: with html.table(): ft = "Fuel type: " + FuelTypes[int(data[0]["fuelType"])] with html.div(klass='fueltype_header', _t=ft): with html.tr(): html.th(klass='Price', _t='Price') html.th(klass='Name', _t='Name') html.th(_t='Address') html.th(klass='Location', _t='Location') for d in data: with html.tr(): html.td(_t=d['price']) html.td(_t=d['trading-name']) html.td(_t=d['address']) html.td(_t=d['location']) return str(html)
def buildOrgTab(): orgs = dashboard.organizations.getOrganizations() html = Airium() with html.table(klass='orgTable'): with html.tr(): html.th(klass='id', _t='ID') html.th(klass='org', _t='Organisation') html.th(klass='orgbutton', _t='Update') for org in orgs: with html.tr(): html.td(id=org['id'], _t=org['id']) html.td(_t=org['name']) with html.td(): updateOrg = 'updateOrg(' + org['id'] + ')' html.button(type='button', _t='Update', onclick=updateOrg) return str(html)
def buildTable(data): html = Airium() with html.table(klass='templateTable'): for i in data: with html.tr(): html.td(_t=i['name']) if (isinstance(i['value'], bool)): with html.td(): if ('enable'): html.input(type='checkbox', checked='') else: html.input(type='checkbox') elif (isinstance(i['value'], dict)): html.td() return str(html)
def steam_game_uhtml(**kwargs): html = Airium() game_stat_style = ('vertical-align:bottom;' 'font-size:10px;' 'color:#FFF;' 'padding: 0px 5px 5px 0px') with html.tr(): html.td(style='padding: 0px 5px 5px 5px', _t=kwargs['img_uhtml']) with html.td(align='left', style='vertical-align:top; font-size:10px'): html.a(href=kwargs['url'], style='color:#FFF', _t=kwargs['name']) with html.td(align='right', style=game_stat_style): html(f"""{kwargs['recent_hours']} hrs last 2 weeks""") html.br() html(f"""{kwargs['total_hours']} hrs total playtime""") return html
a = Airium() a('<!DOCTYPE html>') with a.html(lang="en"): with a.head(): a.meta(charset="utf-8") a.title(_t="Index") a.style(_t=CSS_STRING()) # a.script(type="text/javascript", src="index.js") with a.body(): a.h2(_t="Index") with a.table(id='table_372'): with a.tr(): pivot_str = "k \\ g" a.td(_t=pivot_str) for y in cols: column_label = "{:3}".format(y) a.td(_t=column_label) for i, x in enumerate(rows): with a.tr(): a.td(_t=x) for j, y in enumerate(cols): with a.td(): t = filenames[i][j] link = "tables/" + t a.a(href=link, _t="link")
def form_html_plot(): #initilize figure object fig = go.Figure() zulip_data = get_zulip_data(config.name) git_data = get_git_data(config.name) jitsiClasses_data = get_jitsiClasses_data(config.email) jitsiSession_data = get_jitsiSession_data(config.email) fig.add_trace( go.Bar(name='Zulip Activity', x=list(zulip_data[0].keys()), y=list(zulip_data[0].values()), text=list(zulip_data[0].values()), textposition='auto')) fig.add_trace( go.Bar(name='GitLab Activity', x=list(git_data[0].keys()), y=list(git_data[0].values()), text=list(git_data[0].values()), textposition='auto')) fig.add_trace( go.Bar(name='JitsiClasses Activity', x=list(jitsiClasses_data[0].keys()), y=list(jitsiClasses_data[0].values()), text=list(jitsiClasses_data[0].values()), textposition='auto')) fig.add_trace( go.Bar(name='JitsiSession Activity', x=list(jitsiSession_data[0].keys()), y=list(jitsiSession_data[0].values()), text=list(jitsiSession_data[0].values()), textposition='auto')) fig.update_layout( title=f'Activity in MIEM Services. Name - {config.name}', xaxis_title='Time', yaxis_title='Amount', barmode='group') fig.update_xaxes(dtick="M1", tickformat="%b-%Y") #Form html file a = Airium() a('<!DOCTYPE html>') with a.html(): with a.head(): with a.html(lang='en'): a.meta(charset='utf-8') a.title(_t=config.name) a.link(href='style.css', rel='stylesheet', type='text/css') a.script(src='https://cdn.plot.ly/plotly-latest.min.js') a.font('Courier New, monospace') #a.style() with a.body(): a.append( plotly.offline.plot(fig, include_plotlyjs=False, output_type='div')) with a.font(size='3', face="Courier New, monospace", color='#2a3f5f'): with a.table(align='center', style='border-spacing: 100px 0px'): with a.tr(klass='header_row'): a.th(_t='Name of the service') a.th(_t='Total action amount') a.th(_t='Profile existence') with a.tr(): a.td(_t='Zulip', align='center') a.td(_t=zulip_data[1], align='center') a.td(_t=zulip_data[2], align='center') with a.tr(): a.td(_t='GitLab', align='center') a.td(_t=git_data[1], align='center') a.td(_t=git_data[2], align='center') with a.tr(): a.td(_t='JitsiClasses', align='center') a.td(_t=jitsiClasses_data[1], align='center') a.td(_t='-', align='center') # can use _t or text with a.tr(): a.td(_t='JitsiSession', align='center') a.td(_t=jitsiSession_data[1], align='center') a.td(_t='-', align='center') with a.h3(klass='main_header', align='center'): a(f"Activity grade: {cult_grade(zulip_data, git_data,jitsiClasses_data,jitsiSession_data)}" ) with a.div(align='center'): a(f"Данные актуальны на {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}" ) html = str(a) with open(config.html_path, 'w') as f: f.write(str(html))