Better UI, edit tags
All checks were successful
Gitea/kapitanbooru-uploader/pipeline/head This commit looks good

This commit is contained in:
2025-02-26 22:41:56 +01:00
parent dbea14888e
commit 5571e18102
3 changed files with 319 additions and 111 deletions

View File

@@ -179,20 +179,24 @@ class TagManager(tk.Frame):
based on custom logic.
"""
def __init__(self, master, settings: Settings, tags_repo: TagsRepo, *args, **kwargs):
def __init__(
self, master, settings: Settings, tags_repo: TagsRepo, *args, **kwargs
):
super().__init__(master, *args, **kwargs)
self.tags_repo = tags_repo
self.settings = settings
self.manual_tags = [] # List to hold manually entered tags
# Entry for new tags (with autocompletion)
self.entry = AutocompleteEntry(self, callback=self.add_tag, tags_repo=self.tags_repo)
self.entry = AutocompleteEntry(
self, callback=self.add_tag, tags_repo=self.tags_repo
)
self.entry.pack(fill=tk.X, padx=5, pady=5)
# Text widget for displaying already entered tags
self.tags_display = tk.Text(self, wrap="word", height=4)
self.tags_display = tk.Text(self, wrap=tk.WORD, height=4)
self.tags_display.pack(fill=tk.BOTH, expand=True, padx=5, pady=5)
self.tags_display.config(state="disabled")
self.tags_display.config(state=tk.DISABLED)
# (Optional: add a scrollbar if needed)
def add_tag(self, tag):
@@ -229,7 +233,7 @@ class TagManager(tk.Frame):
self.tags_display.tag_bind(tag_name, "<Button-1>", self.remove_tag)
self.tags_display.tag_bind(tag_name, "<Button-3>", self.open_tag_wiki_url)
self.tags_display.insert(tk.INSERT, " ")
self.tags_display.config(state="disabled")
self.tags_display.config(state=tk.DISABLED)
def remove_tag(self, event):
"""Remove the clicked tag from the list and update the display."""