Move backend plugin logic to Cura from Uranium

I was running into abstraction issues when it was defined in Uranium.
Instead of trying to fight those, it's just easier to move it to Cura

CURA-10717
This commit is contained in:
Jaime van Kessel 2023-07-11 11:24:28 +02:00
parent 26bf00ccc0
commit f3bc7bf28a
No known key found for this signature in database
GPG key ID: C85F7A3AF1BAA7C4
3 changed files with 98 additions and 1 deletions

View file

@ -70,7 +70,7 @@ class CuraEngineBackend(QObject, Backend):
os.path.join(CuraApplication.getInstallPrefix(), "bin"),
os.path.dirname(os.path.abspath(sys.executable)),
]
self._last_backend_plugin_port = self._port + 1000
for path in search_path:
engine_path = os.path.join(path, executable_name)
if os.path.isfile(engine_path):
@ -176,6 +176,20 @@ class CuraEngineBackend(QObject, Backend):
application.initializationFinished.connect(self.initialize)
def startPlugins(self) -> None:
"""
Ensure that all backend plugins are started
:return:
"""
backend_plugins = CuraApplication.getInstance().getBackendPlugins()
for backend_plugin in backend_plugins:
if backend_plugin.isRunning():
continue
# Set the port to prevent plugins from using the same one.
backend_plugin.setPort(self._last_backend_plugin_port)
self.__last_backend_plugin_port += 1
backend_plugin.start()
def _resetLastSliceTimeStats(self) -> None:
self._time_start_process = None
self._time_send_message = None