mirror of
https://github.com/1j01/textual-paint.git
synced 2024-09-11 15:56:03 +03:00
Set wallpaper in a worker, to keep UI responsive
This commit is contained in:
parent
1c64fdb78c
commit
b63f303cf4
@ -21,7 +21,7 @@ from rich.segment import Segment
|
||||
from rich.style import Style
|
||||
from rich.console import Console
|
||||
from rich.text import Text
|
||||
from textual import events, on
|
||||
from textual import events, on, work
|
||||
from textual.filter import LineFilter
|
||||
from textual.message import Message
|
||||
from textual.app import App, ComposeResult
|
||||
@ -3562,6 +3562,8 @@ Columns: {len(palette) // 2}
|
||||
def action_set_as_wallpaper_centered(self) -> None:
|
||||
"""Center the image as the wallpaper."""
|
||||
self.set_as_wallpaper(tiled=False)
|
||||
# worker thread helps keep the UI responsive
|
||||
@work(exclusive=True)
|
||||
def set_as_wallpaper(self, tiled: bool) -> None:
|
||||
"""Set the image as the wallpaper."""
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user