Update engine.py
This commit is contained in:
18
engine.py
18
engine.py
@@ -503,26 +503,14 @@ class SorterEngine:
|
||||
conn.commit()
|
||||
conn.close()
|
||||
|
||||
# In engine.py / SorterEngine class
|
||||
@staticmethod
|
||||
def get_tagged_page_indices(all_images, page_size):
|
||||
"""
|
||||
Returns a Set of page numbers (0-indexed) that contain at least one staged image.
|
||||
"""
|
||||
staged = SorterEngine.get_staged_data()
|
||||
if not staged:
|
||||
return set()
|
||||
|
||||
if not staged: return set()
|
||||
tagged_pages = set()
|
||||
staged_keys = set(staged.keys())
|
||||
|
||||
# We iterate only through the staged items to find their page index
|
||||
# This is faster than iterating all images if staged < total
|
||||
# However, we need the index from the main list.
|
||||
# Since we need order, iterating all_images once is safest and fast enough.
|
||||
|
||||
for idx, img_path in enumerate(all_images):
|
||||
if img_path in staged_keys:
|
||||
page_idx = idx // page_size
|
||||
tagged_pages.add(page_idx)
|
||||
|
||||
tagged_pages.add(idx // page_size)
|
||||
return tagged_pages
|
||||
Reference in New Issue
Block a user