mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-12 01:07:52 -06:00
Reuse code
This commit is contained in:
parent
c900e27c19
commit
091f744838
1 changed files with 11 additions and 27 deletions
|
@ -107,15 +107,7 @@ class CuraEngineBackend(Backend):
|
||||||
return
|
return
|
||||||
|
|
||||||
if self._slicing:
|
if self._slicing:
|
||||||
self._slicing = False
|
self._terminate()
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
if self._message:
|
if self._message:
|
||||||
self._message.hide()
|
self._message.hide()
|
||||||
|
@ -148,16 +140,15 @@ class CuraEngineBackend(Backend):
|
||||||
job.finished.connect(self._onStartSliceCompleted)
|
job.finished.connect(self._onStartSliceCompleted)
|
||||||
|
|
||||||
def _terminate(self):
|
def _terminate(self):
|
||||||
if self._slicing:
|
self._slicing = False
|
||||||
self._slicing = False
|
self._restart = True
|
||||||
self._restart = True
|
if self._process is not None:
|
||||||
if self._process is not None:
|
Logger.log("d", "Killing engine process")
|
||||||
Logger.log("d", "Killing engine process")
|
try:
|
||||||
try:
|
self._process.terminate()
|
||||||
self._process.terminate()
|
except: # terminating a process that is already terminating causes an exception, silently ignore this.
|
||||||
except: # terminating a process that is already terminating causes an exception, silently ignore this.
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
def _onStartSliceCompleted(self, job):
|
def _onStartSliceCompleted(self, job):
|
||||||
if job.getError() or job.getResult() != True:
|
if job.getError() or job.getResult() != True:
|
||||||
if self._message:
|
if self._message:
|
||||||
|
@ -277,12 +268,5 @@ class CuraEngineBackend(Backend):
|
||||||
|
|
||||||
|
|
||||||
def _onInstanceChanged(self):
|
def _onInstanceChanged(self):
|
||||||
self._slicing = False
|
self._terminate()
|
||||||
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.slicingCancelled.emit()
|
self.slicingCancelled.emit()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue