From ebf31756b5d7d53c8929abc00f024d19c82442f6 Mon Sep 17 00:00:00 2001 From: Jan Lerking Date: Fri, 28 Mar 2025 18:22:16 +0100 Subject: [PATCH] #31 Done. /JL --- example.py | 4 +++- setup.py | 2 +- xtendr/xtendrsystem.py | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/example.py b/example.py index abee367..ec70d95 100644 --- a/example.py +++ b/example.py @@ -20,7 +20,9 @@ if __name__ == "__main__": """ system = XtendRSystem() system.attach("example_plugin", my_callback) # Assuming 'example_plugin/plugin_info.json' exists - time.sleep(6) + for i in range(3): + print(f"Main program is running iteration {i+1}...") + time.sleep(2) system.run("example_plugin", test="Hello!") system.stop("example_plugin") system.run("example_plugin", 25) diff --git a/setup.py b/setup.py index f2f6536..a07cced 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ if __name__ == "__main__": setup( name="XtendR", - version="0.3.0", + version="0.3.2", packages=find_packages(), install_requires=[], author="Jan Lerking", diff --git a/xtendr/xtendrsystem.py b/xtendr/xtendrsystem.py index 9232dc7..e01cef4 100644 --- a/xtendr/xtendrsystem.py +++ b/xtendr/xtendrsystem.py @@ -5,7 +5,7 @@ import json import threading from xtendr.xtendrbase import XtendRBase -__version__ = "0.3.0" +__version__ = "0.3.2" class XtendRSystem: """Plugin system to manage plugins. @@ -69,7 +69,7 @@ class XtendRSystem: } print(f"Attached plugin '{name}'.") print(f"Running pre-load on '{name}'.") - thread = threading.Thread(target=self.plugins[name].pre_load(), args=(callback,)) + thread = threading.Thread(target=self.plugins[name]['instance'].pre_load, args=(callback,)) thread.start() except (ModuleNotFoundError, json.JSONDecodeError, AttributeError) as e: print(f"Failed to attach plugin '{name}': {e}")