Update gallery_app.py

This commit is contained in:
2026-01-20 12:35:13 +01:00
parent 77aaae6491
commit 2456503b09

View File

@@ -23,7 +23,7 @@ class AppState:
# View Settings
self.page = 0
self.page_size = 24
self.page_size = 12 # Reduced from 24 to prevent memory issues
self.grid_cols = 4
self.preview_quality = 50
@@ -608,24 +608,7 @@ def set_page(p: int):
state._dirty_pagination = True
state._dirty_gallery = True
refresh_ui()
# Preload next page in background
asyncio.create_task(preload_adjacent_pages())
async def preload_adjacent_pages():
"""Preload thumbnails for adjacent pages in background."""
pages_to_preload = []
if state.page < state.total_pages - 1:
next_start = (state.page + 1) * state.page_size
pages_to_preload.extend(state.all_images[next_start:next_start + state.page_size])
if pages_to_preload:
await run.cpu_bound(
SorterEngine.load_batch_parallel,
pages_to_preload,
state.preview_quality
)
# Removed background preloading - was causing memory issues
def refresh_ui():
"""Refresh dirty UI components only."""