Bump version to 0.9.4; update localization files and adjust index references in Core and ImageBrowser
All checks were successful
Gitea/kapitanbooru-uploader/pipeline/head This commit looks good

This commit is contained in:
2025-06-26 18:01:13 +02:00
parent 88288c7e22
commit aa6dd9e583
5 changed files with 199 additions and 199 deletions

View File

@@ -59,6 +59,7 @@ class ImageBrowser(tk.Tk):
# Słowniki przechowujące stany tagów (dla PNG i Taggera)
self.png_tags_states = {}
self.tagger_tags_states = {}
self.tagger_thread_idx = 0
self.create_menu()
self.create_widgets()
@@ -80,7 +81,7 @@ class ImageBrowser(tk.Tk):
lambda idx=idx: self.listbox.itemconfig(idx, {"bg": "lightgray"}),
)
# Jeśli aktualnie wybrany plik, zmień przycisk
if self.current_index == idx:
if self.core.current_index == idx:
self.after(0, self.update_button_states)
def _schedule_update_check(self):
@@ -552,7 +553,7 @@ class ImageBrowser(tk.Tk):
for file in self.core.image_files:
self.listbox.insert(tk.END, os.path.basename(file))
if self.core.image_files:
self.current_index = 0
self.core.current_index = 0
self.listbox.select_set(0)
self.show_image(0)
self.update_button_states()
@@ -585,12 +586,12 @@ class ImageBrowser(tk.Tk):
- Buttons: upload_button, view_post_button
Dependencies:
- Relies on self.current_index to determine selection state
- Relies on self.core.current_index to determine selection state
- Checks self.uploaded against self.image_files for post existence
"""
has_current = self.current_index is not None
has_current = self.core.current_index is not None
post_id = (
self.core.uploaded.get(self.core.image_files[self.current_index])
self.core.uploaded.get(self.core.image_files[self.core.current_index])
if has_current
else None
)
@@ -620,9 +621,9 @@ class ImageBrowser(tk.Tk):
def view_current_post(self):
"""Otwiera w przeglądarce URL posta."""
if self.current_index is None:
if self.core.current_index is None:
return
post_id = self.core.uploaded.get(self.core.image_files[self.current_index])
post_id = self.core.uploaded.get(self.core.image_files[self.core.current_index])
if post_id:
url = self.core.settings.base_url.rstrip("/") + "/post/view/" + str(post_id)
open_webbrowser(url, self.core.settings)
@@ -635,7 +636,7 @@ class ImageBrowser(tk.Tk):
if not self.listbox.curselection():
return
index = self.listbox.curselection()[0]
self.current_index = index
self.core.current_index = index
self.show_image(index)
self.update_button_states()
@@ -645,7 +646,7 @@ class ImageBrowser(tk.Tk):
Wysyła POST z obrazkiem, tagami i ratingiem.
Po zakończeniu uploadu, ustawia przycisk na "Wyświetl".
"""
file_path = self.core.image_files[self.current_index]
file_path = self.core.image_files[self.core.current_index]
if self.core.uploaded.get(file_path, False):
# Jeśli plik już uploadowany, ustaw przycisk na "Wyświetl"
self.update_button_states()
@@ -708,7 +709,7 @@ class ImageBrowser(tk.Tk):
Modyfikuje obrazek na serwerze.
Wysyła POST z md5 obrazka, tagami i ratingiem.
"""
file_path = self.core.image_files[self.current_index]
file_path = self.core.image_files[self.core.current_index]
if not self.core.uploaded.get(file_path, False):
self.update_button_states()
return
@@ -799,12 +800,12 @@ class ImageBrowser(tk.Tk):
"""
Przełącza na poprzedni obraz
"""
if self.current_index is None:
if self.core.current_index is None:
return
new_index = self.current_index - 1
new_index = self.core.current_index - 1
if new_index < 0:
new_index = len(self.core.image_files) - 1
self.current_index = new_index
self.core.current_index = new_index
self.listbox.select_clear(0, tk.END)
self.listbox.select_set(new_index)
self.listbox.activate(new_index)
@@ -815,12 +816,12 @@ class ImageBrowser(tk.Tk):
"""
Przełącza na następny obraz
"""
if self.current_index is None:
if self.core.current_index is None:
return
new_index = self.current_index + 1
new_index = self.core.current_index + 1
if new_index >= len(self.core.image_files):
new_index = 0
self.current_index = new_index
self.core.current_index = new_index
self.listbox.select_clear(0, tk.END)
self.listbox.select_set(new_index)
self.listbox.activate(new_index)
@@ -1145,14 +1146,14 @@ class ImageBrowser(tk.Tk):
Jeśli wynik jest już w cache, wykorzystuje go; w przeciwnym razie uruchamia Taggera
i zapisuje wynik do cache.
"""
if self.current_index is None:
if self.core.current_index is None:
return
# Ustaw komunikat, że Tagger pracuje
self.tagger_tags_text.config(state=tk.NORMAL)
self.tagger_tags_text.delete("1.0", tk.END)
self.tagger_tags_text.insert("1.0", _("Tagger przetwarza..."))
self.tagger_tags_text.config(state=tk.DISABLED)
file_path = self.core.image_files[self.current_index]
file_path = self.core.image_files[self.core.current_index]
result = self.core.get_tagger_results(file_path, lambda: self.after(0, self.update_status_bar))
new_rating = self.core.map_tagger_rating(result)
self.rating_var.set(new_rating)