From 22f0798f81b48d77557357c93db8a58f8dffb665 Mon Sep 17 00:00:00 2001 From: rattatwinko Date: Sat, 13 Sep 2025 20:05:19 +0200 Subject: [PATCH] made todo section look way nicer and fixed some stuff up! --- PfandApplication/main.py | 142 ++++++++++++++++++++++++++++++---- PfandApplication/todo/main.py | 28 ++++--- 2 files changed, 148 insertions(+), 22 deletions(-) diff --git a/PfandApplication/main.py b/PfandApplication/main.py index 7c5991c..d162c82 100644 --- a/PfandApplication/main.py +++ b/PfandApplication/main.py @@ -1,6 +1,6 @@ # @ImportStructure ; ref@todo/main.py , Element 3 import tkinter as tk -from tkinter import ttk, messagebox, filedialog +from tkinter import ttk, messagebox, filedialog, font import webbrowser import json from PIL import Image, ImageTk @@ -531,7 +531,7 @@ class PfandCalculator: close_button.grid(row=2, column=1, padx=10, pady=10, sticky="ew") 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 ) ) @@ -540,31 +540,147 @@ class PfandCalculator: # ref@todo/main.py def create_todo_list(self): - #try: - # import tkFont - #except ImportError as e: - # print(f"error as -> {e}") - - todo = tk.Toplevel(self.root) todo.title("Todo Liste") 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): todo.grid_columnconfigure(col, weight=1) 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 - label_todo = tk.Label( - todo, + label_todo = tk.Label( todo, text=todo_instance.load_todo(), - #font="Segoe UI", + font=segoeui, padx=10, pady=10, justify="left", 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 def TGTG_credits(self): @@ -2111,4 +2227,4 @@ class PfandCalculator: if __name__ == "__main__": - PfandCalculator.launch(True) + PfandCalculator.launch(False) diff --git a/PfandApplication/todo/main.py b/PfandApplication/todo/main.py index c00ac72..745a3ab 100644 --- a/PfandApplication/todo/main.py +++ b/PfandApplication/todo/main.py @@ -6,22 +6,32 @@ class todo: # ------------------------------------------------------------------------------------------------------------------# self.todo: str = """ TODO: - [] main.py@GENERAL - refactor to make the ChatGPT Code actually readable. - [] main.py@TODO - Refactor and make it look nicer! PRIO: HIGH - [] @Project_Structure - Fix this shit + [ ] main.py@GENERAL - refactor to make the ChatGPT Code actually readable. + [x] main.py@TODO - Refactor and make it look nicer! PRIO: HIGH + [ ] @Project_Structure - Fix this shit - 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 = """ 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. - - Do this tmrw 11.JUN.25! easy task. at least it should be. + [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. + [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 = """ 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: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 can be for other things too, such as other Methods in Classes. - example: ref@tgtg_orderchecker/main.py@12:32 - This is refering to the tgtg oc at main 12:32. + example: ref@tgtg_orderchecker/main.py@method/class/variable + This is refering to some object. if you see any "@" , you are probably seeing a reference to the todo list. for example element 3 in todo (@LocalImportStructure)