From 06d74b43dfc3b78bf8765d7f23939a0f340af3a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20G=C3=A2teau?= Date: Wed, 4 Sep 2024 16:32:32 +0200 Subject: [PATCH] Write keywords as colored `@k1 @k2` This is more readable and more compact than the existing `(k1, k2)` format. --- yokadi/core/db.py | 4 ++-- yokadi/ycli/textlistrenderer.py | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/yokadi/core/db.py b/yokadi/core/db.py index 8db6ad35..cd77931f 100644 --- a/yokadi/core/db.py +++ b/yokadi/core/db.py @@ -172,13 +172,13 @@ def getKeywordsAsString(self): def getUserKeywordsNameAsString(self): """ - Returns all keywords keys as a string like "key1, key2, key3...". + Returns all keywords keys as a string like "@key1 @key2 @key3...". Internal keywords (starting with _) are ignored. """ keywords = [k for k in list(self.getKeywordDict().keys()) if not k.startswith("_")] keywords.sort() if keywords: - return ", ".join(keywords) + return " ".join(f"@{k}" for k in keywords) else: return "" diff --git a/yokadi/ycli/textlistrenderer.py b/yokadi/ycli/textlistrenderer.py index 521a310d..b84a99aa 100644 --- a/yokadi/ycli/textlistrenderer.py +++ b/yokadi/ycli/textlistrenderer.py @@ -85,11 +85,10 @@ def __call__(self, task): # Create title title = task.title if keywords and len(title) < maxWidth: - title += ' (' - colorizer.setColorAt(len(title), C.BOLD) + title += ' ' + colorizer.setColorAt(len(title), C.ORANGE) title += keywords colorizer.setResetAt(len(title)) - title += ')' # Crop title to fit in self.width titleWidth = len(title)