mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-11 23:29:07 +08:00
Fixes for resetting print time information when removing all or last model, reduce signals being used for print time resetting - CURA-4852
This commit is contained in:
parent
3fb9877a30
commit
6c9d7b5a2e
@ -94,6 +94,10 @@ class CuraActions(QObject):
|
||||
removed_group_nodes.append(group_node)
|
||||
op.addOperation(SetParentOperation(remaining_nodes_in_group[0], group_node.getParent()))
|
||||
op.addOperation(RemoveSceneNodeOperation(group_node))
|
||||
|
||||
# Reset the print information
|
||||
Application.getInstance().getController().getScene().sceneChanged.emit(node)
|
||||
|
||||
op.push()
|
||||
|
||||
## Set the extruder that should be used to print the selection.
|
||||
|
@ -1066,12 +1066,12 @@ class CuraApplication(QtApplication):
|
||||
for node in nodes:
|
||||
op.addOperation(RemoveSceneNodeOperation(node))
|
||||
|
||||
# Reset the print information
|
||||
self.getController().getScene().sceneChanged.emit(node)
|
||||
|
||||
op.push()
|
||||
Selection.clear()
|
||||
|
||||
# Reset the print information:
|
||||
self.getController().getScene().sceneChanged.emit(node)
|
||||
|
||||
## Reset all translation on nodes with mesh data.
|
||||
@pyqtSlot()
|
||||
def resetAllTranslation(self):
|
||||
|
@ -8,7 +8,9 @@ from UM.Application import Application
|
||||
from UM.Logger import Logger
|
||||
from UM.Qt.Duration import Duration
|
||||
from UM.Preferences import Preferences
|
||||
from UM.Scene.SceneNode import SceneNode
|
||||
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||
from cura.Scene.CuraSceneNode import CuraSceneNode
|
||||
|
||||
from cura.Settings.ExtruderManager import ExtruderManager
|
||||
from typing import Dict
|
||||
@ -65,7 +67,7 @@ class PrintInformation(QObject):
|
||||
self._backend = Application.getInstance().getBackend()
|
||||
if self._backend:
|
||||
self._backend.printDurationMessage.connect(self._onPrintDurationMessage)
|
||||
Application.getInstance().getController().getScene().sceneChanged.connect(self.setToZeroPrintInformation)
|
||||
Application.getInstance().getController().getScene().sceneChanged.connect(self._onSceneChanged)
|
||||
|
||||
self._base_name = ""
|
||||
self._abbr_machine = ""
|
||||
@ -395,12 +397,25 @@ class PrintInformation(QObject):
|
||||
return result
|
||||
|
||||
# Simulate message with zero time duration
|
||||
def setToZeroPrintInformation(self, build_plate_number):
|
||||
temp_message = {}
|
||||
if build_plate_number not in self._print_time_message_values:
|
||||
self._print_time_message_values[build_plate_number] = {}
|
||||
for key in self._print_time_message_values[build_plate_number].keys():
|
||||
temp_message[key] = 0
|
||||
def setToZeroPrintInformation(self, build_plate):
|
||||
|
||||
# Construct the 0-time message
|
||||
temp_message = {}
|
||||
if build_plate not in self._print_time_message_values:
|
||||
self._print_time_message_values[build_plate] = {}
|
||||
for key in self._print_time_message_values[build_plate].keys():
|
||||
temp_message[key] = 0
|
||||
temp_material_amounts = [0]
|
||||
self._onPrintDurationMessage(build_plate_number, temp_message, temp_material_amounts)
|
||||
|
||||
self._onPrintDurationMessage(build_plate, temp_message, temp_material_amounts)
|
||||
|
||||
## Listen to scene changes to check if we need to reset the print information
|
||||
def _onSceneChanged(self, scene_node):
|
||||
|
||||
# Ignore any changes that are not related to sliceable objects
|
||||
if not isinstance(scene_node, SceneNode)\
|
||||
or not scene_node.callDecoration("isSliceable")\
|
||||
or not scene_node.callDecoration("getBuildPlateNumber") == self._active_build_plate:
|
||||
return
|
||||
|
||||
self.setToZeroPrintInformation(self._active_build_plate)
|
||||
|
Loading…
x
Reference in New Issue
Block a user