def Login(): backend.connect() global nameEL global pwordEL global rootA rootA =Tk() rootA.title('Login') instruction = Label(rootA,text='Please login: '******'Username: '******'Passwrod: ') nameL.grid(row=1,column=0,sticky=W) pwordL.grid(row=2,column=0,sticky=W) nameEL=Entry(rootA) pwordEL=Entry(rootA,show='*') nameEL.grid(row=1,column=1) pwordEL.grid(row=2,column=1) loginB=Button(rootA,text='Login',command=Checklogin) loginB.grid(row=3,column=0,sticky=W) SignupB=Button(rootA,text='Signup',command=Signup) SignupB.grid(row=3,column=2,sticky=W) rootA.mainloop()
def action_connect(self): global backend host = str(self.ip.displayText().replace(' ','')) port = int(self.port.displayText().replace(' ','')) if not host or not port: self.info("Error", "Invalid values") return result = backend.connect(host,port) if not result['success']: self.info("Error Connecting", result['message']) return self.set_connection_status(True) self.console.append("Connected to %s on port %s" % (host, port)) self.get_timer.start() self.sender.start() self.receive.start()
def get_user(): """ When the user clicks on the Log In button in the Log In Page this function takes the username and the password he/she typed and the os path of his/her chosen certificate. Calls the login() function in the backend.py script, in order to check if the typed username and password are correct and if the chosen certificate has been issued by the Password Manager Application. If these are correct then the user can access his/her account. If not, he/she has 9 tries more to log in with time delay, else the Application will close. Also,the user is being informed about the errors and the remaining tries to login. Finally, the user will be informed if his/her account is safe or his/her saved passwords has been unauthorized changed :return: None """ global tries, delay uName = uNameEL.get() usPswd = pwdEL.get() try: cert_path = filename status = backend.login(uName, usPswd, cert_path) if status != 1 and tries > 0: answer = backend.connect(uName) if answer == 1: showwarning("WARNING", "Non authorized password modification!!") elif answer == 0: showinfo("Password Integrity", "Everything seems to be as you left!") enter_app() elif tries == 0: showwarning("Login", "Can't authenticate!\nClosing application!") rootA.destroy() else: tries -= 1 showwarning( "Login", "Can't login! Tries left " + str(tries) + "\nDelaying your entry..") time.sleep(delay) delay += 5 except NameError: showinfo("Login", "Load your certificate!")
""" A bolt termékeit itt lehet megadni """ from tkinter import * import backend backend.connect() def get_selected_row(event): global selected_tuple index=list1.curselection()[0] selected_tuple=list1.get(index) e1.delete(0,END) e1.insert(END,selected_tuple[1]) e2.delete(0,END) e2.insert(END,selected_tuple[2]) def add_new(): backend.insert(nev_text.get(),ar_text.get()) list1.delete(0, END) for row in backend.all_products(): list1.insert(END, row) def delete(): backend.torles(selected_tuple[0]) list1.delete(0, END)
def open_database(env): return backend.connect(env)
def main(): backend.connect() frontend.create_ui()
def dbWindow(file): global nameEntry, quantityEntry, purchaseDateEntry, sellPriceEntry global itemsList, purchaseDateEntryBox, nameEntryBox, sellPriceEntryBox, quantityEntryBox bk.connect(file) window = Tk() window.wm_title(file) nameLabel = Label(window, text="Name") nameLabel.grid(row=0, column=0) nameEntry = StringVar() nameEntryBox = Entry(window, textvariable=nameEntry) nameEntryBox.grid(row=0, column=1, padx=10, pady=10) quantityLabel = Label(window, text="Quantity") quantityLabel.grid(row=1, column=0) quantityEntry = StringVar() quantityEntryBox = Entry(window, textvariable=quantityEntry) quantityEntryBox.grid(row=1, column=1) purchaseDateLabel = Label(window, text="Purchase Date") purchaseDateLabel.grid(row=0, column=2) purchaseDateEntry = StringVar() purchaseDateEntryBox = Entry(window, textvariable=purchaseDateEntry) purchaseDateEntryBox.grid(row=0, column=3) sellPriceLabel = Label(window, text="Sell Price") sellPriceLabel.grid(row=1, column=2) sellPriceEntry = StringVar() sellPriceEntryBox = Entry(window, textvariable=sellPriceEntry) sellPriceEntryBox.grid(row=1, column=3) itemsList = Listbox(window, height=6, width=36) itemsList.grid(row=2, column=0, rowspan=6, columnspan=2) listScroller = Scrollbar(window) listScroller.grid(row=2, column=2, rowspan=6) itemsList.configure(yscrollcommand=listScroller.set) listScroller.configure(command=itemsList.yview) itemsList.bind('<<ListboxSelect>>', getSelection) allEntries() searchButton = Button(window, text="Search", width="12", command=search_Button) searchButton.grid(row=2, column=3, padx=10, pady=5) addButton = Button(window, text="Add", width=12, command=add_button) addButton.grid(row=3, column=3, padx=10, pady=5) updateButton = Button(window, text="Update", width="12", command=update_button) updateButton.grid(row=4, column=3, padx=10, pady=5) deleteButton = Button(window, text="Delete", width="12", command=delete_Button) deleteButton.grid(row=5, column=3, padx=10, pady=5) clearButton = Button(window, text="Clear", width="12", command=clear_Button) clearButton.grid(row=6, column=3, padx=10, pady=5) closeButton = Button(window, text="Close", width="12", command=window.destroy) closeButton.grid(row=7, column=3, padx=10, pady=5) window.mainloop()