diff options
author | Louie Shprung <lshprung@scu.edu> | 2023-12-21 13:17:39 -0800 |
---|---|---|
committer | Louie Shprung <lshprung@scu.edu> | 2023-12-21 13:17:39 -0800 |
commit | 65d8cbafe34b946d450ce46703e6449eb9962741 (patch) | |
tree | 9cb2bfa4857507207e8740478e5d23d4421ad784 /assignment_list_pyqt/rule.py | |
parent | 11373742d701166f2580cfe67015eac012cda1a9 (diff) |
Rename src directory to unique name to avoid install issues
Diffstat (limited to 'assignment_list_pyqt/rule.py')
-rw-r--r-- | assignment_list_pyqt/rule.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/assignment_list_pyqt/rule.py b/assignment_list_pyqt/rule.py new file mode 100644 index 0000000..414ccf0 --- /dev/null +++ b/assignment_list_pyqt/rule.py @@ -0,0 +1,44 @@ + +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") + if self.color: + color_widget.setText(self.color) + output.addWidget(color_widget) + + # TODO Consider making this a color selector widget + highlight_widget = QLineEdit() + highlight_widget.setPlaceholderText("Highlight") + if self.highlight: + highlight_widget.setText(self.highlight) + output.addWidget(highlight_widget) + + return output |