This commit is contained in:
2025-09-11 18:59:22 +02:00
parent 67a2055fc3
commit c52b2953d2
5 changed files with 49 additions and 9 deletions

View File

@@ -0,0 +1,22 @@
# Module header
import sys
if __name__ == "__main__":
sys.exit("This module is not intended to be executed as the main program.")
# Imports
from pathlib import Path
# Functions
def list_files(folder_path: str | Path) -> list[Path]:
"""
Vrátí seznam Path objektů všech souborů uvnitř složky (rekurzivně).
:param folder_path: cesta ke složce (string nebo Path)
:return: list objektů Path
"""
folder = Path(folder_path)
if not folder.is_dir():
raise NotADirectoryError(f"{folder} není platná složka.")
return [file_path for file_path in folder.rglob("*") if file_path.is_file()]

View File

@@ -1,6 +1,14 @@
# Module header
import sys
if __name__ == "__main__":
sys.exit("This module is not intended to be executed as the main program.")
# Imports
from PIL import Image, ImageTk
def load_icon(path):
# Functions
def load_icon(path) -> ImageTk.PhotoImage:
img = Image.open(path)
img = img.resize((16, 16), Image.Resampling.LANCZOS)
return ImageTk.PhotoImage(img)

View File

@@ -1,8 +1,16 @@
# Module header
import sys
if __name__ == "__main__":
sys.exit("This module is not intended to be executed as the main program.")
# Imports
import tkinter as tk
from tkinter import ttk
from src.core.image_handler import load_icon
def main():
# Functions
def main() -> None:
root = tk.Tk()
root.title("Ukázka rozložení")
root.geometry("800x600")
@@ -37,7 +45,7 @@ def main():
states = {}
# Funkce pro přepnutí checkboxu
def toggle(event):
def toggle(event) -> None:
region = tree.identify("region", event.x, event.y)
if region == "tree":
item_id = tree.identify_row(event.y)
@@ -99,7 +107,4 @@ def main():
tree.bind("<Button-3>", tree_right_click)
listbox.bind("<Button-3>", list_right_click)
root.mainloop()
if __name__ == "__main__":
main()
root.mainloop()