summaryrefslogtreecommitdiff
path: root/src/rule.py
diff options
context:
space:
mode:
authorLouie S <louie@example.com>2023-09-18 13:46:56 -0400
committerLouie S <louie@example.com>2023-09-18 13:55:07 -0400
commit1d26be43535c34b05513c92e700d5cc92610fa63 (patch)
tree5f96ced98677245031fa1d6460873e00ef0ccb72 /src/rule.py
parent9e18638dbd378db5737c9ddd9ef5c16a7e8ca4c7 (diff)
Functional rules dialog and backend
Diffstat (limited to 'src/rule.py')
-rw-r--r--src/rule.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/rule.py b/src/rule.py
new file mode 100644
index 0000000..6ecf7d7
--- /dev/null
+++ b/src/rule.py
@@ -0,0 +1,40 @@
+
+from PyQt5.QtCore import QDate
+from PyQt5.QtWidgets import QComboBox, QDateTimeEdit, QHBoxLayout, QLineEdit
+
+
+class Rule:
+ def __init__(self, id, entry_id, when, date, color = "", highlight = ""):
+ self.id = id
+ self.entry_id = entry_id
+ self.when = when
+ self.date = date
+ self.color = color
+ self.highlight = highlight
+
+ def buildLayout(self):
+ output = QHBoxLayout()
+
+ when_widget = QComboBox()
+ when_widget.addItems(["Before", "After"])
+ when_widget.setCurrentIndex(0 if self.when.lower() == "before" else 1)
+ output.addWidget(when_widget)
+
+ date_widget = QDateTimeEdit(QDate.currentDate())
+ date_widget.setDisplayFormat("MM/dd/yyyy")
+ date_widget.setDate(self.date)
+ output.addWidget(date_widget)
+
+ output.addStretch()
+
+ # TODO Consider making this a color selector widget
+ color_widget = QLineEdit()
+ color_widget.setPlaceholderText("Color")
+ output.addWidget(color_widget)
+
+ # TODO Consider making this a color selector widget
+ highlight_widget = QLineEdit()
+ highlight_widget.setPlaceholderText("Highlight")
+ output.addWidget(highlight_widget)
+
+ return output