-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtasksclass.py
More file actions
69 lines (53 loc) · 1.55 KB
/
tasksclass.py
File metadata and controls
69 lines (53 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#redo of task with classes
import sqlite3
import time
class tasks:
def __init__(self):
# self.ques=raw_input("new tasks?(ntask), completed a task?(comp), print tasks(ptask),delete a task?(d), view not completed tasks(nc), view completed tasks(c), add timer for task(t)???")
self.conn=sqlite3.connect('task.db');
self.c=self.conn.cursor();
self.c.execute('''CREATE TABLE IF NOT EXISTS tasks (category text, task text, completed text(1), time decimal(6,2))''')
self.conn.commit()
def new_t(self,catn,taskn):
# catn=raw_input('What is the category of your task?');
#catn="j2"
# taskn=raw_input('what is your task?')
# taskn='j'
compn='n';
timen=0;
self.c.execute('INSERT INTO tasks VALUES(?,?,?,?)', (catn, taskn,compn,timen))
self.conn.commit();
def p_t(self):
self.c.execute('select * from tasks')
self.table=[]
rows=self.c.fetchall()
for row in rows:
self.table.append(t[1])
return self.table
def comp_t(self,rowid):
comp="UPDATE tasks SET completed='y' WHERE rowid= %s" % rowid
self.c.execute(comp);
self.conn.commit();
def delete_t(self, rowid):
delete="DELETE FROM tasks WHERE rowid= %s" %rowid
self.c.execute(delete)
self.conn.commit();
def poop(self):
print "poop"
# print "task %s has been created" %catn
# quest=self.ques
# return quest
# def run(self):
# quest=self.ques
# if quest=='n':
# print "new task"
# elif quest=='t':
## print "time"
# else:
# print "ok"
##
d=tasks()
d
#d.quest()
#d.run()
#d.ques