Skip to content
This repository was archived by the owner on Aug 16, 2025. It is now read-only.

Commit dedf3b4

Browse files
authored
Merge branch 'version-1.4.1' into main
2 parents 03841bc + e9a4c16 commit dedf3b4

File tree

63 files changed

+293
-33
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+293
-33
lines changed

GitHub Files/version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"latest": "1.4.0"
2+
"latest": "1.4.1"
33
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import customtkinter as ctk
2+
import webbrowser
3+
4+
5+
class CTkHyperlink(ctk.CTkLabel):
6+
color: str | tuple[str, str] = ("#0000EE", "#2fa8ff")
7+
hover_color: str | tuple[str, str] = ("#0000CC", "#58bbff")
8+
9+
def __init__(self, master, url: str, text: str | None = None, fg_color: str | tuple[str, str] = "transparent"):
10+
super().__init__(master, text=text or url, cursor="hand2", fg_color=fg_color, text_color=self.color)
11+
12+
self.bind("<Button-1>", lambda _: webbrowser.open_new_tab(url))
13+
self.bind("<Enter>", lambda _: self.configure(text_color=self.hover_color))
14+
self.bind("<Leave>", lambda _: self.configure(text_color=self.color))

modules/functions/interface/image.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
_image_cache: dict[str, CTkImage] = {}
1212

1313

14-
def load(light: str | Path, dark: str | Path | None = None, size: tuple[int, int] = (24,24)) -> CTkImage | Literal[""]:
14+
def load(light: str | Path, dark: str | Path | None = None, size: tuple[int, int] = (24,24), squared: bool = False) -> CTkImage | Literal[""]:
1515
light = Path(light)
1616
if dark is None:
1717
dark = light
@@ -33,8 +33,8 @@ def load(light: str | Path, dark: str | Path | None = None, size: tuple[int, int
3333
dark_image = Image.open(dark)
3434

3535
image: CTkImage = CTkImage(
36-
light_image=light_image,
37-
dark_image=dark_image,
36+
light_image=_squared(light_image) if squared else light_image,
37+
dark_image=_squared(dark_image) if squared else dark_image,
3838
size=size
3939
)
4040
_image_cache[key] = image
@@ -85,4 +85,18 @@ def load_from_image(pil_image: Image.Image, identifier: str, size: tuple[int, in
8585

8686
except Exception as e:
8787
Logger.error(f"Failed to load image from PIL.Image object! {type(e).__name__}: {str(e)}")
88-
return ""
88+
return ""
89+
90+
91+
# Generated by ChatGPT
92+
def _squared(image: Image.Image) -> Image.Image:
93+
width, height = image.size
94+
biggest = max(width, height)
95+
96+
new_image = Image.new("RGBA", (biggest, biggest), (255, 255, 255, 0))
97+
98+
paste_x = (biggest - width) // 2
99+
paste_y = (biggest - height) // 2
100+
new_image.paste(image, (paste_x, paste_y))
101+
102+
return new_image

modules/info.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ class ProjectData:
33
DESCRIPTION: str = "A Python tool made for Roblox mod developers"
44
AUTHOR: str = "TheKliko"
55
REPOSITORY: str = r"https://github.com/TheKliko/klikos-modding-tool"
6-
VERSION: str = "1.4.0"
6+
VERSION: str = "1.4.1"
77

88
class Help:
99
DISCORD: str = r"https://discord.gg/nEjUwdSP9P"
@@ -88,4 +88,4 @@ class Help:
8888
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
8989
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE."""
9090
}
91-
]
91+
]

modules/menu/sections/mod_generator.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import re
33
from tkinter import messagebox
44
from threading import Thread
5-
import webbrowser
65
from tkinter import filedialog
76
from typing import Literal
87
import uuid
@@ -12,6 +11,7 @@
1211
from modules import filesystem
1312
from modules.filesystem import Directory, restore_from_meipass
1413
from modules.functions.interface.image import load as load_image, load_from_image
14+
from modules.functions.interface.CTkHyperlink import CTkHyperlink
1515
from modules.config import settings
1616
from modules import mod_generator
1717
from modules.mod_generator.get_mask import get_mask
@@ -149,13 +149,9 @@ def _load_content(self) -> None:
149149
possible_colors_frame.grid(column=0, row=3, sticky="w", pady=(4, 0))
150150
ctk.CTkLabel(possible_colors_frame, text="A list of available color formats can be found at ").grid(column=0, row=0)
151151
url: str = r"https://pillow.readthedocs.io/en/stable/reference/ImageColor.html#color-names"
152-
unhover_color: str | tuple[str ,str] = ("#0000EE", "#2fa8ff")
153-
hover_color: str | tuple[str ,str] = ("#0000CC", "#58bbff")
154-
hyperlink: ctk.CTkLabel = ctk.CTkLabel(possible_colors_frame, text=url, cursor="hand2", text_color=unhover_color)
155-
hyperlink.bind("<Button-1>", lambda _: self._open_in_browser(url))
152+
153+
hyperlink: CTkHyperlink = CTkHyperlink(possible_colors_frame, url)
156154
hyperlink.grid(column=1, row=0)
157-
hyperlink.bind("<Enter>", lambda _: hyperlink.configure(text_color=hover_color))
158-
hyperlink.bind("<Leave>", lambda _: hyperlink.configure(text_color=unhover_color))
159155

160156
# Color Preview
161157
preview_frame: ctk.CTkFrame = ctk.CTkFrame(container, fg_color="transparent")
@@ -347,10 +343,6 @@ def _load_user_selected_files(self) -> None:
347343
self.user_selected_files_container.grid(column=0, row=3, sticky="nsew", pady=(8, 0))
348344

349345

350-
def _open_in_browser(self, url: str) -> None:
351-
webbrowser.open_new_tab(url)
352-
353-
354346
def _generate_preview(self, default: bool = False) -> None:
355347
if default:
356348
self.default_image: Image.Image = get_mask(ImageColor.getcolor("black", "RGBA"), None, 0, size=(self.Constants.PREVIEW_SIZE, self.Constants.PREVIEW_SIZE))
183 Bytes
517 Bytes
1.08 KB
1.59 KB
435 Bytes

0 commit comments

Comments
 (0)