From 7d632c3c9478ff19f99fc652a9f16833b32211f3 Mon Sep 17 00:00:00 2001 From: Luis Velasquez Date: Mon, 2 Dec 2024 12:47:17 -0500 Subject: [PATCH 1/5] Added the functionality to add a graduation year for each new user added --- ui.py | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/ui.py b/ui.py index e6393f6..ff38d84 100644 --- a/ui.py +++ b/ui.py @@ -381,7 +381,7 @@ def create_add_employee_screen(self): # Configuring the columns of the top child window top_frame.columnconfigure(0, weight=3) - top_frame.columnconfigure(1, weight=1) + top_frame.columnconfigure(1, weight=3) top_frame.columnconfigure(2, weight=3) # Configuring the rows of the top child window @@ -408,16 +408,26 @@ def create_add_employee_screen(self): # Textbox in which the student's PIN will be hosted pin_entry.insert(0, "PIN - (4 digits)") # Prepopulate with "PIN" - pin_entry.grid(row=1, column=0, sticky="nsew", pady=5) + pin_entry.grid(row=1, column=0, sticky="nsew", pady=5, padx=5) pin_entry.bind("", lambda clicked: pin_entry.delete(0, tk.END)) + # Textbox in which the student's graduation year will be hosted + grad_entry = ttk.Entry( + top_frame, + font=("Roboto", 20), + ) + + grad_entry.insert(0, "Grad Year - YYYY") # Prepopulate with "PIN" + grad_entry.grid(row=1, column=2, sticky="nsew", pady=5, padx=5) + grad_entry.bind("", lambda clicked: grad_entry.delete(0, tk.END)) + # Textbox in which the student's username will be hosted username_entry = ttk.Entry( top_frame, font=("Roboto", 20) ) username_entry.insert(0, "USERNAME") # Prepopulate with "Username" - username_entry.grid(row=1, column=2, sticky="nsew", pady=5) + username_entry.grid(row=1, column=1, sticky="nsew", pady=5, padx=5) username_entry.bind("", lambda clicked: username_entry.delete(0, tk.END)) # Creates the @@ -445,7 +455,7 @@ def create_add_employee_screen(self): relief="flat", bd=0, cursor="hand2", - command=lambda: self.add_employee_request(pin_entry.get(), username_entry.get()) + command=lambda: self.add_employee_request(pin_entry.get(), username_entry.get(), grad_entry.get()) ) add_button.grid(row=1, column=1, sticky="ew") @@ -742,7 +752,7 @@ def clock_out(self): # ----------------------------------------------------- # Admin methods -------------------------------------- - def add_employee_request(self, pin: str, username: str): + def add_employee_request(self, pin: str, username: str, grad_year: str): # Creates a list to store the active PINs in the database active_pins: list[str] = [] @@ -772,7 +782,18 @@ def add_employee_request(self, pin: str, username: str): messagebox.showwarning("USERNAME Error", f"Another user exists with the same USERNAME: {username}") return - self.current_user.access.add_user(pin, username, 0) + try: + grad_year_int = int(grad_year) + except ValueError: + messagebox.showwarning("Graduation Year Error", "Your Graduation year needs to be a number") + return + + if not grad_year_int: + messagebox.showwarning("Graduation Year Error", "Your Graduation year cannot be empty") + elif grad_year_int < datetime.today().year: + messagebox.showwarning("Graduation Year Error", f"Your Graduation year cannot be less than {datetime.today().year}") + + self.current_user.access.add_user(pin, username, 0, grad_year_int) messagebox.showinfo("User Addition", f"{username} Has been added to the database") self.show(self.add_employee_frame, "add_employee_frame", self.create_add_employee_screen) @@ -1018,9 +1039,9 @@ def log_out(self): self.pin.set("") self.show(self.log_in_frame, "log_in_frame", self.create_log_in_screen) - # Extra functions - def exit_fullscreen(self): - self.root.attributes("-fullscreen", False) + # # Extra functions + # def exit_fullscreen(self): + # self.root.attributes("-fullscreen", False) gui = GUI() From fc336dacbbb704429cd8232c15eac1be5a11d582 Mon Sep 17 00:00:00 2001 From: Luis Velasquez Date: Mon, 2 Dec 2024 13:05:39 -0500 Subject: [PATCH 2/5] Added so that the admin can see all the students' graduation years through the admin panels --- ui.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui.py b/ui.py index ff38d84..b3193c4 100644 --- a/ui.py +++ b/ui.py @@ -288,8 +288,8 @@ def create_admin_panel_screen(self): # ---------------------------------------------- # Set the columns and initializing the employees table --------------------------------------------- - columns: tuple[str, str, str, str, str, str] = ( - "Student ID", "Username", "Admin Status", "Start Time", "Working", "Total Minutes") + columns: tuple[str, str, str, str, str, str, str] = ( + "Student ID", "Username", "Admin Status", "Start Time", "Working", "Total Minutes", "Graduation Year") employees_table: ttk.Treeview = ttk.Treeview(self.admin_frame, columns=columns, show="headings") From e7093b284281d2dc0a08b4a0c6015939244e0c12 Mon Sep 17 00:00:00 2001 From: Luis Velasquez Date: Mon, 2 Dec 2024 13:24:14 -0500 Subject: [PATCH 3/5] There was an issue where even though you received a warning when you typed an invalid graduation year but still added the user to the database, now that has been fixed --- ui.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ui.py b/ui.py index b3193c4..258a5fd 100644 --- a/ui.py +++ b/ui.py @@ -792,6 +792,7 @@ def add_employee_request(self, pin: str, username: str, grad_year: str): messagebox.showwarning("Graduation Year Error", "Your Graduation year cannot be empty") elif grad_year_int < datetime.today().year: messagebox.showwarning("Graduation Year Error", f"Your Graduation year cannot be less than {datetime.today().year}") + return self.current_user.access.add_user(pin, username, 0, grad_year_int) messagebox.showinfo("User Addition", f"{username} Has been added to the database") From 765edf068277fc4a208f8f1d3d8ee119359e424c Mon Sep 17 00:00:00 2001 From: Jackson Date: Tue, 3 Dec 2024 12:56:21 -0500 Subject: [PATCH 4/5] deleted add_self method --- database.py | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/database.py b/database.py index e19fb8d..6cb4b1e 100644 --- a/database.py +++ b/database.py @@ -68,35 +68,6 @@ def create_table(self): conn.commit() - def add_self(self, username:str): - """ - allows any user to add themselves to the database - """ - conn = self.get_db() - cursor = conn.cursor() - if self.user_exists(): - raise ValueError("ERROR: user already exists") - # Add user into main table - cursor.execute(''' - INSERT INTO all_users (student_id, username, admin_status, start_time, working_status, total_minutes) - VALUES (?, ?, ?, NULL, 0, 0) - ''', (self.student_id, username, self.admin_status)) - # create table for user - cursor.execute(f''' - CREATE TABLE IF NOT EXISTS user_{self.student_id} ( - student_id TEXT, - date TEXT, - start_time TEXT, - end_time TEXT, - total_minutes INT, - CONSTRAINT FK_student_id FOREIGN KEY (student_id) - REFERENCES all_users(student_id) - ) - ''') - conn.commit() - cursor.close() - conn.close() - def add_user(self, student_id:str, username:str, admin_status:int, graduation_year: int): """ allows admin users to add users to the database From 2ea92f4aa59ae93624388afebb8dd0650f7fdd34 Mon Sep 17 00:00:00 2001 From: Luis Velasquez Date: Tue, 3 Dec 2024 13:06:18 -0500 Subject: [PATCH 5/5] Add: Build instructions --- .gitignore | 2 +- assets/punchcard.ico | Bin 0 -> 4286 bytes assets/windows_setup_image.ico | Bin 0 -> 4286 bytes build_instructions/EasyPunchCard.spec | 39 ++++++++++++ build_instructions/build.txt | 13 ++++ .../easypunchcard_setup_script.iss | 58 ++++++++++++++++++ 6 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 assets/punchcard.ico create mode 100644 assets/windows_setup_image.ico create mode 100644 build_instructions/EasyPunchCard.spec create mode 100644 build_instructions/build.txt create mode 100644 build_instructions/easypunchcard_setup_script.iss diff --git a/.gitignore b/.gitignore index 1d0ef65..47d1303 100644 --- a/.gitignore +++ b/.gitignore @@ -30,7 +30,7 @@ MANIFEST # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest -*.spec +#*.spec # Installer logs pip-log.txt diff --git a/assets/punchcard.ico b/assets/punchcard.ico new file mode 100644 index 0000000000000000000000000000000000000000..9ff00e85d80f6da5259a53df57d34d9ca1e169ce GIT binary patch literal 4286 zcmcgw`Bzit7Nu*wwQMUC&=#qJq9Ovd#eo7A8EgebrHWvoRR*;|5m1?tc?xrwLI?x` z2_X=sAcG2ufLgItai~*A+tt3|&)Dyr49ML8KL&dY=} zKMSP=*(fi{MMZHQDogSy3Q#32K((|G)ujtTpZOZc{5|>NnX*)Ra+_m!P&>x)>F7PQlk}%8MZ@ zD-zuJS>`QxFjH3*VBFfQNGaqtUIbE-y`^t&)JP*!gUW;tX^CEeiE`mR^$FIF2&zWm= zDdk=^k8k2Ie`G#Ir2T>>LKmsPVJzm@u%MBmwh~RXRYDimZ&8aJkt^4iDPP8954biG zPoG5Gw=uX7e+J13aY#xygY#!kBRTObQqIMTBY&56Apz-0=jfOyu4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