From 744a7347a3a7dcd2674f6769e546e318de4d9fd9 Mon Sep 17 00:00:00 2001 From: SantaSpeen Date: Thu, 20 Jul 2023 04:59:12 +0300 Subject: [PATCH] Prepare for lua support; Minor update; --- src/modules/PluginsLoader/plugins_loader.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/modules/PluginsLoader/plugins_loader.py b/src/modules/PluginsLoader/plugins_loader.py index 79bd0ac..2d46caf 100644 --- a/src/modules/PluginsLoader/plugins_loader.py +++ b/src/modules/PluginsLoader/plugins_loader.py @@ -33,20 +33,10 @@ class KuiToi: def name(self): return self.__name - @name.setter - def name(self, value): - # You chell not pass - pass - @property def dir(self): return self.__dir - @dir.setter - def dir(self, value): - # You chell not pass - pass - @contextmanager def open(self, file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None): path = os.path.join(self.__dir, file) @@ -83,6 +73,7 @@ class PluginsLoader: self.loaded_str = "Plugins: " ev.register_event("_plugins_start", self.start) ev.register_event("_plugins_unload", self.unload) + ev.register_event("_plugins_get", lambda x: self.plugins) console.add_command("plugins", lambda x: self.loaded_str[:-2]) console.add_command("pl", lambda x: self.loaded_str[:-2]) @@ -90,7 +81,7 @@ class PluginsLoader: self.log.debug("Loading plugins...") files = os.listdir(self.plugins_dir) for file in files: - if file.endswith(".py"): + if os.path.isfile(file) and file.endswith(".py"): try: self.log.debug(f"Loading plugin: {file[:-3]}") plugin = types.ModuleType(file[:-3])