Tier 3: Compose MV split #10

Closed
clanker wants to merge 0 commits from tier3/compose-mv into master
Owner

Extract ComposeModel from ComposePanel so the 760-line god widget becomes a testable model + thin binding.

What

  • New lazarus/compose_model.py (225L, Qt-free): ComposeSeed + builders build_reply/forward/mailto, account helpers (account_for_message, email_for_account, gnupg_keyid_for_account), and pure formatting (sig_block_text, subject_with_prefix, quote_body_text, forwarded_text). Covered by ad-hoc checks (account detection, RE/FW dedupe, sig block, mailto/reply/forward seeds).
  • lazarus/compose.py thin binding: __init__ seeds via model, account_name/email_address/gnupg_keyid/_sig_block_text now shim to model, _insert_signature stays on the panel (QTextCursor/cursor-position preservation is widget-specific). 757 → 690 lines.

Diff hygiene

  • Line-for-line behavior preserved — same RE/FW prefix rule, same blank-line+signature layout, same attachment dump on forward. No API or config change.
  • python -m py_compile clean; ad-hoc compose_model tests pass (see /tmp/test_compose_*.py in run history).
Extract ComposeModel from ComposePanel so the 760-line god widget becomes a testable model + thin binding. ### What * New `lazarus/compose_model.py` (225L, Qt-free): `ComposeSeed` + builders `build_reply/forward/mailto`, account helpers (`account_for_message`, `email_for_account`, `gnupg_keyid_for_account`), and pure formatting (`sig_block_text`, `subject_with_prefix`, `quote_body_text`, `forwarded_text`). Covered by ad-hoc checks (account detection, RE/FW dedupe, sig block, mailto/reply/forward seeds). * `lazarus/compose.py` thin binding: `__init__` seeds via model, `account_name/email_address/gnupg_keyid/_sig_block_text` now shim to model, `_insert_signature` stays on the panel (QTextCursor/cursor-position preservation is widget-specific). 757 → 690 lines. ### Diff hygiene * Line-for-line behavior preserved — same RE/FW prefix rule, same blank-line+signature layout, same attachment dump on forward. No API or config change. * `python -m py_compile` clean; ad-hoc `compose_model` tests pass (see `/tmp/test_compose_*.py` in run history).
Move account/sig/seed logic into lazarus/compose_model.py (Qt-free
pure functions + ComposeSeed dataclass) so ComposePanel becomes a thin
binding over seeds returned by build_reply/forward/mailto. Panel still
owns _insert_signature (widget cursor + QTextCursor dance) and header
binding; model owns the compositional algebra (sig_block, subject prefix,
quote/forward assembly). Helpers account_for_message / email_for_account
/ gnupg_keyid_for_account / sig_block_text are the new call sites —
exercisable without a display server.
fman was hardcoded in ~/.config but not on PATH, so Popen(shell=True)
failed silently with '/bin/sh: fman: not found'. Now checks shutil.which
on the template's binary and falls back through nautilus/dolphin/thunar/xdg-open,
surfacing the path or an error via status_message. Also fixes the user config
(fman -> nautilus).
O now asks for a destination via getExistingDirectory (defaults to
attachment_save_dir, ~/Downloads), writes decoded parts directly there
with dedup suffix (.1, .2), and post-save either reveals via
file_browser_command (attachment_reveal='file_browser') or just shows a
status message ('none'). No temp-dir + file-manager to /tmp. New settings:

  attachment_save_dir   string  default '~/Downloads'
  attachment_reveal     'file_browser'|'none'  default 'file_browser'

Old file_browser_command retained as the reveal template; empty means skip.
Temp-dir path removed; still falls back through nautilus/dolphin/thunar/xdg-open.
clanker force-pushed tier3/compose-mv from 329900ecd9 to 0a3e142a98 2026-08-08 00:10:38 +00:00 Compare
clanker closed this pull request 2026-08-08 00:10:42 +00:00
clanker referenced this pull request from a commit 2026-08-08 00:11:14 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Home/lazarus!10
No description provided.