Scoring sorted

This commit is contained in:
2025-12-28 17:44:24 +01:00
parent 7e02e57397
commit 86c4bf61c8
11 changed files with 214 additions and 412 deletions

View File

@@ -11,7 +11,7 @@ from typing import List
from src.core.media_utils import load_icon
from src.core.file_manager import FileManager
from src.core.tag_manager import TagManager
from src.core.tag_manager import TagManager, DEFAULT_TAG_ORDER
from src.core.file import File
from src.core.tag import Tag
from src.core.list_manager import ListManager
@@ -116,6 +116,14 @@ class MultiFileTagAssignDialog(tk.Toplevel):
tags_by_category[tag.category] = []
tags_by_category[tag.category].append((full_path, tag))
# Sort tags within each category
for category in tags_by_category:
if category in DEFAULT_TAG_ORDER:
order = DEFAULT_TAG_ORDER[category]
tags_by_category[category].sort(key=lambda x: order.get(x[1].name, 999))
else:
tags_by_category[category].sort(key=lambda x: x[1].name)
for category in sorted(tags_by_category.keys()):
color = self.category_colors.get(category, "#333333")
is_exclusive = category in EXCLUSIVE_CATEGORIES
@@ -127,7 +135,7 @@ class MultiFileTagAssignDialog(tk.Toplevel):
self.category_checkbuttons[category] = []
for full_path, tag in sorted(tags_by_category[category], key=lambda x: x[1].name):
for full_path, tag in tags_by_category[category]:
have_count = sum(1 for s in file_tag_sets if full_path in s)
if have_count == 0:
init = 0