Update tab_id_review.py
This commit is contained in:
@@ -12,24 +12,25 @@ def render(path_t, path_c, quality):
|
|||||||
t_f, c_f = map_t[curr_id], map_c[curr_id]
|
t_f, c_f = map_t[curr_id], map_c[curr_id]
|
||||||
t_p, c_p = os.path.join(path_t, t_f), os.path.join(path_c, c_f)
|
t_p, c_p = os.path.join(path_t, t_f), os.path.join(path_c, c_f)
|
||||||
|
|
||||||
st.subheader(f"Reviewing ID: {curr_id} ({st.session_state.idx_id + 1}/{len(common_ids)})")
|
st.subheader(f"Reviewing ID: {curr_id}")
|
||||||
col1, col2 = st.columns(2)
|
col1, col2 = st.columns(2)
|
||||||
|
|
||||||
img1 = SorterEngine.compress_for_web(t_p, quality)
|
img1 = SorterEngine.compress_for_web(t_p, quality)
|
||||||
img2 = SorterEngine.compress_for_web(c_p, quality)
|
img2 = SorterEngine.compress_for_web(c_p, quality)
|
||||||
|
|
||||||
if img1: col1.image(img1, caption=t_f)
|
if img1: col1.image(img1, caption=f"Target: {t_f}")
|
||||||
if img2: col2.image(img2, caption=c_f)
|
if img2: col2.image(img2, caption=f"Control: {c_f}")
|
||||||
|
|
||||||
btn_col1, btn_col2 = st.columns(2)
|
btn_col1, btn_col2 = st.columns(2)
|
||||||
if btn_col1.button("❌ Move Pair to Unused", use_container_width=True, type="primary"):
|
if btn_col1.button("❌ Move Pair to Unused (Synced Name)", use_container_width=True, type="primary"):
|
||||||
t_un = os.path.join(path_t, "unused", t_f)
|
# Use the new engine method to ensure names match in 'unused'
|
||||||
c_un = os.path.join(path_c, "unused", c_f)
|
t_un, c_un = SorterEngine.move_to_unused_synced(t_p, c_p, path_t, path_c)
|
||||||
os.makedirs(os.path.dirname(t_un), exist_ok=True)
|
|
||||||
os.makedirs(os.path.dirname(c_un), exist_ok=True)
|
st.session_state.history.append({
|
||||||
shutil.move(t_p, t_un)
|
'type': 'unused',
|
||||||
shutil.move(c_p, c_un)
|
't_src': t_p, 't_dst': t_un,
|
||||||
st.session_state.history.append({'type': 'unused', 't_src': t_p, 't_dst': t_un, 'c_src': c_p, 'c_dst': c_un})
|
'c_src': c_p, 'c_dst': c_un
|
||||||
|
})
|
||||||
st.session_state.idx_id += 1
|
st.session_state.idx_id += 1
|
||||||
st.rerun()
|
st.rerun()
|
||||||
|
|
||||||
@@ -38,6 +39,3 @@ def render(path_t, path_c, quality):
|
|||||||
st.rerun()
|
st.rerun()
|
||||||
else:
|
else:
|
||||||
st.info("No matching IDs found.")
|
st.info("No matching IDs found.")
|
||||||
if st.button("Reset Review Progress"):
|
|
||||||
st.session_state.idx_id = 0
|
|
||||||
st.rerun()
|
|
||||||
Reference in New Issue
Block a user