def generate_ihm(report_data): a = Airium() a('<!DOCTYPE html>') with a.html(lang="pl"): with a.head(): a.meta(charset="utf-8") a.title(_t="Mission Report") with a.body(): with a.h1(id="id23409231", klass='main_header'): a("Mission Report") with a.p(): a("Drix mission between "+ display_date(report_data.date_d)+" and "+ display_date(report_data.date_f)) with a.h2(id="id23409231", klass='main_header'): a("Gps data : "+"<a href = ../IHM/gps/Bilan_gps.html>Processed</a>"+'<br>') with a.p(): a("Total Distance performed : "+str(report_data.msg_gps["global_dist"])+" km"+'<br>') a("Average speed : "+str(report_data.msg_gps['global_speed'])+" in m/s, "+str(report_data.msg_gps["global_knots"])+" in knot") with a.h2(id="id23409231", klass='main_header'): a("Drix status data: "+"<a href = ../IHM/drix_status/Bilan_drix_status.html>Processed</a>"+'<br>') with a.h2(id="id23409231", klass='main_header'): a("Telemetry data : "+"<a href = ../IHM/telemetry/Bilan_telemetry.html>Processed</a>"+'<br>') with a.h2(id="id23409231", klass='main_header'): a("Gpu state data : "+"<a href = ../IHM/gpu_state/Bilan_gpu_state.html>Processed</a>"+'<br>') with a.h2(id="id23409231", klass='main_header'): a("Phins data : "+"<a href = ../IHM/phins/Bilan_phins.html>Processed</a>"+'<br>') with a.h2(id="id23409231", klass='main_header'): a("Trimmer data : "+"<a href = ../IHM/trimmer_status/Bilan_trimmer_status.html>Processed</a>"+'<br>') with a.h2(id="id23409231", klass='main_header'): a("Iridium data : "+"<a href = ../IHM/iridium/Bilan_iridium_status.html>Processed</a>"+'<br>') with a.h2(id="id23409231", klass='main_header'): a("Autopilot data : "+"<a href = ../IHM/autopilot/Bilan_autopilot.html>Processed</a>"+'<br>') with a.h2(id="id23409231", klass='main_header'): a("RC_command data : "+"<a href = ../IHM/rc_command/Bilan_rc_command.html>Processed</a>"+'<br>') with a.h2(id="id23409231", klass='main_header'): a("Diagnostics data : "+"<a href = ../IHM/diagnostics/Bilan_diagnostics.html>Processed</a>"+'<br>') html = str(a) # casting to string extracts the value with open('../IHM/Mission_report.html', 'w') as f: f.write(str(html))
filenames = [["g{:.6f}_k{:.6f}.html".format(g_value, k_value) for k_value in rows] for g_value in cols] print(filenames) 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]
def create_index_page(out_dir: str, out_name: str, gen_files: List[str]) -> None: """ Generates index page. """ template = Airium() logging.info("Generating: %s", out_name) with template.html(): with template.head(): template.title(_t="Enso Reference") template.link(href="style.css", rel="stylesheet") template.link(href="favicon.ico", rel="icon") template.style(_t="ul { padding-inline-start: 15px; }") template.style( _t="""ul, .section ul { list-style: none; padding: 0; margin: 0; word-wrap: initial; } ul li { padding: 5px 10px; } .section ul { display: none; } .section input:checked ~ ul { display: block; } .section input[type=checkbox] { display: none; } .section { position: relative; padding-left: 20px !important; } .section label:after { content: "+"; position: absolute; top: 0; left: 0; padding: 0; text-align: center; font-size: 17px; color: cornflowerblue; transition: all 0.3s; } .section input:checked ~ label:after { color: cadetblue; transform: rotate(45deg); } @media only screen and (max-width: 1100px) { #tree { width: 30% !important; } } """ ) template.script( _t="""function set_frame_content(file) { document.getElementById("frame").src = file }""" ) with template.body(style="background-color: #333"): template.h2( style="""text-align: center; padding: 15px; margin: 0; color: #fafafa""", _t="Enso Reference", ) with template.div( style="background-color: #fafafa; display: flex; height: 100%" ): with template.div( id="tree", style="""background-color: #efefef; border-radius: 14px; width: 20%; margin: 15px; padding-left: 20px; overflow: scroll; height: 90%;""", ): grouped_file_names = group_by_prefix(gen_files) create_html_tree(template, "", grouped_file_names, gen_files) template.iframe( frameborder="0", height="100%", id="frame", src="Base-Main.html", width="100%", target="_blank", ) html_file = open(out_dir + "/" + out_name, "w") html_file.write(str(template)) html_file.close()