@@ -96,29 +96,30 @@ class StreamlitOutputBuffer(io.TextIOBase):
|
|||||||
visible_lines.append(self.current_line)
|
visible_lines.append(self.current_line)
|
||||||
visible_lines = visible_lines[-self.max_lines :]
|
visible_lines = visible_lines[-self.max_lines :]
|
||||||
content = html.escape("\n".join(visible_lines))
|
content = html.escape("\n".join(visible_lines))
|
||||||
self.placeholder.caption("Scan Details")
|
with self.placeholder.container():
|
||||||
components.html(
|
st.caption("Scan Details")
|
||||||
f"""
|
components.html(
|
||||||
<div id="scan-details" style="
|
f"""
|
||||||
height: {self.height}px;
|
<div id="scan-details" style="
|
||||||
overflow-y: auto;
|
height: {self.height}px;
|
||||||
white-space: pre-wrap;
|
overflow-y: auto;
|
||||||
font-family: monospace;
|
white-space: pre-wrap;
|
||||||
font-size: 0.9rem;
|
font-family: monospace;
|
||||||
padding: 0.75rem;
|
font-size: 0.9rem;
|
||||||
border: 1px solid rgba(49, 51, 63, 0.2);
|
padding: 0.75rem;
|
||||||
border-radius: 0.5rem;
|
border: 1px solid rgba(49, 51, 63, 0.2);
|
||||||
background: white;
|
border-radius: 0.5rem;
|
||||||
">{content}</div>
|
background: white;
|
||||||
<script>
|
">{content}</div>
|
||||||
const el = document.getElementById("scan-details");
|
<script>
|
||||||
if (el) {{
|
const el = document.getElementById("scan-details");
|
||||||
el.scrollTop = el.scrollHeight;
|
if (el) {{
|
||||||
}}
|
el.scrollTop = el.scrollHeight;
|
||||||
</script>
|
}}
|
||||||
""",
|
</script>
|
||||||
height=self.height + 16,
|
""",
|
||||||
)
|
height=self.height + 16,
|
||||||
|
)
|
||||||
|
|
||||||
def getvalue(self) -> str:
|
def getvalue(self) -> str:
|
||||||
visible_lines = list(self.lines)
|
visible_lines = list(self.lines)
|
||||||
|
|||||||
Reference in New Issue
Block a user