From 54ad3e37c6e9d2242f932c192119dd6de64966cf Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Tue, 5 May 2026 10:51:56 +0200 Subject: feat: check OLLAMA_HOST reachability before starting translation Non-blocking QThread check hits /api/tags on the resolved ollama host before launching TranslationWorker. Shows QMessageBox.warning() if unreachable; proceeds silently if reachable. Adds ollama_host field to Config with env-var fallback to http://localhost:11434. Co-Authored-By: Claude Sonnet 4.6 --- HANDOFF.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'HANDOFF.md') diff --git a/HANDOFF.md b/HANDOFF.md index 15cdf00..7f394b0 100644 --- a/HANDOFF.md +++ b/HANDOFF.md @@ -1,14 +1,14 @@ Who this is for: - Danilo is a developer and blogger running a bilingual (IT/EN) Hugo site at danix.xyz. He maintains a PyQt6 desktop app called my-publisher that centralizes his blog publishing workflow, and is continuing to extend it post-v1.3. + Danilo is a developer and blogger running a bilingual (IT/EN) Hugo site at danix.xyz. He maintains a PyQt6 desktop app called my-publisher that centralizes his blog publishing workflow, and is continuing to extend it post-v1.4. What we covered: - Four bugs were fixed this session. First, the categories field in FrontmatterEditor was displaying Python list repr (e.g. "['cat1', 'cat2']") instead of a comma-separated string, and saving it back as a corrupted TOML string. Fixed by adding an isinstance(val, list) branch in _build_ui() and generalising the save logic to detect list-typed fields by checking the original frontmatter value type rather than hardcoding "tags". Second, the article type combo box was defaulting to "Life" instead of the article's actual type, because ARTICLE_TYPES used titlecase while files store lowercase values. Fixed by lowercasing ARTICLE_TYPES and doing a case-insensitive match on load. Third, on save the type was being written back in titlecase instead of lowercase. Fixed by the same ARTICLE_TYPES change. Fourth, categories autocomplete was added to FrontmatterEditor: a MultiTokenCompleter (already used for tags) is now also attached to the categories QLineEdit, loading suggestions from docs/categories.txt via load_categories(). All 34 tests pass. Three commits were made and pushed. v1.4 was tagged and pushed. + npm build integration was planned and implemented this session. The blog repo uses Tailwind CSS and npm run build compiles main.css to main.min.css. A new NpmWorker (workers/npm_worker.py) was created following the existing HugoWorker pattern: QObject + QProcess, emits log_line(str) and finished(bool). HugoPanel (ui/hugo_panel.py) was updated to sequence npm run build before starting hugo server when Avvia is clicked, and a new "Build CSS" button was added to allow manual Tailwind rebuilds while the server is already running. Button states are managed across four states: idle, building, running, rebuilding. All 34 tests pass. Changes were committed, pushed to master, and tagged v1.5. What was confirmed: - All 34 tests pass after every change. No articles in the blog repo had corrupted categories fields — the corruption seen in earlier exploration was not present in the actual files. ARTICLE_TYPES is now ["life", "photo", "link", "quote", "tech"]. The save path for both tags and categories now uses isinstance(self._article.frontmatter.get(key), list) to detect list fields generically. MultiTokenCompleter loads categories from docs/categories.txt (a single non-lang-split file, unlike tags which have tags-it.txt and tags-en.txt). v1.4 is live on origin/master. + NpmWorker follows the exact same QObject+QProcess pattern as HugoWorker. Sequential order was chosen: build completes before hugo starts. If build fails before hugo was ever started, the UI returns to idle state and Avvia is re-enabled. The blog repo package.json lives at the same path as config.blog_repo, so no new config fields were needed. Closing the app while hugo is running triggers stop_server() via closeEvent in main_window.py, which calls terminate() + waitForFinished(3000) on the QProcess. v1.5 is live on origin/master. Still in progress: Nothing was left open in this session. Next steps: - Remaining TODO items include: (1) npm run build integration before launching hugo server, with a button to trigger it while the server is running; (2) transart backend availability check using OLLAMA_HOST — validate before translation starts or disable the translate button with a popup; (3) font size spinner in SetupDialog — add QSpinBox, save via Config.save(), re-apply with app.setFont(); (4) article editor language flag in the sidebar; (5) manage static pages in addition to articles. \ No newline at end of file + Remaining TODO items include: (1) transart backend availability check using OLLAMA_HOST — validate before translation starts or disable the translate button with a popup; (2) font size spinner in SetupDialog — add QSpinBox, save via Config.save(), re-apply with app.setFont(); (3) article editor language flag in the sidebar; (4) manage static pages in addition to articles. \ No newline at end of file -- cgit v1.2.3