Source code for cadrumo.entrypoints.tui.modelo.view.technical_details
"""The collapsed technical-details group every Modelo workspace page ends with.The pages lead with the operator's words. Producer attribution and rawidentifiers are still true and still wanted by whoever debugs a reading, sothey are kept -- folded away under one title, in one shape, on every page."""from__future__importannotationsfromcollections.abcimportIterablefromtextual.widgetimportWidgetfrom.....core.i18n.renderimporttrfrom...components.widgetsimportContentDataTable,DisclosureGroupfrom.modelsimportModeloWorkspaceCapabilityRowV1,capability_labeltypeTechnicalDetailRowV1=tuple[str,str,str]"""One ``(row key, label, raw value)`` entry in a page's technical details."""
[docs]defmount_technical_details(body:Widget,rows:Iterable[TechnicalDetailRowV1],*,id:str)->None:"""Mount the collapsed group holding one page's raw identifiers at the end of ``body``."""table=ContentDataTable[str](id=id,cursor_type="row",zebra_stripes=True)body.mount(DisclosureGroup(table,title=tr("tui.modelo.technical_details"),collapsed=True))table.add_column(tr("tui.modelo.technical.column.field"),key="field")table.add_column(tr("tui.modelo.technical.column.value"),key="value")forkey,label,valueinrows:table.add_row(label,value,key=key)
[docs]defproducer_row(row:ModeloWorkspaceCapabilityRowV1)->TechnicalDetailRowV1:"""Name the producer that answered one capability, under the capability's own name."""return(f"producer.{row.capability.value}",tr("tui.modelo.technical.producer_of",capability=capability_label(row.capability)),f"{row.producer_owner}.{row.producer}",)