Beispiel #1
0
def get_selected_notes(title):
    p = get_db_path()
    if p is not None:
        con = connect(p)
        cur = con.cursor()
        cur.execute("""SELECT notes FROM msd_notes WHERE title=:title""", {'title': encrypt_value(title.strip())})
        all_notes = cur.fetchone()
        cur.close()
        con.close()
        return decrypt_value(all_notes[0])
    else:
        showerror("Error", "Error while retreiving notes")
Beispiel #2
0
def read_appointment_title_from_db(name):
    p = get_db_path()
    if p is not None:
        con = connect(p)
        cur = con.cursor()
        cur.execute("""SELECT name FROM msd_appointments WHERE name=:name""", {'name': encrypt_value(name)})
        got_name = cur.fetchone()
        cur.close()
        con.close()
        if got_name == None:
            return None
        else:
            return decrypt_value(got_name[0])
Beispiel #3
0
def get_selected_passwords(web_desc):
    p = get_db_path()
    if p is not None:
        con = connect(p)
        cur = con.cursor()
        cur.execute("""SELECT * FROM msd_passwords WHERE web_desc=:name""", {'name': encrypt_value(web_desc)})
        got_data = cur.fetchone()
        cur.close()
        con.close()
        if got_data == None:
            return None
        else:
            return decrypt_value(got_data[0]), decrypt_value(got_data[1]), decrypt_value(got_data[2])
Beispiel #4
0
def read_password_desc_from_db(web_desc):
    p = get_db_path()
    if p is not None:
        con = connect(p)
        cur = con.cursor()
        cur.execute("""SELECT web_desc FROM msd_passwords WHERE web_desc=:web_desc""", {'web_desc': encrypt_value(web_desc)})
        got_web_desc = cur.fetchone()
        cur.close()
        con.close()    
        if got_web_desc == None:
            return None
        else:
            return decrypt_value(got_web_desc[0])
Beispiel #5
0
def get_selected_appointments(name):
    p = get_db_path()
    if p is not None:
        con = connect(p)
        cur = con.cursor()
        cur.execute("""SELECT * FROM msd_appointments WHERE name=:name""", {'name': encrypt_value(name)})
        got_name = cur.fetchone()
        cur.close()
        con.close()
        if got_name == None:
            return None
        else:
            return decrypt_value(got_name[0]), decrypt_value(got_name[3]), decrypt_value(got_name[1]), decrypt_value(got_name[4]), decrypt_value(got_name[2])
Beispiel #6
0
def read_passwords_from_db():
    p = get_db_path()
    if p is not None:
        con = connect(p)
        cur = con.cursor()
        cur.execute("SELECT * FROM msd_passwords")
        all_passwords = cur.fetchall()
        i = 0
        for row in all_passwords:
            tab_3_treeview.insert(parent='', index='end', iid=i, text=decrypt_value(row[0]), values=(decrypt_value(row[1]), decrypt_value(row[2])))
            i += 1
        tab_3_treeview.pack()
        cur.close()
        con.close()
Beispiel #7
0
def create_tables():
    p = get_db_path()
    if p is not None:
        con = connect(p)
        cur = con.cursor()
        cur.execute("CREATE TABLE IF NOT EXISTS msd_notes (title TEXT, date TEXT, time TEXT, notes  TEXT)")
        cur.execute("CREATE TABLE IF NOT EXISTS msd_appointments (name TEXT, date TEXT, time TEXT, description TEXT, status TEXT)")
        cur.execute("CREATE TABLE IF NOT EXISTS msd_passwords (web_desc TEXT, username TEXT, password TEXT)")
        cur.execute("CREATE TABLE IF NOT EXISTS msd_login (password TEXT)")
        cur.close()
        con.close()
    else:
        showerror("Error", "Error while creating the tables")
        root.destroy()
        exit()
Beispiel #8
0
def read_notes_only_from_db(title):
    p = get_db_path()
    if p is not None:
        con = connect(p)
        cur = con.cursor()
        cur.execute("""SELECT title FROM msd_notes WHERE title=:title""", {'title': encrypt_value(title)})
        got_title = cur.fetchone()
        cur.close()
        con.close()
        if got_title == None:
            return None
        else:
            return decrypt_value(got_title[0])
    else:
        showerror("Error", "Error while retreiving notes")
Beispiel #9
0
def delete_password():
    global tab_3_button_message
    if tab_3_treeview.focus() == '':
        tab_3_button_message.set("Please select a password")
    else:
        p = get_db_path()
        if p is not None:
            tab_3_button_message.set("")
            delete_password = tab_3_treeview.item(tab_3_treeview.focus())['text'].strip()
            con = connect(p)
            cur = con.cursor()
            cur.execute("""DELETE FROM msd_passwords WHERE web_desc=:name""", {'name': encrypt_value(delete_password)})
            con.commit()
            cur.close()
            con.close()
            update_tab_3_treeview()
Beispiel #10
0
def update_password(web_desc, username, password):
    p = get_db_path()
    if p is not None:
        add_passwords_button["state"] = "normal"
        open_passwords_button["state"] = "normal"
        delete_passwords_button["state"] = "normal"
        tabs_window.tab(0, state="normal")
        tabs_window.tab(1, state="normal")
        con = connect(p)
        cur = con.cursor()
        cur.execute("""UPDATE msd_passwords SET username=:username, password=:password WHERE web_desc=:web_desc""", {'web_desc': encrypt_value(web_desc), 'username': encrypt_value(username), 'password': encrypt_value(password)})
        con.commit()
        cur.close()
        con.close()
        update_tab_3_treeview()
        window.destroy()
Beispiel #11
0
def create_login(user_pass):
    p = get_db_path()
    if p is not None:
        con = connect(p)
        cur = con.cursor()
        cur.execute("INSERT INTO msd_login (password) VALUES (?)", (encrypt_value(user_pass), ))
        con.commit()
        cur.close()
        con.close()
        showinfo("Thank you!", "Please login again")
        root.destroy()
        exit()
    else:
        showerror("Error", "Error while creating login")
        root.destroy()
        exit()
Beispiel #12
0
def delete_notes():
    global tab_1_button_message
    if tab_1_treeview.focus() == '':
        tab_1_button_message.set("Please select a notes")
    else:
        p = get_db_path()
        if p is not None:
            tab_1_button_message.set("")
            delete_title = tab_1_treeview.item(tab_1_treeview.focus())['text'].strip()
            con = connect(p)
            cur = con.cursor()
            cur.execute("""DELETE FROM msd_notes WHERE title=:title""", {'title': encrypt_value(delete_title)})
            con.commit()
            cur.close()
            con.close()
            update_tab_1_treeview()
Beispiel #13
0
def delete_appointment():
    global tab_2_button_message
    if tab_2_treeview.focus() == '':
        tab_2_button_message.set("Please select an appointment")
    else:
        p = get_db_path()
        if p is not None:
            tab_2_button_message.set("")
            delete_name = tab_2_treeview.item(tab_2_treeview.focus())['text'].strip()
            con = connect(p)
            cur = con.cursor()
            cur.execute("""DELETE FROM msd_appointments WHERE name=:name""", {'name': encrypt_value(delete_name)})
            con.commit()
            cur.close()
            con.close()
            update_tab_2_treeview()
Beispiel #14
0
def update_appointment(name, new_date, description, new_time, status):
    p = get_db_path()
    if p is not None:
        add_appointments_button["state"] = "normal"
        open_appointments_button["state"] = "normal"
        delete_appointments_button["state"] = "normal"
        tabs_window.tab(0, state="normal")
        tabs_window.tab(2, state="normal")
        con = connect(p)
        cur = con.cursor()
        cur.execute("""UPDATE msd_appointments SET date=:new_date, time=:new_time, description=:description, status=:status WHERE name=:name""", {'name': encrypt_value(name), 'new_date': encrypt_value(new_date), 'new_time': encrypt_value(new_time), 'description': encrypt_value(description), 'status': encrypt_value(status)})
        con.commit()
        cur.close()
        con.close()
        update_tab_2_treeview()
        window.destroy()
Beispiel #15
0
def save_password():
    p = get_db_path()
    if not check_password_web_desc_redundancy(web_desc_entry.get().strip()) and p is not None:
        add_passwords_button["state"] = "normal"
        open_passwords_button["state"] = "normal"
        delete_passwords_button["state"] = "normal"
        tabs_window.tab(0, state="normal")
        tabs_window.tab(1, state="normal")
        s_web_desc, s_username, s_password = encrypt_value(web_desc_entry.get().strip()), encrypt_value(username_entry.get().strip()), encrypt_value(password_entry.get().strip())
        con = connect(p)
        cur = con.cursor()
        cur.execute("INSERT INTO msd_passwords (web_desc, username, password) VALUES (?, ?, ?)", (encrypt_value(web_desc_entry.get().strip()), encrypt_value(username_entry.get().strip()), encrypt_value(password_entry.get().strip())))
        con.commit()
        cur.close()
        con.close()
        update_tab_3_treeview()
        window.destroy()
Beispiel #16
0
def check_is_login_available():
    p = get_db_path()
    got_pass = None
    if p is not None:
        con = connect(p)
        cur = con.cursor()
        cur.execute("SELECT password FROM msd_login")
        got_pass = cur.fetchone()
        cur.close()
        con.close()
    else:
        showerror("Error", "Error while checking login")
        root.destroy()
        exit()
    if got_pass == None:
        return None
    else:
        return decrypt_value(got_pass[0])
Beispiel #17
0
def save_notes():
    p = get_db_path()
    if p is not None and not check_notes_title_redundancy(title_entry.get().strip()):
        add_notes_button["state"] = "normal"
        open_notes_button["state"] = "normal"
        delete_notes_button["state"] = "normal"
        tabs_window.tab(1, state="normal")
        tabs_window.tab(2, state="normal")
        now_date = str(localtime().tm_year) + '-' + str(localtime().tm_mon) + '-' + str(localtime().tm_mday)
        now_time = str(localtime().tm_hour) + ':' + str(localtime().tm_min)  + ':' + str(localtime().tm_sec)
        con = connect(p)
        cur = con.cursor()
        cur.execute("INSERT INTO msd_notes (title, date, time, notes) VALUES (?, ?, ?, ?)", (encrypt_value(title_entry.get().strip()), encrypt_value(now_date), encrypt_value(now_time), encrypt_value(textarea.get("1.0", 'end').strip())))
        con.commit()
        cur.close()
        con.close()
        update_tab_1_treeview()
        window.destroy()
Beispiel #18
0
def update_notes(title, notes):
    p = get_db_path()
    if p is not None:
        add_notes_button["state"] = "normal"
        open_notes_button["state"] = "normal"
        delete_notes_button["state"] = "normal"
        tabs_window.tab(1, state="normal")
        tabs_window.tab(2, state="normal")
        now_date = str(localtime().tm_year) + '-' + str(localtime().tm_mon) + '-' + str(localtime().tm_mday)
        now_time = str(localtime().tm_hour) + ':' + str(localtime().tm_min)  + ':' + str(localtime().tm_sec)
        con = connect(p)
        cur = con.cursor()
        cur.execute("""UPDATE msd_notes SET date=:now_date, time=:now_time, notes=:notes WHERE title=:title""", {'title': encrypt_value(title), 'now_date': encrypt_value(now_date), 'now_time': encrypt_value(now_time), 'notes': encrypt_value(notes)})
        con.commit()
        cur.close()
        con.close()
        update_tab_1_treeview()
        window.destroy()
Beispiel #19
0
def save_appointment():
    p = get_db_path()
    if not check_apointment_name_redundancy(appointment_name_entry.get().strip()) and p is not None:
        add_appointments_button["state"] = "normal"
        open_appointments_button["state"] = "normal"
        delete_appointments_button["state"] = "normal"
        tabs_window.tab(0, state="normal")
        tabs_window.tab(2, state="normal")
        appointment_date = cal.selection_get()
        appointment_time = appointment_time_entry.get().strip()
        con = connect(p)
        cur = con.cursor()
        cur.execute("INSERT INTO msd_appointments (name, date, time, description, status) VALUES (?, ?, ?, ?, ?)", (encrypt_value(appointment_name_entry.get().strip()), encrypt_value(str(appointment_date)), encrypt_value(appointment_time), encrypt_value(appointment_textarea.get("1.0", 'end').strip()), encrypt_value(appointment_status_spinbox.get())))
        con.commit()
        cur.close()
        con.close()
        update_tab_2_treeview()
        window.destroy()