Ejemplo n.º 1
0
def validify():
    #test if the entries are valid
    #will connect to database soon
    e_name = name.get()
    e_pwd = pwd.get()
    e_type = ty.get()
    if (sl.validify_name(e_name)):
        if (sl.validify_password(e_name, e_pwd, e_type)):
            tkinter.messagebox.showinfo(parent=login,
                                        title='Login info',
                                        message='Succesful')
            name.delete(0, tk.END)
            pwd.delete(0, tk.END)
            mp.create(e_name, login)
        else:
            tkinter.messagebox.showwarning(parent=login,
                                           title='Login info',
                                           message='Invalid password')
            pwd.delete(0, tk.END)

    else:
        tkinter.messagebox.showwarning(
            parent=login,
            title='Login info',
            message='Username does not exist\nPlease register first!')
        name.delete(0, tk.END)
        pwd.delete(0, tk.END)
Ejemplo n.º 2
0
        def confirm_action():
            print("Accessing the user...")
            new_name = share_entry.get()
            if (sl.validify_name(new_name) == False):
                tm.showwarning(parent=share_box,
                               title='Warning',
                               message='The username does not exist!')
                reset_action()
                return
            else:
                curr_task = head.get(head.curselection())
                for row in c.execute(
                        "SELECT job FROM task WHERE username = ?;",
                    [new_name]):
                    print(row[0])
                    if row[0] == curr_task:
                        tm.showwarning(
                            parent=share_box,
                            title='Warning',
                            message='The other user already has the task!')
                        reset_action()
                        return

                f = c.execute(
                    "SELECT description, due, done FROM task WHERE username=? AND job=?;",
                    [name, curr_task])

                for row in f:

                    c.execute("INSERT INTO task VALUES (?,?,?,?,?)", [
                        new_name, curr_task,
                        "Shared by " + name + " : " + row[0], row[1], row[2]
                    ])

                for row in c.execute("SELECT * FROM task"):
                    print(row)

                print("Task shared with", new_name)
                conn.commit()
                reset_action()