def log_into_account(studentID: str): studentID = str(studentID) student = find_student_by_studentID(studentID) if not student: message = f"No student with ID {studentID}" return message, False SignedIn = student.Is_signedIn if SignedIn == False: message = f"Hello {student.name}, you are cleared to use:\n" for number in student.keys_trained: tool = Key.objects(keyNumber=number).first() addition = tool.name message = message + '-> ' + addition + '\n' if not student.capstoneID: day_login(studentID) student.event() return message, False else: day_login_Capstone(studentID) student.event() message2 = get_group_info(student.capstoneID) message = message + message2 return message, False if SignedIn == True: message = f" Goodbye {student.name} " day_logout(studentID) student.event() return message, True
def CreateMachineKey(keyNumber: int, name: str): tool = Key() tool.name = name tool.keyNumber = keyNumber tool.save() return tool.keyNumber
def Onclick(): if self.button["bg"] == color: self.button["bg"] = "grey86" key = Key.objects(keyNumber=number).first() result = checkout_Machine_Key(key.keyNumber, root) else: self.button["bg"] = color pop = Toplevel() pop.geometry("300x140") pop.minsize(320, 140) Label(pop, text='Key Successfully Returned\n' 'Please Ensure Machine is Clean', font='Arial 14 bold', fg='MediumPurple3').pack() Button(pop, text='Accept', font='Helvetica 16 bold', fg='green', command=pop.destroy).pack()
def update_keyslist(): Key.objects.delete() for n in RM130_keys: print(str(n) + ': ' + RM130_keys[n]) key = Key() key.name = RM130_keys[n] key.keyNumber = n key.RoomNumber = '130' key.save() for n in RM131_keys: print(str(n) + ': ' + RM131_keys[n]) key = Key() key.name = RM131_keys[n] key.keyNumber = n key.RoomNumber = '131' key.save() for n in RM132_keys: print(str(n) + ': ' + RM132_keys[n]) key = Key() key.name = RM132_keys[n] key.keyNumber = n key.RoomNumber = '132' key.save()
def key_exists(number): if Key.objects(keyNumber=number): return True else: return False
def Onclick(): tool = Key.objects(keyNumber=number).first() checkout_tool(tool.keyNumber)