made todo section look way nicer and fixed some stuff up!

This commit is contained in:
2025-09-13 20:05:19 +02:00
parent 5b51c67069
commit 22f0798f81
2 changed files with 148 additions and 22 deletions

View File

@@ -1,6 +1,6 @@
# @ImportStructure ; ref@todo/main.py , Element 3 # @ImportStructure ; ref@todo/main.py , Element 3
import tkinter as tk import tkinter as tk
from tkinter import ttk, messagebox, filedialog from tkinter import ttk, messagebox, filedialog, font
import webbrowser import webbrowser
import json import json
from PIL import Image, ImageTk from PIL import Image, ImageTk
@@ -531,7 +531,7 @@ class PfandCalculator:
close_button.grid(row=2, column=1, padx=10, pady=10, sticky="ew") close_button.grid(row=2, column=1, padx=10, pady=10, sticky="ew")
todo_button = ( todo_button = (
tk.Button( # Looks like fucking shit , fix this horsecrap in the future tk.Button( # fixed this in commit 5b51c670694ba813a56880eabbdb8a8f6446fa7c
about_window, text="Load Todo", command=self.create_todo_list about_window, text="Load Todo", command=self.create_todo_list
) )
) )
@@ -540,31 +540,147 @@ class PfandCalculator:
# ref@todo/main.py # ref@todo/main.py
def create_todo_list(self): def create_todo_list(self):
#try:
# import tkFont
#except ImportError as e:
# print(f"error as -> {e}")
todo = tk.Toplevel(self.root) todo = tk.Toplevel(self.root)
todo.title("Todo Liste") todo.title("Todo Liste")
todo.resizable(True, True) todo.resizable(True, True)
segoeui = font.Font(family="Segoe UI",size=11,weight="normal")
monaco = font.Font(family="Monaco", size=9, slant="italic")
seperator = ttk.Separator(todo, orient="horizontal")
seperator2 = ttk.Separator(todo, orient="horizontal")
for col in range(2): for col in range(2):
todo.grid_columnconfigure(col, weight=1) todo.grid_columnconfigure(col, weight=1)
todo.grid_rowconfigure(0, weight=0) todo.grid_rowconfigure(0, weight=0)
def close_todo():
todo.destroy()
# Function to get done Todo Elements
# tuple[0] total, [1] done. [2] precent for pbar
def return_elements(todo_string : str) -> tuple[int, int, int]:
total = todo_string.count("[ ]") + todo_string.count("[x]")
done = todo_string.count("[x]")
percent_done = (done / total) * 100 if total > 0 else 0
return total, done, percent_done
progress_bar = ttk.Progressbar(todo, value=return_elements(todo_instance.load_todo())[2], style='Striped.Horizontal.TProgressbar')
# Shit will display here that is going to be loaded from external # Shit will display here that is going to be loaded from external
label_todo = tk.Label( label_todo = tk.Label( todo,
todo,
text=todo_instance.load_todo(), text=todo_instance.load_todo(),
#font="Segoe UI", font=segoeui,
padx=10, padx=10,
pady=10, pady=10,
justify="left", justify="left",
anchor="center", anchor="center",
) )
label_todo.grid(row=1, column=0, columnspan=2, pady=0, sticky="nsew")
label_todo_changelog = tk.Label( todo,
text=todo_instance.load_changelog(),
font=segoeui,
padx=10,
pady=10,
justify="left",
anchor="center"
)
label_todo_tldr = tk.Label( todo,
text=todo_instance.load_tldr(),
font=segoeui,
padx=10,
pady=10,
anchor="center",
justify="left"
)
percent = return_elements(todo_instance.load_todo())[2]
percent = round(percent, 2)
label_todo_percentage_bar_text = tk.Label(
todo,
text=f"{percent}% Done (For Todo)",
font=monaco,
justify="right",
anchor="w",
padx=10,
pady=0
)
label_todo_close = tk.Button( todo,
text="Schließen",
command=close_todo,
font=segoeui,
padx=10,
pady=10,
)
# setup grid
label_todo_tldr.grid(
row=1,
column=0,
columnspan=2,
padx=0,
pady=5,
sticky="nsew"
)
seperator.grid(
row=2,
column=0,
columnspan=2,
pady=5,
sticky="ew"
)
label_todo.grid(
row=3,
column=0,
columnspan=2,
pady=5,
sticky="nsew"
)
seperator2.grid(
row=4,
column=0,
columnspan=2,
pady=5,
sticky="ew"
)
label_todo_changelog.grid(
row=5,
column=0,
columnspan=2,
pady=5,
sticky="nsew"
)
label_todo_percentage_bar_text.grid(
row=6,
column=0,
columnspan=2,
sticky="ew"
)
progress_bar.grid(
row=7,
column=0,
columnspan=2,
pady=5,
sticky="ew"
)
label_todo_close.grid(
row=8,
column=0,
columnspan=2,
pady=5,
sticky="nsew"
)
# TGTG Credits # TGTG Credits
def TGTG_credits(self): def TGTG_credits(self):
@@ -2111,4 +2227,4 @@ class PfandCalculator:
if __name__ == "__main__": if __name__ == "__main__":
PfandCalculator.launch(True) PfandCalculator.launch(False)

View File

@@ -6,22 +6,32 @@ class todo:
# ------------------------------------------------------------------------------------------------------------------# # ------------------------------------------------------------------------------------------------------------------#
self.todo: str = """ self.todo: str = """
TODO: TODO:
[] main.py@GENERAL - refactor to make the ChatGPT Code actually readable. [ ] main.py@GENERAL - refactor to make the ChatGPT Code actually readable.
[] main.py@TODO - Refactor and make it look nicer! PRIO: HIGH [x] main.py@TODO - Refactor and make it look nicer! PRIO: HIGH
[] @Project_Structure - Fix this shit [ ] @Project_Structure - Fix this shit
- Isnt too bad , we can work with the structure. - Isnt too bad , we can work with the structure.
[x] @ImportStructure - Fix the Import structure, it currently looks like ass. At least the local ImportStructure.
- @LocalImportStructure => Fix by end of next week. (KW25)
""" """
# ------------------------------------------------------------------------------------------------------------------# # ------------------------------------------------------------------------------------------------------------------#
self.archived_todo: str = """ self.archived_todo: str = """
archived_todo list: archived_todo list:
[X] main.py@433 - {FINISHED: 12.JUN.25@21:20} - fix this to actually load the Todo List cause currently its dumb as fuck. [X] main.py@433 - {FINISHED: 12.JUN.25@21:20} - fix this to actually load the Todo List cause currently its dumb as fuck.
- Do this tmrw 11.JUN.25! easy task. at least it should be. - Do this tmrw 11.JUN.25! easy task. at least it should be.
[X] @ImportStructure - {FINISHED: 13.SEP.25@18:47} - Fix the Import structure, it currently looks like ass. At least the local ImportStructure.
- @LocalImportStructure => Fix by end of next week. (KW25)
""" """
# ------------------------------------------------------------------------------------------------------------------# # ------------------------------------------------------------------------------------------------------------------#
self.changelog: str = """ self.changelog: str = """
Changelog: Changelog:
13.SEP.25@18:49 => Fixed µScan.
- Fixed the UI, made it look better and made the Scanner run better.
- Mainly OpenCV as a C extern
- Tkinter pulls it together.
- Its Threaded, so it runs better.
Fixed Todo Widget to look better. You can see @main:PfandCalculator/create_todo_list()
- Now has a progressbar which counts the elements in the Todo variable, if you check one off [x]. then it counts as finished and the
progressbar advances! main.py@PfandCalculator/create_todo_list/return_elements(str) -> tuple[int, int, int]
Third returned Element being The percent out of 100, which is done.
12.JUN.25@21:23 => Changed the Todo List to be much more readable. 12.JUN.25@21:23 => Changed the Todo List to be much more readable.
12.JUN.25@21:20 => Fixed Todo List Load Bug. Now loads properly. It was a import issue. 12.JUN.25@21:20 => Fixed Todo List Load Bug. Now loads properly. It was a import issue.
""" """
@@ -33,8 +43,8 @@ Quick TLDR:
This is refering to the todo list with element of X This is refering to the todo list with element of X
This can be for other things too, such as other Methods in Classes. This can be for other things too, such as other Methods in Classes.
example: ref@tgtg_orderchecker/main.py@12:32 example: ref@tgtg_orderchecker/main.py@method/class/variable
This is refering to the tgtg oc at main 12:32. This is refering to some object.
if you see any "@" , you are probably seeing a reference to the todo list. if you see any "@" , you are probably seeing a reference to the todo list.
for example element 3 in todo (@LocalImportStructure) for example element 3 in todo (@LocalImportStructure)