-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtasksclass.py
More file actions
79 lines (62 loc) · 1.81 KB
/
tasksclass.py
File metadata and controls
79 lines (62 loc) · 1.81 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
70
71
72
73
74
75
76
77
#redo of task with classes
import sqlite3
import time
import datetime
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 task (category text, task text, completed text(1), time decimal(6,2), hrup decimal(6,2))''')
self.c.execute('''CREATE TABLE IF NOT EXISTS str (date int, time int, hrup char(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;
hrupn=0;
self.c.execute('INSERT INTO task VALUES(?,?,?,?)', (catn, taskn,compn,timen));
self.conn.commit();
def p_t(self):
self.c.execute('select * from task')
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 task SET completed='y' WHERE rowid= %s" % rowid
self.c.execute(comp);
self.conn.commit();
def delete_t(self, rowid):
delete="DELETE FROM task WHERE rowid= %s" %rowid
self.c.execute(delete)
self.conn.commit();
def str_t(self,str_ans):
daten=time.strftime("%d/%m/%Y")
timen=time.strftime("%H:%M:%S")
strn=str_ans
self.c.execute('INSERT INTO str VALUES(?,?,?)',(daten, timen, strn));
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