Spaces:
Sleeping
Sleeping
Fix Streamlit use_container_width compatibility bug
Browse files
app.py
CHANGED
|
@@ -629,7 +629,7 @@ with col_ctrl:
|
|
| 629 |
|
| 630 |
col_node_btns = st.columns(2)
|
| 631 |
with col_node_btns[0]:
|
| 632 |
-
if st.button("Add/Save Node"
|
| 633 |
if node_id:
|
| 634 |
is_update = node_id in model.nodes
|
| 635 |
if is_update:
|
|
@@ -643,7 +643,7 @@ with col_ctrl:
|
|
| 643 |
else:
|
| 644 |
st.error("Short ID designation required.")
|
| 645 |
with col_node_btns[1]:
|
| 646 |
-
if st.button("Delete Node"
|
| 647 |
if node_id:
|
| 648 |
if model.delete_node(node_id):
|
| 649 |
st.rerun()
|
|
@@ -657,7 +657,7 @@ with col_ctrl:
|
|
| 657 |
edge_path = st.text_input("Path (e.g., A -> B -> C)", key="edge_path")
|
| 658 |
edge_style = st.selectbox("Connector Line Style", ["Straight", "Curved", "Dotted"], key="edge_style")
|
| 659 |
|
| 660 |
-
if st.button("Add Edges"
|
| 661 |
if edge_path:
|
| 662 |
success, msg = model.add_edge_path(edge_path, edge_style)
|
| 663 |
if success:
|
|
@@ -694,7 +694,7 @@ with col_ctrl:
|
|
| 694 |
if model.edges:
|
| 695 |
edge_labels = [f"{e.u} -> {e.v} ({e.style.title()})" for e in model.edges]
|
| 696 |
del_edge_idx = st.selectbox("Select Edge to Delete", range(len(model.edges)), format_func=lambda i: edge_labels[i])
|
| 697 |
-
if st.button("Delete Selected Edge"
|
| 698 |
model.remove_edge(del_edge_idx)
|
| 699 |
st.rerun()
|
| 700 |
else:
|
|
@@ -704,11 +704,11 @@ with col_ctrl:
|
|
| 704 |
with st.expander("Global Actions", expanded=True):
|
| 705 |
col_actions = st.columns(2)
|
| 706 |
with col_actions[0]:
|
| 707 |
-
if st.button("Auto-Layout"
|
| 708 |
model.auto_layout()
|
| 709 |
st.rerun()
|
| 710 |
with col_actions[1]:
|
| 711 |
-
if st.button("Clear All"
|
| 712 |
model.clear()
|
| 713 |
st.rerun()
|
| 714 |
|
|
@@ -719,8 +719,7 @@ with col_ctrl:
|
|
| 719 |
label="Download JSON Project File",
|
| 720 |
data=json_data,
|
| 721 |
file_name="flowchart_project.json",
|
| 722 |
-
mime="application/json"
|
| 723 |
-
use_container_width=True
|
| 724 |
)
|
| 725 |
|
| 726 |
uploaded_file = st.file_uploader("Upload JSON Project", type="json")
|
|
@@ -744,7 +743,7 @@ with col_canvas:
|
|
| 744 |
flowchart_img.save(buffer, format="PNG")
|
| 745 |
img_bytes = buffer.getvalue()
|
| 746 |
|
| 747 |
-
st.image(img_bytes, caption="Clean B&W Flowchart (Auto-cropped)",
|
| 748 |
|
| 749 |
# Download Button
|
| 750 |
st.download_button(
|
|
|
|
| 629 |
|
| 630 |
col_node_btns = st.columns(2)
|
| 631 |
with col_node_btns[0]:
|
| 632 |
+
if st.button("Add/Save Node"):
|
| 633 |
if node_id:
|
| 634 |
is_update = node_id in model.nodes
|
| 635 |
if is_update:
|
|
|
|
| 643 |
else:
|
| 644 |
st.error("Short ID designation required.")
|
| 645 |
with col_node_btns[1]:
|
| 646 |
+
if st.button("Delete Node"):
|
| 647 |
if node_id:
|
| 648 |
if model.delete_node(node_id):
|
| 649 |
st.rerun()
|
|
|
|
| 657 |
edge_path = st.text_input("Path (e.g., A -> B -> C)", key="edge_path")
|
| 658 |
edge_style = st.selectbox("Connector Line Style", ["Straight", "Curved", "Dotted"], key="edge_style")
|
| 659 |
|
| 660 |
+
if st.button("Add Edges"):
|
| 661 |
if edge_path:
|
| 662 |
success, msg = model.add_edge_path(edge_path, edge_style)
|
| 663 |
if success:
|
|
|
|
| 694 |
if model.edges:
|
| 695 |
edge_labels = [f"{e.u} -> {e.v} ({e.style.title()})" for e in model.edges]
|
| 696 |
del_edge_idx = st.selectbox("Select Edge to Delete", range(len(model.edges)), format_func=lambda i: edge_labels[i])
|
| 697 |
+
if st.button("Delete Selected Edge"):
|
| 698 |
model.remove_edge(del_edge_idx)
|
| 699 |
st.rerun()
|
| 700 |
else:
|
|
|
|
| 704 |
with st.expander("Global Actions", expanded=True):
|
| 705 |
col_actions = st.columns(2)
|
| 706 |
with col_actions[0]:
|
| 707 |
+
if st.button("Auto-Layout"):
|
| 708 |
model.auto_layout()
|
| 709 |
st.rerun()
|
| 710 |
with col_actions[1]:
|
| 711 |
+
if st.button("Clear All"):
|
| 712 |
model.clear()
|
| 713 |
st.rerun()
|
| 714 |
|
|
|
|
| 719 |
label="Download JSON Project File",
|
| 720 |
data=json_data,
|
| 721 |
file_name="flowchart_project.json",
|
| 722 |
+
mime="application/json"
|
|
|
|
| 723 |
)
|
| 724 |
|
| 725 |
uploaded_file = st.file_uploader("Upload JSON Project", type="json")
|
|
|
|
| 743 |
flowchart_img.save(buffer, format="PNG")
|
| 744 |
img_bytes = buffer.getvalue()
|
| 745 |
|
| 746 |
+
st.image(img_bytes, caption="Clean B&W Flowchart (Auto-cropped)", use_column_width=False)
|
| 747 |
|
| 748 |
# Download Button
|
| 749 |
st.download_button(
|