Fix: Streamlit deprecation warning use_container_width -> width='stretch'

This commit is contained in:
2026-06-21 18:19:26 -03:00
parent 4f314111d7
commit 7a5e82bf79

View File

@@ -126,7 +126,7 @@ with tab1:
with col_title: with col_title:
st.header("Passenger Demands") st.header("Passenger Demands")
with col_reset: with col_reset:
if st.button("🔄 Reset DB to Raw CSV", type="secondary", use_container_width=True): if st.button("🔄 Reset DB to Raw CSV", type="secondary", width="stretch"):
init_db(demands_raw, df_fleet, force_reset=True) init_db(demands_raw, df_fleet, force_reset=True)
st.success("Database Reset!") st.success("Database Reset!")
st.rerun() st.rerun()
@@ -137,12 +137,12 @@ with tab1:
edited_demand = st.data_editor( edited_demand = st.data_editor(
df_display_demand, df_display_demand,
num_rows="dynamic", num_rows="dynamic",
use_container_width=True, width="stretch",
hide_index=True, hide_index=True,
key="demand_editor" key="demand_editor"
) )
if st.button("💾 Save Demand Changes", type="primary", use_container_width=True): if st.button("💾 Save Demand Changes", type="primary", width="stretch"):
with sqlite3.connect(DB_PATH) as conn: with sqlite3.connect(DB_PATH) as conn:
conn.execute("DROP TABLE IF EXISTS demandas") conn.execute("DROP TABLE IF EXISTS demandas")
conn.execute(''' conn.execute('''
@@ -177,12 +177,12 @@ with tab2:
st.info("💡 Edit specs directly below to simulate larger fleets, different fuel burn, or cargo capacity.") st.info("💡 Edit specs directly below to simulate larger fleets, different fuel burn, or cargo capacity.")
edited_fleet = st.data_editor( edited_fleet = st.data_editor(
df_display_fleet, df_display_fleet,
use_container_width=True, width="stretch",
hide_index=True, hide_index=True,
key="fleet_editor" key="fleet_editor"
) )
if st.button("💾 Save Fleet Changes", type="primary", use_container_width=True): if st.button("💾 Save Fleet Changes", type="primary", width="stretch"):
rename_back = { rename_back = {
'Modelo': 'Modelo', 'Squadron': 'Emissor', 'Fleet Size': 'Tamanho da Frota', 'Modelo': 'Modelo', 'Squadron': 'Emissor', 'Fleet Size': 'Tamanho da Frota',
'Fuel Usage (km/l)': 'Consumo (km/l)', 'Mean Speed (km/h)': 'Velocidade Média (km/h)', 'Fuel Usage (km/l)': 'Consumo (km/l)', 'Mean Speed (km/h)': 'Velocidade Média (km/h)',
@@ -259,7 +259,7 @@ with tab4:
col_prev, col_drop, col_next = st.columns([1, 8, 1]) col_prev, col_drop, col_next = st.columns([1, 8, 1])
with col_prev: with col_prev:
st.markdown("<br/>", unsafe_allow_html=True) st.markdown("<br/>", unsafe_allow_html=True)
if st.button("⬅️", disabled=current_idx==0, use_container_width=True): if st.button("⬅️", disabled=current_idx==0, width="stretch"):
st.session_state.current_map_date = dias_disponiveis[current_idx - 1] st.session_state.current_map_date = dias_disponiveis[current_idx - 1]
st.rerun() st.rerun()
with col_drop: with col_drop:
@@ -269,7 +269,7 @@ with tab4:
st.rerun() st.rerun()
with col_next: with col_next:
st.markdown("<br/>", unsafe_allow_html=True) st.markdown("<br/>", unsafe_allow_html=True)
if st.button("➡️", disabled=current_idx>=len(dias_disponiveis)-1, use_container_width=True): if st.button("➡️", disabled=current_idx>=len(dias_disponiveis)-1, width="stretch"):
st.session_state.current_map_date = dias_disponiveis[current_idx + 1] st.session_state.current_map_date = dias_disponiveis[current_idx + 1]
st.rerun() st.rerun()
@@ -342,7 +342,7 @@ with tab4:
}, inplace=True) }, inplace=True)
st.subheader(f"Flight Schedule for {st.session_state.current_map_date}") st.subheader(f"Flight Schedule for {st.session_state.current_map_date}")
st.dataframe(df_day_display, use_container_width=True) st.dataframe(df_day_display, width="stretch")
# --- TAB 5: RESULTS --- # --- TAB 5: RESULTS ---
with tab5: with tab5:
@@ -372,7 +372,7 @@ with tab5:
pass pass
if not df_results.empty: if not df_results.empty:
st.dataframe(df_results, use_container_width=True) st.dataframe(df_results, width="stretch")
if 'Pernoites' in df_results.columns: if 'Pernoites' in df_results.columns:
st.subheader("Days Out of Base (Pernoites) Breakdown") st.subheader("Days Out of Base (Pernoites) Breakdown")