From 45510d04edaf27462a3eae840a09ea4b12eeb974 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Wed, 13 Sep 2023 07:15:59 +0200 Subject: [PATCH 1/3] Added ability for backend plugins to determine their usability Modified BackendPlugin.py and StartSliceJob.py to allow plugins to decide when they should be used. The 'usePlugin' method was added to enable a plugin to return a boolean indicating if it should be used or not, e.q.: start up and connect to the services. Contributes to CURA-11031 --- cura/BackendPlugin.py | 6 ++++++ plugins/CuraEngineBackend/StartSliceJob.py | 2 ++ 2 files changed, 8 insertions(+) diff --git a/cura/BackendPlugin.py b/cura/BackendPlugin.py index 935b376c63..e8a08cf0be 100644 --- a/cura/BackendPlugin.py +++ b/cura/BackendPlugin.py @@ -22,6 +22,10 @@ class BackendPlugin(AdditionalSettingDefinitionsAppender, PluginObject): self._process = None self._is_running = False self._supported_slots: List[int] = [] + self._use_plugin = True + + def usePlugin(self) -> bool: + return self._use_plugin def getSupportedSlots(self) -> List[int]: return self._supported_slots @@ -55,6 +59,8 @@ class BackendPlugin(AdditionalSettingDefinitionsAppender, PluginObject): :return: True if the plugin process started successfully, False otherwise. """ + if not self.usePlugin(): + return False try: # STDIN needs to be None because we provide no input, but communicate via a local socket instead. # The NUL device sometimes doesn't exist on some computers. diff --git a/plugins/CuraEngineBackend/StartSliceJob.py b/plugins/CuraEngineBackend/StartSliceJob.py index 892e4dfca6..4d924ac337 100644 --- a/plugins/CuraEngineBackend/StartSliceJob.py +++ b/plugins/CuraEngineBackend/StartSliceJob.py @@ -303,6 +303,8 @@ class StartSliceJob(Job): self._buildExtruderMessage(extruder_stack) for plugin in CuraApplication.getInstance().getBackendPlugins(): + if not plugin.usePlugin(): + continue for slot in plugin.getSupportedSlots(): # Right now we just send the message for every slot that we support. A single plugin can support # multiple slots From 8a21a0a5cbfa041751fb6e09a9f039bae6bb92a9 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Wed, 13 Sep 2023 07:55:26 +0200 Subject: [PATCH 2/3] Use gradual_flow from CURA-11031 branch Contributes to CURA-11031 --- conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conanfile.py b/conanfile.py index 315e494daf..ae509bf752 100644 --- a/conanfile.py +++ b/conanfile.py @@ -311,7 +311,7 @@ class CuraConan(ConanFile): self.requires("curaengine/(latest)@ultimaker/testing") self.requires("pysavitar/5.3.0") self.requires("pynest2d/5.3.0") - self.requires("curaengine_plugin_gradual_flow/(latest)@ultimaker/testing") + self.requires("curaengine_plugin_gradual_flow/(latest)@ultimaker/cura_11031") # FIXME: Use `curaengine_plugin_gradual_flow/(latest)@ultimaker/testing` once merged to main self.requires("uranium/(latest)@ultimaker/testing") self.requires("cura_binary_data/(latest)@ultimaker/testing") self.requires("cpython/3.10.4") From 62074ca004fcca80ae9205af72c643e0a58c5325 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 13 Sep 2023 15:25:22 +0200 Subject: [PATCH 3/3] Fix now that Gradual Flow plugin PR CURA-11031 has been merged to main. --- conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conanfile.py b/conanfile.py index ae509bf752..315e494daf 100644 --- a/conanfile.py +++ b/conanfile.py @@ -311,7 +311,7 @@ class CuraConan(ConanFile): self.requires("curaengine/(latest)@ultimaker/testing") self.requires("pysavitar/5.3.0") self.requires("pynest2d/5.3.0") - self.requires("curaengine_plugin_gradual_flow/(latest)@ultimaker/cura_11031") # FIXME: Use `curaengine_plugin_gradual_flow/(latest)@ultimaker/testing` once merged to main + self.requires("curaengine_plugin_gradual_flow/(latest)@ultimaker/testing") self.requires("uranium/(latest)@ultimaker/testing") self.requires("cura_binary_data/(latest)@ultimaker/testing") self.requires("cpython/3.10.4")