MCPcopy Index your code
hub / github.com/pywebio/PyWebIO / _row_column_layout

Function _row_column_layout

pywebio/output.py:1349–1368  ·  view source on GitHub ↗
(content, flow, size, scope=None, position=OutputPosition.BOTTOM)

Source from the content-addressed store, hash-verified

1347
1348
1349def _row_column_layout(content, flow, size, scope=None, position=OutputPosition.BOTTOM) -> Output:
1350 if not isinstance(content, (list, tuple, OutputList)):
1351 content = [content]
1352
1353 if not size:
1354 size = ' '.join('1fr' if c is not None else '10px' for c in content)
1355
1356 content = [c if c is not None else put_html('<div></div>') for c in content]
1357 for item in content:
1358 assert isinstance(item, Output), "put_row()/put_column()'s content must be list of put_xxx()"
1359
1360 style = 'grid-auto-flow: {flow}; grid-template-{flow}s: {size};'.format(flow=flow, size=size)
1361 tpl = """
1362 <div style="display: grid; %s">
1363 {{#contents}}
1364 {{& pywebio_output_parse}}
1365 {{/contents}}
1366 </div>""".strip() % html.escape(style, quote=True)
1367 return put_widget(template=tpl, data=dict(contents=content), scope=scope,
1368 position=position)
1369
1370
1371@safely_destruct_output_when_exp('content')

Callers 2

put_rowFunction · 0.85
put_columnFunction · 0.85

Calls 2

put_htmlFunction · 0.85
put_widgetFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…