From b4ca417b7e02f7cabba6689dc63eb7b733164fdf Mon Sep 17 00:00:00 2001 From: Louie S Date: Mon, 18 Sep 2023 14:31:14 -0400 Subject: rules working --- src/entry.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/entry.py') 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(""" -- cgit