moved plugin loading to async
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from textual_window import Window
|
||||
from textual.widgets import RichLog
|
||||
from textual import work
|
||||
|
||||
import os, json
|
||||
|
||||
@@ -15,7 +16,8 @@ class PluginLoader(Window):
|
||||
start_open=True
|
||||
)
|
||||
|
||||
def on_mount(self):
|
||||
@work
|
||||
async def find_plugins(self):
|
||||
log = self.query_one(RichLog)
|
||||
log.write("[b]Finding plugins...[/]")
|
||||
|
||||
@@ -70,5 +72,11 @@ class PluginLoader(Window):
|
||||
log.write(f"[b green]FOUND[/] {plugin_json['name']} ({plugin_json['version']})")
|
||||
plugin_paths.append(plugin_folder)
|
||||
|
||||
self.close_window()
|
||||
|
||||
async def on_mount(self):
|
||||
self.find_plugins()
|
||||
|
||||
|
||||
def compose(self):
|
||||
yield RichLog(markup=True, id="plugins-log")
|
Reference in New Issue
Block a user