From be682f475472f7242a45f55b60b8b718bc2aa29c Mon Sep 17 00:00:00 2001 From: jpt Date: Sun, 13 Apr 2025 12:25:25 -0500 Subject: [PATCH] unclassified dates --- src/tt/constants.py | 10 ++++++++++ src/tt/controller/tasks.py | 4 ++-- src/tt/tui/modals.py | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 src/tt/constants.py diff --git a/src/tt/constants.py b/src/tt/constants.py new file mode 100644 index 0000000..d14d7a5 --- /dev/null +++ b/src/tt/constants.py @@ -0,0 +1,10 @@ + +SPECIAL_DATES_PIECES = { + "future": (3000,1,1), + "unclassified": (1999,1,1), +} +SPECIAL_DATES_DISPLAY = { + "3000-01-01": "[#333333]future[/]", + "1999-01-01": "[#cccccc]unclassified[/]", +} + diff --git a/src/tt/controller/tasks.py b/src/tt/controller/tasks.py index fe136ba..f9d93da 100644 --- a/src/tt/controller/tasks.py +++ b/src/tt/controller/tasks.py @@ -4,7 +4,7 @@ from peewee import fn from peewee import Case, Value from ..db import db, Task, SavedSearch from .. import config - +from ..constants import SPECIAL_DATES_PIECES def get_task(item_id: int) -> Task: @@ -14,7 +14,7 @@ def get_task(item_id: int) -> Task: def add_task( text: str, status: str, - due: datetime | None = None, + due: datetime | str = SPECIAL_DATES_PIECES["unclassified"], type: str = "", project: str = "", ) -> Task: diff --git a/src/tt/tui/modals.py b/src/tt/tui/modals.py index de47a64..2bf272f 100644 --- a/src/tt/tui/modals.py +++ b/src/tt/tui/modals.py @@ -161,10 +161,10 @@ class DateModal(ModalScreen): (p)ast (t)oday (f)uture""", classes="hints") def action_future(self): - self.pieces = SPECIAL_DAYS_PIECES["future"] + self.pieces = SPECIAL_DATES_PIECES["future"] def action_unclassified(self): - self.pieces = SPECIAL_DAYS_PIECES["unclassified"] + self.pieces = SPECIAL_DATES_PIECES["unclassified"] def action_today(self): today = datetime.date.today()