-
Notifications
You must be signed in to change notification settings - Fork 0
/
reminderex.py
78 lines (53 loc) · 2.23 KB
/
reminderex.py
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
78
# Implementing reminder / task saver in calendar tab.
import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4 import QtCore, QtGui
from reminder import Ui_Dialog
from global_sql import *
class Startaddreminder(QtGui.QMainWindow):
def __init__(self, date, sem, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_Dialog()
self.ui.setupUi(self)
self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
icon = QtGui.QIcon()
b = QtGui.QPixmap("./pics/logo.png")
icon.addPixmap(b)
self.setWindowIcon(icon)
palette2 = QtGui.QPalette()
palette2.setBrush(self.backgroundRole(), QBrush(QImage("./pics/genback.png")))
self.setPalette(palette2)
self.ui.add_3.setStyleSheet('background-color: rgb(0, 147, 203); color: rgb(255, 255, 255);')
self.ui.add.setStyleSheet('background-color: rgb(0, 147, 203); color: rgb(255, 255, 255);')
self.date = date
self.sem = sem
self.ui.date.setText(date.toString())
self.setsub()
QtCore.QObject.connect(self.ui.add, QtCore.SIGNAL("clicked()"), self.tasksave)
# Saving the task into the database.
def tasksave(self):
day = self.date.day()
month = self.date.month()
year = self.date.year()
t = (str(self.ui.sub.currentText()), str(self.ui.desc.text()), day, month, year, )
cur.execute("insert into reminder values(?, ?, ?, ?, ?)", t)
con.commit()
self.ui.tasksaved.setText("Task added")
self.ui.desc.clear()
# Setting the subjects of the current semester.
def setsub(self):
self.ui.sub.clear()
t = (self.sem, )
cur.execute("select subjectcode from acads where semester = ?", t)
a = cur.fetchall()
b = []
for sublist in a:
b.append(str(sublist[0]))
b.append("Other")
self.ui.sub.addItems(b)
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
myapp = Startaddreminder()
myapp.show()
sys.exit(app.exec_())