mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 11:17:49 -06:00
T466: Added pausing of backend work
This commit is contained in:
parent
b9514527dd
commit
65f3495a29
5 changed files with 28 additions and 8 deletions
|
@ -69,6 +69,8 @@ class CuraEngineBackend(Backend):
|
||||||
self._scene = Application.getInstance().getController().getScene()
|
self._scene = Application.getInstance().getController().getScene()
|
||||||
self._scene.sceneChanged.connect(self._onSceneChanged)
|
self._scene.sceneChanged.connect(self._onSceneChanged)
|
||||||
|
|
||||||
|
self._pauseSlicing = False
|
||||||
|
|
||||||
# Workaround to disable layer view processing if layer view is not active.
|
# Workaround to disable layer view processing if layer view is not active.
|
||||||
self._layer_view_active = False
|
self._layer_view_active = False
|
||||||
Application.getInstance().getController().activeViewChanged.connect(self._onActiveViewChanged)
|
Application.getInstance().getController().activeViewChanged.connect(self._onActiveViewChanged)
|
||||||
|
@ -399,7 +401,8 @@ class CuraEngineBackend(Backend):
|
||||||
#
|
#
|
||||||
# This indicates that we should probably re-slice soon.
|
# This indicates that we should probably re-slice soon.
|
||||||
def _onChanged(self, *args, **kwargs):
|
def _onChanged(self, *args, **kwargs):
|
||||||
self._change_timer.start()
|
if not self._pauseSlicing:
|
||||||
|
self._change_timer.start()
|
||||||
|
|
||||||
## Called when the back-end connects to the front-end.
|
## Called when the back-end connects to the front-end.
|
||||||
def _onBackendConnected(self):
|
def _onBackendConnected(self):
|
||||||
|
|
|
@ -48,6 +48,16 @@ class GCODEReader(MeshReader):
|
||||||
|
|
||||||
scene_node.getBoundingBox = getBoundingBox
|
scene_node.getBoundingBox = getBoundingBox
|
||||||
scene_node.gcode = True
|
scene_node.gcode = True
|
||||||
|
backend = Application.getInstance().getBackend()
|
||||||
|
backend._pauseSlicing = True
|
||||||
|
backend.backendStateChange.emit(0)
|
||||||
|
|
||||||
|
mesh_builder = MeshBuilder()
|
||||||
|
mesh_builder.setFileName(file_name)
|
||||||
|
|
||||||
|
mesh_builder.addCube(10,10,10)
|
||||||
|
|
||||||
|
scene_node.setMeshData(mesh_builder.build())
|
||||||
|
|
||||||
layer_data = LayerDataBuilder.LayerDataBuilder()
|
layer_data = LayerDataBuilder.LayerDataBuilder()
|
||||||
layer_count = 1
|
layer_count = 1
|
||||||
|
|
|
@ -45,16 +45,11 @@ class LayerPass(RenderPass):
|
||||||
tool_handle_batch = RenderBatch(self._tool_handle_shader, type = RenderBatch.RenderType.Overlay)
|
tool_handle_batch = RenderBatch(self._tool_handle_shader, type = RenderBatch.RenderType.Overlay)
|
||||||
|
|
||||||
for node in DepthFirstIterator(self._scene.getRoot()):
|
for node in DepthFirstIterator(self._scene.getRoot()):
|
||||||
flag = False
|
|
||||||
try:
|
|
||||||
flag = node.gcode
|
|
||||||
except AttributeError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if isinstance(node, ToolHandle):
|
if isinstance(node, ToolHandle):
|
||||||
tool_handle_batch.addItem(node.getWorldTransformation(), mesh = node.getSolidMesh())
|
tool_handle_batch.addItem(node.getWorldTransformation(), mesh = node.getSolidMesh())
|
||||||
|
|
||||||
elif isinstance(node, SceneNode) and (node.getMeshData() or flag) and node.isVisible():
|
elif isinstance(node, SceneNode) and (node.getMeshData()) and node.isVisible():
|
||||||
layer_data = node.callDecoration("getLayerData")
|
layer_data = node.callDecoration("getLayerData")
|
||||||
if not layer_data:
|
if not layer_data:
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -118,8 +118,14 @@ class LayerView(View):
|
||||||
if type(node) is ConvexHullNode and not Selection.isSelected(node.getWatchedNode()):
|
if type(node) is ConvexHullNode and not Selection.isSelected(node.getWatchedNode()):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
flag = False
|
||||||
|
try:
|
||||||
|
flag = node.gcode
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
if not node.render(renderer):
|
if not node.render(renderer):
|
||||||
if node.getMeshData() and node.isVisible():
|
if node.getMeshData() and node.isVisible() and not flag:
|
||||||
renderer.queueNode(node, transparent = True, shader = self._ghost_shader)
|
renderer.queueNode(node, transparent = True, shader = self._ghost_shader)
|
||||||
|
|
||||||
def setLayer(self, value):
|
def setLayer(self, value):
|
||||||
|
|
|
@ -14,6 +14,7 @@ Rectangle {
|
||||||
|
|
||||||
property real progress: UM.Backend.progress;
|
property real progress: UM.Backend.progress;
|
||||||
property int backendState: UM.Backend.state;
|
property int backendState: UM.Backend.state;
|
||||||
|
property bool backendPaused: UM.Backend.paused;
|
||||||
property bool activity: Printer.getPlatformActivity;
|
property bool activity: Printer.getPlatformActivity;
|
||||||
property int totalHeight: childrenRect.height + UM.Theme.getSize("default_margin").height
|
property int totalHeight: childrenRect.height + UM.Theme.getSize("default_margin").height
|
||||||
property string fileBaseName
|
property string fileBaseName
|
||||||
|
@ -24,6 +25,11 @@ Rectangle {
|
||||||
return catalog.i18nc("@label:PrintjobStatus", "Please load a 3d model");
|
return catalog.i18nc("@label:PrintjobStatus", "Please load a 3d model");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (backendPaused)
|
||||||
|
{
|
||||||
|
return catalog.i18nc("@label:PrintjobStatus", "Slicing temporary disabled");
|
||||||
|
}
|
||||||
|
|
||||||
switch(base.backendState)
|
switch(base.backendState)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue