Do not show a message when processing top layers but rather leave it up to QML

Contributes to CURA-957
This commit is contained in:
Arjen Hiemstra 2016-03-01 02:07:39 +01:00
parent c684e96ef1
commit f2d98cfba3

View file

@ -133,11 +133,6 @@ class LayerView(View):
self._top_layer_timer.start()
if self._top_layers_job:
self._top_layers_job.finished.disconnect(self._updateCurrentLayerMesh)
self._top_layers_job.cancel()
self._top_layers_job = None
self.currentLayerNumChanged.emit()
currentLayerNumChanged = Signal()
@ -195,6 +190,10 @@ class LayerView(View):
return True
def _startUpdateTopLayers(self):
if self._top_layers_job:
self._top_layers_job.finished.disconnect(self._updateCurrentLayerMesh)
self._top_layers_job.cancel()
self.setBusy(True)
self._top_layers_job = _CreateTopLayersJob(self._controller.getScene(), self._current_layer_num, self._solid_layers)
@ -232,10 +231,6 @@ class _CreateTopLayersJob(Job):
if self._cancel or not layer_data:
return
message = Message(catalog.i18nc("@info:status", "Processing Layers"), 0, False, -1)
start_time = time.clock()
layer_mesh = MeshData()
for i in range(self._solid_layers):
layer_number = self._layer_number - i
@ -246,7 +241,6 @@ class _CreateTopLayersJob(Job):
layer = layer_data.getLayer(layer_number).createMesh()
except Exception as e:
print(e)
message.hide()
return
if not layer or layer.getVertices() is None:
@ -260,24 +254,19 @@ class _CreateTopLayersJob(Job):
layer_mesh.addColors(layer.getColors() * brightness)
if self._cancel:
message.hide()
return
now = time.clock()
if now - start_time > 0.5:
# If the entire process takes longer than 500ms, display a message indicating that we're busy.
message.show()
Job.yieldThread()
if self._cancel:
message.hide()
return
Job.yieldThread()
jump_mesh = layer_data.getLayer(self._layer_number).createJumps()
if not jump_mesh or jump_mesh.getVertices() is None:
jump_mesh = None
self.setResult({ "layers": layer_mesh, "jumps": jump_mesh })
message.hide()
def cancel(self):
self._cancel = True