From 5e0e29c405cd404e81001b941e4fe8c6510d46e8 Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Sat, 17 Jan 2026 13:36:40 +0100 Subject: [PATCH] Update tab_id_review.py --- tab_id_review.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tab_id_review.py b/tab_id_review.py index f5e566b..67ca3df 100644 --- a/tab_id_review.py +++ b/tab_id_review.py @@ -7,12 +7,12 @@ def render(path_t, path_c, quality): map_c = SorterEngine.get_id_mapping(path_c) common_ids = sorted(list(set(map_t.keys()) & set(map_c.keys()))) - if common_ids: - curr_id = common_ids[0] + if st.session_state.idx_id < len(common_ids): + curr_id = common_ids[st.session_state.idx_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) - st.subheader(f"Reviewing ID: {curr_id}") + st.subheader(f"Reviewing ID: {curr_id} ({st.session_state.idx_id + 1}/{len(common_ids)})") col1, col2 = st.columns(2) img1 = SorterEngine.compress_for_web(t_p, quality) @@ -21,7 +21,8 @@ def render(path_t, path_c, quality): if img1: col1.image(img1, caption=t_f) if img2: col2.image(img2, caption=c_f) - if st.button("❌ Move Pair to Unused", use_container_width=True): + btn_col1, btn_col2 = st.columns(2) + if btn_col1.button("❌ Move Pair to Unused", use_container_width=True, type="primary"): t_un = os.path.join(path_t, "unused", t_f) c_un = os.path.join(path_c, "unused", c_f) os.makedirs(os.path.dirname(t_un), exist_ok=True) @@ -29,6 +30,14 @@ def render(path_t, path_c, quality): shutil.move(t_p, t_un) shutil.move(c_p, c_un) st.session_state.history.append({'type': 'unused', 't_src': t_p, 't_dst': t_un, 'c_src': c_p, 'c_dst': c_un}) + st.session_state.idx_id += 1 + st.rerun() + + if btn_col2.button("✅ Keep Both / Next", use_container_width=True): + st.session_state.idx_id += 1 st.rerun() else: - st.info("No existing ID matches found.") \ No newline at end of file + st.info("No matching IDs found.") + if st.button("Reset Review Progress"): + st.session_state.idx_id = 0 + st.rerun() \ No newline at end of file