Notify tasks app when task is created from mail app
This commit is contained in:
@@ -1,10 +1,12 @@
|
|||||||
import logging
|
import logging
|
||||||
|
import asyncio
|
||||||
from textual.screen import ModalScreen
|
from textual.screen import ModalScreen
|
||||||
from textual.widgets import Input, Label, Button, ListView, ListItem
|
from textual.widgets import Input, Label, Button, ListView, ListItem
|
||||||
from textual.containers import Vertical, Horizontal, Container
|
from textual.containers import Vertical, Horizontal, Container
|
||||||
from textual.binding import Binding
|
from textual.binding import Binding
|
||||||
from textual import on, work
|
from textual import on, work
|
||||||
from src.services.task_client import create_task, get_backend_info
|
from src.services.task_client import create_task, get_backend_info
|
||||||
|
from src.utils.ipc import notify_refresh
|
||||||
|
|
||||||
|
|
||||||
class CreateTaskScreen(ModalScreen):
|
class CreateTaskScreen(ModalScreen):
|
||||||
@@ -208,6 +210,8 @@ class CreateTaskScreen(ModalScreen):
|
|||||||
|
|
||||||
if success:
|
if success:
|
||||||
self.app.show_status(f"Task created: {subject}", "success")
|
self.app.show_status(f"Task created: {subject}", "success")
|
||||||
|
# Notify the tasks app to refresh
|
||||||
|
asyncio.create_task(notify_refresh("tasks", {"source": "mail"}))
|
||||||
self.dismiss()
|
self.dismiss()
|
||||||
else:
|
else:
|
||||||
self.app.show_status(f"Failed to create task: {result}", "error")
|
self.app.show_status(f"Failed to create task: {result}", "error")
|
||||||
|
|||||||
Reference in New Issue
Block a user