This commit is contained in:
2025-03-28 18:22:16 +01:00
parent 406c1b77ed
commit ebf31756b5
3 changed files with 6 additions and 4 deletions
+3 -1
View File
@@ -20,7 +20,9 @@ if __name__ == "__main__":
""" """
system = XtendRSystem() system = XtendRSystem()
system.attach("example_plugin", my_callback) # Assuming 'example_plugin/plugin_info.json' exists 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.run("example_plugin", test="Hello!")
system.stop("example_plugin") system.stop("example_plugin")
system.run("example_plugin", 25) system.run("example_plugin", 25)
+1 -1
View File
@@ -3,7 +3,7 @@ if __name__ == "__main__":
setup( setup(
name="XtendR", name="XtendR",
version="0.3.0", version="0.3.2",
packages=find_packages(), packages=find_packages(),
install_requires=[], install_requires=[],
author="Jan Lerking", author="Jan Lerking",
+2 -2
View File
@@ -5,7 +5,7 @@ import json
import threading import threading
from xtendr.xtendrbase import XtendRBase from xtendr.xtendrbase import XtendRBase
__version__ = "0.3.0" __version__ = "0.3.2"
class XtendRSystem: class XtendRSystem:
"""Plugin system to manage plugins. """Plugin system to manage plugins.
@@ -69,7 +69,7 @@ class XtendRSystem:
} }
print(f"Attached plugin '{name}'.") print(f"Attached plugin '{name}'.")
print(f"Running pre-load on '{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() thread.start()
except (ModuleNotFoundError, json.JSONDecodeError, AttributeError) as e: except (ModuleNotFoundError, json.JSONDecodeError, AttributeError) as e:
print(f"Failed to attach plugin '{name}': {e}") print(f"Failed to attach plugin '{name}': {e}")