Bump version to 0.9.7; update localization files, fix settings window, Linux build, fix LoRA parsing, remove uncessary default tag
All checks were successful
Gitea/kapitanbooru-uploader/pipeline/head This commit looks good
All checks were successful
Gitea/kapitanbooru-uploader/pipeline/head This commit looks good
This commit is contained in:
@@ -35,7 +35,7 @@ class Core:
|
||||
"""
|
||||
|
||||
def __init__(self, settings: Settings, gui_mode: bool = True):
|
||||
self.version = "0.9.6"
|
||||
self.version = "0.9.7"
|
||||
self.acknowledged_version = parse_version(self.version)
|
||||
self.settings = settings
|
||||
self.tags_repo = TagsRepo(settings)
|
||||
|
@@ -157,6 +157,7 @@ class ImageBrowser(tk.Tk):
|
||||
# Rebuild UI
|
||||
self.create_menu()
|
||||
self.create_widgets()
|
||||
self.update_idletasks()
|
||||
|
||||
def adjust_text_widget_height(self, widget):
|
||||
"""
|
||||
@@ -313,7 +314,6 @@ class ImageBrowser(tk.Tk):
|
||||
def open_settings(self):
|
||||
settings_window = tk.Toplevel(self)
|
||||
settings_window.title(_("Ustawienia"))
|
||||
settings_window.geometry("300x430") # Enlarged vertically
|
||||
settings_window.resizable(False, False) # Disable resizing
|
||||
settings_window.grab_set()
|
||||
|
||||
@@ -394,6 +394,17 @@ class ImageBrowser(tk.Tk):
|
||||
btn_save = tk.Button(settings_window, text=_("Zapisz"), command=save_and_close)
|
||||
btn_save.pack(pady=10)
|
||||
|
||||
# Let Tkinter calculate the required size for all widgets
|
||||
settings_window.update_idletasks()
|
||||
width = 300
|
||||
height = settings_window.winfo_reqheight()
|
||||
settings_window.geometry(f"{width}x{height}")
|
||||
|
||||
# Center the window on the screen
|
||||
x = self.winfo_rootx() + (self.winfo_width() // 2) - (width // 2)
|
||||
y = self.winfo_rooty() + (self.winfo_height() // 2) - (height // 2)
|
||||
settings_window.geometry(f"+{x}+{y}")
|
||||
|
||||
def create_widgets(self):
|
||||
# Główna ramka – trzy kolumny
|
||||
main_frame = tk.Frame(self)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Kapitanbooru Uploader 0.9.6\n"
|
||||
"Project-Id-Version: Kapitanbooru Uploader 0.9.7\n"
|
||||
"Report-Msgid-Bugs-To: kapitan@mlesniak.pl\n"
|
||||
"POT-Creation-Date: 2025-06-26 18:21+0200\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
|
@@ -1,6 +1,6 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Kapitanbooru Uploader 0.9.6\n"
|
||||
"Project-Id-Version: Kapitanbooru Uploader 0.9.7\n"
|
||||
"Report-Msgid-Bugs-To: kapitan@mlesniak.pl\n"
|
||||
"POT-Creation-Date: 2025-06-26 18:21+0200\n"
|
||||
"Language: pl\n"
|
||||
|
@@ -1,7 +1,7 @@
|
||||
networkx==3.4.2
|
||||
Pillow==11.1.0
|
||||
pywin32==309
|
||||
Requests==2.32.3
|
||||
pywin32==309; sys_platform == 'win32'
|
||||
requests==2.32.3
|
||||
wdtagger[cuda12-nightly]==0.14.0
|
||||
bs4==0.0.2
|
||||
tomli==2.2.1
|
@@ -112,7 +112,7 @@ class Settings:
|
||||
self.username = ""
|
||||
self.password = ""
|
||||
self.base_url = "http://192.168.1.11:8001"
|
||||
self.default_tags = "artist:kapitan meta:ai-generated"
|
||||
self.default_tags = "meta:ai-generated"
|
||||
self.cache_expiry = 604800 # 7 dni w sekundach
|
||||
self.browser = ""
|
||||
self.i18n = _
|
||||
@@ -138,7 +138,7 @@ class Settings:
|
||||
self.username = ""
|
||||
self.password = ""
|
||||
self.base_url = "http://192.168.1.11:8001"
|
||||
self.default_tags = "artist:kapitan meta:ai-generated"
|
||||
self.default_tags = "meta:ai-generated"
|
||||
self.cache_expiry = 604800 # 7 dni w sekundach
|
||||
self.browser = ""
|
||||
self.i18n.set_language("en")
|
||||
|
@@ -60,6 +60,8 @@ COEFFICIENT_PATTERN = re.compile(r"^.*?(:\d+|\d+\.\d+)$")
|
||||
UNESCAPED_PATTERN = re.compile(r"(?<!\\)[\(\)\[\]]+")
|
||||
SLASH_PATTERN = re.compile(r"\\+(?=[\(\)](?!\^))")
|
||||
WHITESPACE_PATTERN = re.compile(r"\s+|_+")
|
||||
LORAHASH_PATTERN = re.compile(r"(?P<name>.+?)\:\s(?P<hash>[0-9a-f]+),?\s?")
|
||||
LORA_IN_PROMPT_PATTERN = re.compile(r"\s*<lora:(?P<name>.+?):(?P<weight>[-+]?\d*\.?\d+)>\s*")
|
||||
AUTO_METATAGS = [
|
||||
"absurdres",
|
||||
"high_score",
|
||||
@@ -199,7 +201,7 @@ def extract_parameters(img: Image, file_path: str) -> str:
|
||||
return parameters
|
||||
|
||||
|
||||
def parse_parameters(param_str, tags_repo: TagsRepo) -> str:
|
||||
def parse_parameters(param_str:str, tags_repo: TagsRepo) -> str:
|
||||
"""
|
||||
Funkcja do parsowania zawartości pola 'parameters' z pliku PNG.
|
||||
"""
|
||||
@@ -207,11 +209,23 @@ def parse_parameters(param_str, tags_repo: TagsRepo) -> str:
|
||||
if not match:
|
||||
print(_("Nie można sparsować parametrów."))
|
||||
return ""
|
||||
tags = match.group("prompt")
|
||||
tags = match.group("prompt").removesuffix(",").replace("\n", " ").split(",")
|
||||
|
||||
if "pony" in match.group("model"):
|
||||
tags = [tag.strip() for tag in tags if not tag.strip().startswith("score_")]
|
||||
tags = tags[1:]
|
||||
tags = set([LORA_IN_PROMPT_PATTERN.sub("", tag) for tag in tags])
|
||||
if "lora_hashes" in match.groupdict() and match.group("lora_hashes"):
|
||||
lora_hashes = match.group("lora_hashes")
|
||||
for lora_match in LORAHASH_PATTERN.finditer(lora_hashes):
|
||||
lora_name = lora_match.group("name").strip()
|
||||
if lora_name:
|
||||
if lora_name=="ElfIL" and "e_lf":
|
||||
tags.discard("e_lf")
|
||||
tags.add("reanette_elfelt")
|
||||
elif lora_name=="Illustrious_Mikuneki_Style":
|
||||
tags.add("mikuneki")
|
||||
tags = set([WHITESPACE_PATTERN.sub("_", param.strip()) for param in tags])
|
||||
tags = set(
|
||||
[
|
||||
|
@@ -4,13 +4,13 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "kapitanbooru-uploader"
|
||||
version = "0.9.6"
|
||||
version = "0.9.7"
|
||||
description = "A GUI application for uploading images to KapitanBooru"
|
||||
authors = [{ name = "Michał Leśniak", email = "kapitan@mlesniak.pl" }]
|
||||
dependencies = [
|
||||
"networkx==3.4.2",
|
||||
"Pillow==11.1.0",
|
||||
"pywin32==309",
|
||||
"pywin32==309; sys_platform == 'win32'",
|
||||
"requests==2.32.3",
|
||||
"wdtagger==0.14.0",
|
||||
"bs4==0.0.2",
|
||||
|
@@ -1,7 +1,7 @@
|
||||
networkx==3.4.2
|
||||
Pillow==11.1.0
|
||||
pywin32==309; sys_platform == 'win32'
|
||||
Requests==2.32.3
|
||||
requests==2.32.3
|
||||
wdtagger==0.14.0
|
||||
bs4==0.0.2
|
||||
tomli==2.2.1
|
Reference in New Issue
Block a user