Update page_files/Categorized_Search.py

#4
Files changed (1) hide show
  1. page_files/Categorized_Search.py +22 -2
page_files/Categorized_Search.py CHANGED
@@ -547,7 +547,7 @@ with left_col:
547
  matrix_options = ["All"] + sorted([item for item in composite_meta["Matrix"].dropna().unique() if item])
548
  fiber_options = ["All"] + sorted([item for item in composite_meta["Fiber"].dropna().unique() if item])
549
 
550
- composition_disabled = st.session_state.active_classes not in [[], ["Composites"]]
551
  st.markdown("<div class='aim-lbl'>🧱 Matrix</div>", unsafe_allow_html=True)
552
  matrix_value = st.selectbox(
553
  "Matrix",
@@ -714,12 +714,27 @@ with right_col:
714
  disabled=["Material Name", "Abbreviation", "Class", "Actions"],
715
  )
716
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
717
  checked_rows = editor_df[
718
  editor_df["Select"]
719
  & editor_df["Abbreviation"].astype(str).str.strip().ne("")
720
  ]
 
721
  if not checked_rows.empty:
722
- chosen = checked_rows.iloc[0]
723
  abbr = chosen["Abbreviation"]
724
  name = chosen["Material Name"]
725
  if (
@@ -728,6 +743,11 @@ with right_col:
728
  ):
729
  st.session_state.selected_row = (abbr, name)
730
  st.rerun()
 
 
 
 
 
731
  info_col, nav_col = st.columns([2.4, 2.0])
732
  with info_col:
733
  st.markdown(
 
547
  matrix_options = ["All"] + sorted([item for item in composite_meta["Matrix"].dropna().unique() if item])
548
  fiber_options = ["All"] + sorted([item for item in composite_meta["Fiber"].dropna().unique() if item])
549
 
550
+ composition_disabled = st.session_state.active_classes != ["Composites"]
551
  st.markdown("<div class='aim-lbl'>🧱 Matrix</div>", unsafe_allow_html=True)
552
  matrix_value = st.selectbox(
553
  "Matrix",
 
714
  disabled=["Material Name", "Abbreviation", "Class", "Actions"],
715
  )
716
 
717
+ #checked_rows = editor_df[
718
+ # editor_df["Select"]
719
+ # & editor_df["Abbreviation"].astype(str).str.strip().ne("")
720
+ #]
721
+ #if not checked_rows.empty:
722
+ # chosen = checked_rows.iloc[0]
723
+ # abbr = chosen["Abbreviation"]
724
+ # name = chosen["Material Name"]
725
+ # if (
726
+ # st.session_state.selected_row is None
727
+ # or st.session_state.selected_row[0] != abbr
728
+ # ):
729
+ # st.session_state.selected_row = (abbr, name)
730
+ # st.rerun()
731
  checked_rows = editor_df[
732
  editor_df["Select"]
733
  & editor_df["Abbreviation"].astype(str).str.strip().ne("")
734
  ]
735
+
736
  if not checked_rows.empty:
737
+ chosen = checked_rows.iloc[-1]
738
  abbr = chosen["Abbreviation"]
739
  name = chosen["Material Name"]
740
  if (
 
743
  ):
744
  st.session_state.selected_row = (abbr, name)
745
  st.rerun()
746
+ else:
747
+ if st.session_state.selected_row is not None:
748
+ st.session_state.selected_row = None
749
+ st.rerun()
750
+
751
  info_col, nav_col = st.columns([2.4, 2.0])
752
  with info_col:
753
  st.markdown(