Merge pull request #575 from fieldOfView/feature_tool_stops_engine

Terminate engine when a ToolOperation starts
This commit is contained in:
Ghostkeeper 2015-12-22 10:41:48 +01:00
commit 345775fc2a

View File

@ -107,15 +107,7 @@ class CuraEngineBackend(Backend):
return
if self._slicing:
self._slicing = False
self._restart = True
if self._process is not None:
Logger.log("d", "Killing engine process")
try:
self._process.terminate()
except: # terminating a process that is already terminating causes an exception, silently ignore this.
pass
self._terminate()
if self._message:
self._message.hide()
@ -147,6 +139,16 @@ class CuraEngineBackend(Backend):
job.start()
job.finished.connect(self._onStartSliceCompleted)
def _terminate(self):
self._slicing = False
self._restart = True
if self._process is not None:
Logger.log("d", "Killing engine process")
try:
self._process.terminate()
except: # terminating a process that is already terminating causes an exception, silently ignore this.
pass
def _onStartSliceCompleted(self, job):
if job.getError() or job.getResult() != True:
if self._message:
@ -245,6 +247,7 @@ class CuraEngineBackend(Backend):
self._restart = False
def _onToolOperationStarted(self, tool):
self._terminate() # Do not continue slicing once a tool has started
self._enabled = False # Do not reslice when a tool is doing it's 'thing'
def _onToolOperationStopped(self, tool):
@ -265,12 +268,5 @@ class CuraEngineBackend(Backend):
def _onInstanceChanged(self):
self._slicing = False
self._restart = True
if self._process is not None:
Logger.log("d", "Killing engine process")
try:
self._process.terminate()
except: # terminating a process that is already terminating causes an exception, silently ignore this.
pass
self._terminate()
self.slicingCancelled.emit()