style the modals

This commit is contained in:
Tim Bendt
2025-05-04 19:53:27 -06:00
parent b26674ff4e
commit f56625c9cf
7 changed files with 54 additions and 18 deletions

View File

@@ -1,20 +1,25 @@
import asyncio
import subprocess
from textual import work
from maildir_gtd.screens.CreateTask import CreateTaskScreen
def action_create_task(app) -> None:
"""Show the input modal for creating a task."""
def check_task(task_args: str) -> bool:
async def check_task(task_args: str) -> bool:
try:
result = subprocess.run(
["task", "add"] + task_args.split(" "),
capture_output=True,
text=True
result = await asyncio.create_subprocess_shell(
f"task add {task_args}",
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE
)
stdout, stderr = await result.communicate()
if result.returncode == 0:
app.show_status("Task created successfully.")
app.show_status(f"Task created: {stdout.decode()}")
else:
app.show_status(f"Failed to create task: {result.stderr}")
app.show_status(f"Failed to create task: {stderr.decode()}", severity="error")
except Exception as e:
app.show_status(f"Error: {e}", severity="error")
return True