]> danix's work - publisher.git/commitdiff
fix: remove dead code/imports, wrap fm column in QScrollArea, fix path display, simpl...
authorDanilo M. <redacted>
Sun, 3 May 2026 08:37:59 +0000 (10:37 +0200)
committerDanilo M. <redacted>
Sun, 3 May 2026 08:37:59 +0000 (10:37 +0200)
ui/article_detail.py
ui/articles_view.py
ui/frontmatter_editor.py

index 77dadb7f251aa5038c04d415838135595a33c09d..1fe16436633cb62c874c3bfca2a0b9dc93114c9b 100644 (file)
@@ -1,9 +1,8 @@
 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
@@ -64,9 +63,12 @@ class ArticleDetailView(QWidget):
         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)
@@ -76,7 +78,8 @@ class ArticleDetailView(QWidget):
         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)
@@ -101,7 +104,7 @@ class ArticleDetailView(QWidget):
     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
index d3fac9311abca2dd61c29168927a3f493926a415..f45e736aeeb8e84a96a686848fee61f386657ea3 100644 (file)
@@ -1,7 +1,7 @@
 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
@@ -11,7 +11,6 @@ class ArticleItem(QListWidgetItem):
     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}]"
index 218bbace1baa0be20a2f113925a48b16370c657e..3b4b690dfa3642ab34a1cda4f56bc4152c4cb1fc 100644 (file)
@@ -7,7 +7,7 @@ from PyQt6.QtWidgets import (
 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):
@@ -76,8 +76,7 @@ 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: