refactor email viewer app

This commit is contained in:
Tim Bendt
2025-04-30 13:11:00 -04:00
parent 3f48ef8e11
commit a158fad485
27 changed files with 362 additions and 303 deletions

View File

@@ -0,0 +1,21 @@
from textual.widgets import Static
import subprocess
from maildir_gtd.actions.next import action_next
def action_archive(app) -> None:
"""Archive the current email message."""
app.show_status(f"Archiving message {app.current_message_id}...")
try:
result = subprocess.run(
["himalaya", "message", "move", "Archives", str(app.current_message_id)],
capture_output=True,
text=True
)
if result.returncode == 0:
app.query_one("#main_content", Static).update(f"Message {app.current_message_id} archived.")
app.show_status(f"Message {app.current_message_id} archived.")
action_next(app) # Automatically show the next message
else:
app.query_one("#main_content", Static).update(f"Failed to archive message {app.current_message_id}.")
except Exception as e:
app.query_one("#main_content", Static).update(f"Error: {e}")