summaryrefslogtreecommitdiffstats
path: root/ui/frontmatter_editor.py
diff options
context:
space:
mode:
Diffstat (limited to 'ui/frontmatter_editor.py')
-rw-r--r--ui/frontmatter_editor.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/ui/frontmatter_editor.py b/ui/frontmatter_editor.py
index add9a41..f1fe0df 100644
--- a/ui/frontmatter_editor.py
+++ b/ui/frontmatter_editor.py
@@ -8,7 +8,7 @@ from PyQt6.QtCore import Qt
from pathlib import Path
from core.models import Article, ARTICLE_TYPES
from core.frontmatter import parse_frontmatter, write_frontmatter
-from core.taxonomy import load_taxonomy
+from core.taxonomy import load_taxonomy, load_categories
class MultiTokenCompleter(QCompleter):
"""QCompleter that completes only the last comma-separated token."""
@@ -83,6 +83,12 @@ class FrontmatterEditor(QDialog):
widget = QLineEdit(", ".join(str(v) for v in val) if isinstance(val, list) else str(val))
MultiTokenCompleter(known_tags, widget).attach(widget)
self._fields[key] = widget
+ elif key == "categories":
+ cats_path = self._blog_root / "docs" / "categories.txt"
+ known_cats = load_categories(cats_path)
+ widget = QLineEdit(", ".join(str(v) for v in val) if isinstance(val, list) else str(val))
+ MultiTokenCompleter(known_cats, widget).attach(widget)
+ self._fields[key] = widget
elif isinstance(val, list):
widget = QLineEdit(", ".join(str(v) for v in val))
self._fields[key] = widget