mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-07-11 13:21:59 +00:00
Merge branch 'main' into i18n
This commit is contained in:
+11
-2
@@ -1,5 +1,7 @@
|
|||||||
# Full imports
|
# Full imports
|
||||||
import json
|
import json
|
||||||
|
# import pprint
|
||||||
|
# from pprint import pformat
|
||||||
|
|
||||||
# Partial imports
|
# Partial imports
|
||||||
from aiohttp import ClientSession, web
|
from aiohttp import ClientSession, web
|
||||||
@@ -108,11 +110,18 @@ class PluginBrowser:
|
|||||||
try:
|
try:
|
||||||
logger.info("uninstalling " + name)
|
logger.info("uninstalling " + name)
|
||||||
logger.info(" at dir " + self.find_plugin_folder(name))
|
logger.info(" at dir " + self.find_plugin_folder(name))
|
||||||
logger.debug("unloading %s" % str(name))
|
logger.debug("calling frontend unload for %s" % str(name))
|
||||||
await tab.evaluate_js(f"DeckyPluginLoader.unloadPlugin('{name}')")
|
res = await tab.evaluate_js(f"DeckyPluginLoader.unloadPlugin('{name}')")
|
||||||
|
logger.debug("result of unload from UI: %s", res)
|
||||||
|
# plugins_snapshot = self.plugins.copy()
|
||||||
|
# snapshot_string = pformat(plugins_snapshot)
|
||||||
|
# logger.debug("current plugins: %s", snapshot_string)
|
||||||
if self.plugins[name]:
|
if self.plugins[name]:
|
||||||
|
logger.debug("Plugin %s was found", name)
|
||||||
self.plugins[name].stop()
|
self.plugins[name].stop()
|
||||||
|
logger.debug("Plugin %s was stopped", name)
|
||||||
del self.plugins[name]
|
del self.plugins[name]
|
||||||
|
logger.debug("Plugin %s was removed from the dictionary", name)
|
||||||
logger.debug("removing files %s" % str(name))
|
logger.debug("removing files %s" % str(name))
|
||||||
rmtree(self.find_plugin_folder(name))
|
rmtree(self.find_plugin_folder(name))
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
|
|||||||
+5
-1
@@ -92,9 +92,12 @@ class PluginWrapper:
|
|||||||
|
|
||||||
async def _unload(self):
|
async def _unload(self):
|
||||||
try:
|
try:
|
||||||
self.log.info("Attempting to unload " + self.name + "\n")
|
self.log.info("Attempting to unload with plugin " + self.name + "'s \"_unload\" function.\n")
|
||||||
if hasattr(self.Plugin, "_unload"):
|
if hasattr(self.Plugin, "_unload"):
|
||||||
await self.Plugin._unload(self.Plugin)
|
await self.Plugin._unload(self.Plugin)
|
||||||
|
self.log.info("Unloaded " + self.name + "\n")
|
||||||
|
else:
|
||||||
|
self.log.info("Could not find \"_unload\" in " + self.name + "'s main.py" + "\n")
|
||||||
except:
|
except:
|
||||||
self.log.error("Failed to unload " + self.name + "!\n" + format_exc())
|
self.log.error("Failed to unload " + self.name + "!\n" + format_exc())
|
||||||
exit(0)
|
exit(0)
|
||||||
@@ -118,6 +121,7 @@ class PluginWrapper:
|
|||||||
break
|
break
|
||||||
data = loads(line.decode("utf-8"))
|
data = loads(line.decode("utf-8"))
|
||||||
if "stop" in data:
|
if "stop" in data:
|
||||||
|
self.log.info("Calling Loader unload function.")
|
||||||
await self._unload()
|
await self._unload()
|
||||||
get_event_loop().stop()
|
get_event_loop().stop()
|
||||||
while get_event_loop().is_running():
|
while get_event_loop().is_running():
|
||||||
|
|||||||
@@ -189,6 +189,7 @@ class PluginLoader extends Logger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public unloadPlugin(name: string) {
|
public unloadPlugin(name: string) {
|
||||||
|
console.log('Plugin List: ', this.plugins);
|
||||||
const plugin = this.plugins.find((plugin) => plugin.name === name || plugin.name === name.replace('$LEGACY_', ''));
|
const plugin = this.plugins.find((plugin) => plugin.name === name || plugin.name === name.replace('$LEGACY_', ''));
|
||||||
plugin?.onDismount?.();
|
plugin?.onDismount?.();
|
||||||
this.plugins = this.plugins.filter((p) => p !== plugin);
|
this.plugins = this.plugins.filter((p) => p !== plugin);
|
||||||
|
|||||||
Reference in New Issue
Block a user