moved the files around added demo examples and fixed a bunch of stuff!

This commit is contained in:
2025-10-01 21:07:28 +02:00
parent f1bda77ce2
commit 6580d5c4bc
10 changed files with 410 additions and 308 deletions

40
lua/PluginFSHandler.py Normal file
View File

@@ -0,0 +1,40 @@
from pathlib import Path
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
from log.Logger import *
logger = Logger()
class PluginFSHandler(FileSystemEventHandler):
def __init__(self, manager):
self.manager = manager
def on_modified(self, event):
try:
if event.is_directory:
return
if event.src_path.endswith(".lua"):
logger.log_lua_info(f"Plugin changed: {event.src_path}, reloading")
self.manager.reload_plugin(Path(event.src_path))
except Exception as e:
logger.log_lua_error(f"Error in on_modified: {e}")
def on_created(self, event):
try:
if event.is_directory:
return
if event.src_path.endswith(".lua"):
logger.log_lua_info(f"New plugin: {event.src_path}, loading")
self.manager.load_plugin(Path(event.src_path))
except Exception as e:
logger.error(f"Error in on_created: {e}")
def on_deleted(self, event):
try:
if event.is_directory:
return
p = Path(event.src_path)
if p.suffix == ".lua":
logger.log_lua_info(f"Plugin removed: {p.name}")
self.manager.unload_plugin(p.name)
except Exception as e:
logger.log_lua_error(f"Error in on_deleted: {e}")