def dis_card(): naam = UseDatabase.deactiveer_cid(python_code_for_reading_uid.readArduino()) if naam: UseDatabase.deactiveer_uid(string_int(entryDisableID.get())) popup("%s is gedeactiveerd" % naam) else: popup("Gebruiker ID bestaat niet of is al gedeactiveerd")
def get_history_cid(): var0 = (python_code_for_reading_uid.readArduino()) data = (UseDatabase.searchhistory_cid(var0)) global lbname global lbcid global lbtime global lbtid top = Toplevel() top.title("Resultaten") top.focus_set() top.resizable(0, 0) lbname = Listbox(top, height=50) lbcid = Listbox(top, height=50) lbtime = Listbox(top, height=50) lbtid = Listbox(top, height=50) lbname.bind("<MouseWheel>", scroll) lbcid.bind("<MouseWheel>", scroll) lbtime.bind("<MouseWheel>", scroll) lbtid.bind("<MouseWheel>", scroll) if data: lbname.insert(END, "Naam:") lbcid.insert(END, "Card ID:") lbtime.insert(END, "Datum:") lbtid.insert(END, "Deur:") for x in range(0, len(data)): lbname.insert(END, data[x][0]) lbcid.insert(END, data[x][1]) lbtime.insert(END, data[x][2]) lbtid.insert(END, data[x][3]) else: lbname.insert(END, "Geen Data") lbname.grid(column=1, row=1) lbcid.grid(column=3, row=1) lbtime.grid(column=4, row=1) lbtid.grid(column=2, row=1)
def add_user(): var2, var3 = entryName2.get(), entryRights2.get() if var2 and var3: var1 = (python_code_for_reading_uid.readArduino()) var4 = UseDatabase.add(var1, var2, var3) if var4: tid = var4[1] if var3 == 'Gast': popup("%s toegevoegd, het kamernummer is %i" % (var2, tid-3)) else: popup("%s toegevoegd" % var2) else: popup("Geen kamer vrij") else: tkinter.messagebox.showerror("Geen invoer", "Er moet wat worden ingevoerd")
def search_cid_gui(): var1 = (python_code_for_reading_uid.readArduino()) data = UseDatabase.search_cid(string_int(var1)) global lbname global lbrights global lbcid global lbuid global lbacess top = Toplevel() top.title("Resultaten") top.focus_set() top.resizable(0, 0) lbname = Listbox(top, height=50) lbrights = Listbox(top, height=50) lbcid = Listbox(top, height=50) lbuid = Listbox(top, height=50) lbaccess = Listbox(top, height=50) lbname.bind("<MouseWheel>", scroll2) lbrights.bind("<MouseWheel>", scroll2) lbcid.bind("<MouseWheel>", scroll2) lbuid.bind("<MouseWheel>", scroll2) lbaccess.bind("<MouseWheel>", scroll2) if data: lbname.insert(END, "Naam:") lbrights.insert(END, "Rechten:") lbcid.insert(END, "Pasjes ID:") lbuid.insert(END, "Gebruiker ID:") lbaccess.insert(END, "Kaart staat:") for x in range(0, len(data)): lbname.insert(END, data[x][2]) if data[x][3] == 1: lbrights.insert(END, "Gast") elif data[x][3] == 2: lbrights.insert(END, "Schoonmaker") elif data[x][3] == 3: lbrights.insert(END, "Beveiliging") elif data[x][3] == 4: lbrights.insert(END, "Eigenaar") lbcid.insert(END, data[x][1]) lbuid.insert(END, data[x][0]) lbaccess.insert(END, data[x][4]) else: lbname.insert(END, "Geen Data") lbname.grid(column=1, row=1) lbrights.grid(column=2, row=1) lbcid.grid(column=3, row=1) lbuid.grid(column=4, row=1) lbaccess.grid(column=5, row=1)
def door7Func(): doorO = PhotoImage(file="door_4_open.png") doorC = PhotoImage(file="door_4_closed.png") global ddoor7 if firestate: print("This door is open") else: if ddoor7 == False: cid = python_code_for_reading_uid.readArduino() var = UseDatabase.check(cid, 7) if var == True: door7.configure(image=doorO) door7.image = doorO ddoor7 = True else: tkinter.messagebox.showerror("Geen toegang", "U bent niet bevoegd om deze deur te openen") else: door7.configure(image=doorC) door7.image = doorC ddoor7 = False