diff options
author | Louie S <louie@example.com> | 2023-09-18 14:31:14 -0400 |
---|---|---|
committer | Louie S <louie@example.com> | 2023-09-18 14:31:14 -0400 |
commit | b4ca417b7e02f7cabba6689dc63eb7b733164fdf (patch) | |
tree | 5d78b2deaa0b63f6bf5c2b6cb99f41e437c00e43 /src/entry.py | |
parent | 1d26be43535c34b05513c92e700d5cc92610fa63 (diff) |
rules working
Diffstat (limited to 'src/entry.py')
-rw-r--r-- | src/entry.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/entry.py b/src/entry.py index 2a50cfd..6201667 100644 --- a/src/entry.py +++ b/src/entry.py @@ -1,7 +1,8 @@ from datetime import date -from PyQt5.QtCore import Qt +from PyQt5.QtCore import QDate, Qt from PyQt5.QtGui import QFont from PyQt5.QtWidgets import QHBoxLayout, QLabel +import src.globals as Globals class Entry: def __init__(self, id, parent_id, desc, due = "", due_alt = "", link = "", color = "", highlight = "", done = False, hidden = False): @@ -28,6 +29,15 @@ class Entry: body.setWordWrap(True) body.setToolTip("Right-Click for actions") + # Check rules + relevant_rules = list(filter(lambda r: r.entry_id == self.id, Globals.rules)) + for r in relevant_rules: + if (r.when.lower() == "before" and r.date > QDate.currentDate()) or (r.when.lower() == "after" and r.date <= QDate.currentDate()): + if r.color: + self.color = r.color + if r.highlight: + self.highlight = r.highlight + if self.done: bullet.setText("\u2713 ") bullet.setStyleSheet(""" |