WIP
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,2 +1,2 @@
|
||||
.venv
|
||||
**/__pycache__
|
||||
__pycache__
|
||||
@@ -1,6 +1,11 @@
|
||||
# Imports
|
||||
import tkinter as tk
|
||||
from tkinter import ttk
|
||||
|
||||
from src.gui.gui import main
|
||||
from src.core.file_handler import list_files
|
||||
|
||||
main()
|
||||
# Functions
|
||||
main()
|
||||
a = list_files("./src/core")
|
||||
print(a)
|
||||
@@ -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()]
|
||||
@@ -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)
|
||||
@@ -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()
|
||||
Reference in New Issue
Block a user