from __future__ import annotations
-import subprocess
import re
from PyQt6.QtWidgets import (
QWidget, QVBoxLayout, QHBoxLayout, QLabel,
- QPushButton, QTextBrowser, QScrollArea, QSizePolicy, QFrame,
+ QPushButton, QTextBrowser, QScrollArea, QFrame,
)
from PyQt6.QtCore import pyqtSignal, Qt
from core.models import Article
body.setContentsMargins(0, 0, 0, 0)
body.setSpacing(0)
- # Frontmatter column
+ # Frontmatter column (scrollable)
+ fm_scroll = QScrollArea()
+ fm_scroll.setFixedWidth(230)
+ fm_scroll.setWidgetResizable(True)
+ fm_scroll.setStyleSheet("QScrollArea { background:#0a0a12; border:none; }")
self._fm_widget = QWidget()
- self._fm_widget.setFixedWidth(230)
self._fm_widget.setStyleSheet("background:#0a0a12;")
self._fm_layout = QVBoxLayout(self._fm_widget)
self._fm_layout.setContentsMargins(10, 10, 10, 10)
self._fm_content = QVBoxLayout()
self._fm_layout.addLayout(self._fm_content)
self._fm_layout.addStretch()
- body.addWidget(self._fm_widget)
+ fm_scroll.setWidget(self._fm_widget)
+ body.addWidget(fm_scroll)
divider = QFrame()
divider.setFrameShape(QFrame.Shape.VLine)
def set_article(self, article: Article):
self._article = article
self._title_label.setText(article.slug)
- rel = str(article.path).replace(str(article.path.parent.parent.parent.parent), "")
+ rel = "/".join(article.path.parts[-5:])
self._path_label.setText(rel)
# Populate frontmatter
from __future__ import annotations
from PyQt6.QtWidgets import (
- QWidget, QVBoxLayout, QHBoxLayout, QTabWidget,
- QListWidget, QListWidgetItem, QLabel, QPushButton,
+ QWidget, QVBoxLayout, QTabWidget,
+ QListWidget, QListWidgetItem, QLabel,
)
from PyQt6.QtCore import Qt, pyqtSignal
from PyQt6.QtGui import QColor
def __init__(self, article: Article):
super().__init__()
self.article = article
- lang_other = "EN" if article.lang == "it" else "IT"
if article.has_translation:
badge = f"🇬🇧 ✓" if article.lang == "it" else "🇮🇹 ✓"
status = f"{article.slug} [{badge}]"
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.frontmatter import write_frontmatter
from core.taxonomy import load_taxonomy
class FrontmatterEditor(QDialog):
else:
updated[key] = val
try:
- _, body = parse_frontmatter(self._article.path)
- write_frontmatter(self._article.path, updated, body)
+ write_frontmatter(self._article.path, updated, "")
self._article.frontmatter.update(updated)
self.accept()
except Exception as e: