-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddFilter.py
More file actions
69 lines (61 loc) · 2.3 KB
/
Copy pathaddFilter.py
File metadata and controls
69 lines (61 loc) · 2.3 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
from PyQt5 import QtWidgets
from Libraries.Tasks import Filter
import datetime
class addFilter(QtWidgets.QDialog):
def __init__(self,filter:Filter=None):
self.filter = filter
super().__init__()
self.setGeometry(50,50,500,500)
layout = QtWidgets.QVBoxLayout(self)
p1 = Priority(1,self.filter)
p2 = Priority(0,self.filter)
duedate = dueDate(self.filter)
submit_bttn = QtWidgets.QPushButton("Submit")
submit_bttn.clicked.connect(self.submit)
layout.addLayout(p1)
layout.addLayout(p2)
layout.addLayout(duedate)
layout.addWidget(submit_bttn)
self.setLayout(layout)
def submit(self):
self.accept()
class Priority(QtWidgets.QVBoxLayout):
def __init__(self,b,filter:Filter):
super().__init__()
if b:
button = QtWidgets.QPushButton("Priority Higher than")
else:
button = QtWidgets.QPushButton("Priority Lower than")
self.addWidget(button)
Hbox = QtWidgets.QHBoxLayout()
self.bttngrp = QtWidgets.QButtonGroup()
for i in range(1,11):
self.bu = QtWidgets.QRadioButton(str(i),None)
self.bttngrp.addButton(self.bu)
Hbox.addWidget(self.bu)
def setpriority(bttn:QtWidgets.QRadioButton):
if b:
filter.priorityHigherThan(int(bttn.text()))
else:filter.priorityLowerThan(int(bttn.text()))
self.bttngrp.buttonClicked.connect(setpriority)
self.addLayout(Hbox)
class dueDate(QtWidgets.QHBoxLayout):
def __init__(self,filter):
super().__init__()
self.filter = filter
self.button = QtWidgets.QPushButton("Due Date Before:")
self.button.setCheckable(True)
self.button.toggled.connect(self.toggled)
self.addWidget(self.button)
def toggled(self,checked):
if checked:
dueDateBefore = QtWidgets.QDateTimeEdit(datetime.datetime.now())
def setdt(dt):
self.filter.dateBefore(dt.toPyDateTime())
dueDateBefore.dateTimeChanged.connect(setdt)
self.addWidget(dueDateBefore)
else:
try:self.filter.undo(self.filter.dateBefore)
except:pass
item = self.takeAt(1)
item.widget().deleteLater()