develop #3

Merged
itdominator merged 69 commits from develop into master 2026-03-23 04:51:23 +00:00
228 changed files with 8731 additions and 853 deletions
Showing only changes of commit 0b3579d485 - Show all commits

View File

@@ -3,7 +3,8 @@ import os
import sys import sys
import importlib import importlib
import traceback import traceback
import asyncio
from concurrent.futures import ThreadPoolExecutor
from os.path import join from os.path import join
from os.path import isdir from os.path import isdir
@@ -76,13 +77,10 @@ class PluginsController(ControllerBase, PluginsControllerMixin, PluginReloadMixi
module = self._load_plugin_module(path, folder, target) module = self._load_plugin_module(path, folder, target)
if is_pre_launch: if is_pre_launch:
asyncio.run( self._run_with_pool(module, manifest_meta)
self.execute_plugin(module, manifest_meta)
)
else: else:
GLib.idle_add( GLib.idle_add(
asyncio.run, self._run_with_pool, module, manifest_meta
self.execute_plugin(module, manifest_meta)
) )
except Exception as e: except Exception as e:
logger.info(f"Malformed Plugin: Not loading -->: '{folder}' !") logger.info(f"Malformed Plugin: Not loading -->: '{folder}' !")
@@ -90,6 +88,10 @@ class PluginsController(ControllerBase, PluginsControllerMixin, PluginReloadMixi
os.chdir(parent_path) os.chdir(parent_path)
def _run_with_pool(self, module: type, manifest_meta: ManifestMeta):
with ThreadPoolExecutor(max_workers = 1) as executor:
executor.submit(self.execute_plugin, module, manifest_meta)
def _load_plugin_module(self, path, folder, target): def _load_plugin_module(self, path, folder, target):
os.chdir(path) os.chdir(path)
@@ -125,7 +127,7 @@ class PluginsController(ControllerBase, PluginsControllerMixin, PluginReloadMixi
manifest_metas: list = self._manifest_manager.get_post_launch_plugins() manifest_metas: list = self._manifest_manager.get_post_launch_plugins()
self._load_plugins(manifest_metas) self._load_plugins(manifest_metas)
async def execute_plugin(self, module: type, manifest_meta: ManifestMeta): def execute_plugin(self, module: type, manifest_meta: ManifestMeta):
plugin = module.Plugin() plugin = module.Plugin()
plugin.plugin_context: PluginContext = self.create_plugin_context() plugin.plugin_context: PluginContext = self.create_plugin_context()