Added deletion of tasks.
Must be cleaned up!
This commit is contained in:
parent
4de3d1be80
commit
62c289c130
1 changed files with 7 additions and 1 deletions
8
main.py
8
main.py
|
@ -44,13 +44,18 @@ def add_item(entry, input_field):
|
||||||
"'%s', '%s','%s', '%s', '%s' )" % (item, get_time(), get_time(), 100, 0))
|
"'%s', '%s','%s', '%s', '%s' )" % (item, get_time(), get_time(), 100, 0))
|
||||||
con.commit()
|
con.commit()
|
||||||
input_field.destroy()
|
input_field.destroy()
|
||||||
|
update_list()
|
||||||
|
|
||||||
|
|
||||||
def remove_item():
|
def remove_item():
|
||||||
selected_index = listbox.curselection()
|
selected_index = listbox.curselection()
|
||||||
if selected_index:
|
if selected_index:
|
||||||
listbox.delete(selected_index)
|
listbox.delete(selected_index)
|
||||||
print(selected_index)
|
print(selected_index[0])
|
||||||
|
cur.execute("DELETE FROM todo WHERE ID = %s" % list(tasklist.keys())[selected_index[0]])
|
||||||
|
print("DELETE FROM todo WHERE ID = %s" % list(tasklist.keys())[selected_index[0]])
|
||||||
|
con.commit()
|
||||||
|
update_list()
|
||||||
|
|
||||||
|
|
||||||
def update_list():
|
def update_list():
|
||||||
|
@ -60,6 +65,7 @@ def update_list():
|
||||||
total_time = [] # cleanup and init
|
total_time = [] # cleanup and init
|
||||||
remaining_time = []
|
remaining_time = []
|
||||||
importance = []
|
importance = []
|
||||||
|
tasklist.clear()
|
||||||
|
|
||||||
res = cur.execute("SELECT * FROM todo").fetchall()
|
res = cur.execute("SELECT * FROM todo").fetchall()
|
||||||
for i, tmp1 in enumerate(res):
|
for i, tmp1 in enumerate(res):
|
||||||
|
|
Reference in a new issue