mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-09 06:45:09 -06:00
Merge branch '2.1' of https://github.com/Ultimaker/Cura into 2.1
This commit is contained in:
commit
2ab23513b2
9 changed files with 55 additions and 19 deletions
|
@ -6,7 +6,6 @@ class ZOffsetDecorator(SceneNodeDecorator):
|
|||
self._z_offset = 0
|
||||
|
||||
def setZOffset(self, offset):
|
||||
print("setZOffset", offset)
|
||||
self._z_offset = offset
|
||||
|
||||
def getZOffset(self):
|
||||
|
|
|
@ -13,7 +13,6 @@ class AutoSave(Extension):
|
|||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
#Preferences.getInstance().preferenceChanged.connect(self._onPreferenceChanged)
|
||||
Preferences.getInstance().preferenceChanged.connect(self._triggerTimer)
|
||||
|
||||
machine_manager = Application.getInstance().getMachineManager()
|
||||
|
@ -52,8 +51,11 @@ class AutoSave(Extension):
|
|||
self._saving = True # To prevent the save process from triggering another autosave.
|
||||
Logger.log("d", "Autosaving preferences, instances and profiles")
|
||||
|
||||
machine_manager = Application.getInstance().getMachineManager()
|
||||
|
||||
machine_manager.saveVisibility()
|
||||
machine_manager.saveMachineInstances()
|
||||
machine_manager.saveProfiles()
|
||||
Preferences.getInstance().writeToFile(Resources.getStoragePath(Resources.Preferences, Application.getInstance().getApplicationName() + ".cfg"))
|
||||
Application.getInstance().getMachineManager().saveMachineInstances()
|
||||
Application.getInstance().getMachineManager().saveProfiles()
|
||||
|
||||
self._saving = False
|
||||
|
|
|
@ -73,6 +73,7 @@ class CuraEngineBackend(Backend):
|
|||
self._restart = False
|
||||
self._enabled = True
|
||||
self._always_restart = True
|
||||
self._process_layers_job = None #The currently active job to process layers, or None if it is not processing layers.
|
||||
|
||||
self._message = None
|
||||
|
||||
|
@ -120,6 +121,10 @@ class CuraEngineBackend(Backend):
|
|||
self.slicingCancelled.emit()
|
||||
return
|
||||
|
||||
if self._process_layers_job:
|
||||
self._process_layers_job.abort()
|
||||
self._process_layers_job = None
|
||||
|
||||
if self._profile.hasErrorValue():
|
||||
Logger.log("w", "Profile has error values. Aborting slicing")
|
||||
if self._message:
|
||||
|
@ -179,6 +184,12 @@ class CuraEngineBackend(Backend):
|
|||
|
||||
self._onChanged()
|
||||
|
||||
def _onSocketError(self, error):
|
||||
super()._onSocketError(error)
|
||||
self._slicing = False
|
||||
self.processingProgress.emit(0)
|
||||
Logger.log("e", "A socket error caused the connection to be reset")
|
||||
|
||||
def _onActiveProfileChanged(self):
|
||||
if self._profile:
|
||||
self._profile.settingValueChanged.disconnect(self._onSettingChanged)
|
||||
|
@ -193,8 +204,8 @@ class CuraEngineBackend(Backend):
|
|||
|
||||
def _onSlicedObjectListMessage(self, message):
|
||||
if self._layer_view_active:
|
||||
job = ProcessSlicedObjectListJob.ProcessSlicedObjectListJob(message)
|
||||
job.start()
|
||||
self._process_layers_job = ProcessSlicedObjectListJob.ProcessSlicedObjectListJob(message)
|
||||
self._process_layers_job.start()
|
||||
else :
|
||||
self._stored_layer_data = message
|
||||
|
||||
|
|
|
@ -24,12 +24,26 @@ class ProcessSlicedObjectListJob(Job):
|
|||
self._message = message
|
||||
self._scene = Application.getInstance().getController().getScene()
|
||||
self._progress = None
|
||||
self._abortRequested = False
|
||||
|
||||
## Aborts the processing of layers.
|
||||
#
|
||||
# This abort is made on a best-effort basis, meaning that the actual
|
||||
# job thread will check once in a while to see whether an abort is
|
||||
# requested and then stop processing by itself. There is no guarantee
|
||||
# that the abort will stop the job any time soon or even at all.
|
||||
def abort(self):
|
||||
self._abortRequested = True
|
||||
|
||||
def run(self):
|
||||
if Application.getInstance().getController().getActiveView().getPluginId() == "LayerView":
|
||||
self._progress = Message(catalog.i18nc("@info:status", "Processing Layers"), 0, False, -1)
|
||||
self._progress.show()
|
||||
Job.yieldThread()
|
||||
if self._abortRequested:
|
||||
if self._progress:
|
||||
self._progress.hide()
|
||||
return
|
||||
|
||||
Application.getInstance().getController().activeViewChanged.connect(self._onActiveViewChanged)
|
||||
|
||||
|
@ -43,6 +57,10 @@ class ProcessSlicedObjectListJob(Job):
|
|||
else:
|
||||
object_id_map[id(node)] = node
|
||||
Job.yieldThread()
|
||||
if self._abortRequested:
|
||||
if self._progress:
|
||||
self._progress.hide()
|
||||
return
|
||||
|
||||
settings = Application.getInstance().getMachineManager().getWorkingProfile()
|
||||
|
||||
|
@ -94,19 +112,28 @@ class ProcessSlicedObjectListJob(Job):
|
|||
# TODO: Rebuild the layer data mesh once the layer has been processed.
|
||||
# This needs some work in LayerData so we can add the new layers instead of recreating the entire mesh.
|
||||
|
||||
if self._abortRequested:
|
||||
if self._progress:
|
||||
self._progress.hide()
|
||||
return
|
||||
if self._progress:
|
||||
self._progress.setProgress(progress)
|
||||
|
||||
# We are done processing all the layers we got from the engine, now create a mesh out of the data
|
||||
layer_data.build()
|
||||
|
||||
if self._abortRequested:
|
||||
if self._progress:
|
||||
self._progress.hide()
|
||||
return
|
||||
|
||||
#Add layerdata decorator to scene node to indicate that the node has layerdata
|
||||
decorator = LayerDataDecorator.LayerDataDecorator()
|
||||
decorator.setLayerData(layer_data)
|
||||
new_node.addDecorator(decorator)
|
||||
|
||||
new_node.setMeshData(mesh)
|
||||
new_node.setParent(self._scene.getRoot())
|
||||
new_node.setParent(self._scene.getRoot()) #Note: After this we can no longer abort!
|
||||
|
||||
if self._progress:
|
||||
self._progress.setProgress(100)
|
||||
|
|
|
@ -92,7 +92,7 @@ UM.MainWindow
|
|||
text: catalog.i18nc("@action:inmenu menubar:file", "&Save Selection to File");
|
||||
enabled: UM.Selection.hasSelection;
|
||||
iconName: "document-save-as";
|
||||
onTriggered: UM.OutputDeviceManager.requestWriteSelectionToDevice("local_file", Printer.jobName, filter_by_machine = false);
|
||||
onTriggered: UM.OutputDeviceManager.requestWriteSelectionToDevice("local_file", Printer.jobName, { "filter_by_machine": false });
|
||||
}
|
||||
Menu
|
||||
{
|
||||
|
@ -108,7 +108,7 @@ UM.MainWindow
|
|||
MenuItem
|
||||
{
|
||||
text: model.description;
|
||||
onTriggered: UM.OutputDeviceManager.requestWriteToDevice(model.id, Printer.jobName, filter_by_machine = false);
|
||||
onTriggered: UM.OutputDeviceManager.requestWriteToDevice(model.id, Printer.jobName, { "filter_by_machine": false });
|
||||
}
|
||||
onObjectAdded: saveAllMenu.insertItem(index, object)
|
||||
onObjectRemoved: saveAllMenu.removeItem(object)
|
||||
|
@ -226,7 +226,7 @@ UM.MainWindow
|
|||
UM.MachineManager.setActiveProfile(model.name);
|
||||
if (!model.active) {
|
||||
//Selecting a profile was canceled; undo menu selection
|
||||
checked = false;
|
||||
profileMenuInstantiator.model.setProperty(index, "active", false);
|
||||
var activeProfileName = UM.MachineManager.activeProfile;
|
||||
var activeProfileIndex = profileMenuInstantiator.model.find("name", activeProfileName);
|
||||
profileMenuInstantiator.model.setProperty(activeProfileIndex, "active", true);
|
||||
|
|
|
@ -62,7 +62,7 @@ Item{
|
|||
UM.MachineManager.setActiveProfile(model.name);
|
||||
if (!model.active) {
|
||||
//Selecting a profile was canceled; undo menu selection
|
||||
checked = false;
|
||||
profileSelectionInstantiator.model.setProperty(index, "active", false);
|
||||
var activeProfileName = UM.MachineManager.activeProfile;
|
||||
var activeProfileIndex = profileSelectionInstantiator.model.find("name", activeProfileName);
|
||||
profileSelectionInstantiator.model.setProperty(activeProfileIndex, "active", true);
|
||||
|
|
|
@ -84,7 +84,7 @@ Rectangle {
|
|||
text: UM.OutputDeviceManager.activeDeviceShortDescription
|
||||
onClicked:
|
||||
{
|
||||
UM.OutputDeviceManager.requestWriteToDevice(UM.OutputDeviceManager.activeDevice, Printer.jobName, true)
|
||||
UM.OutputDeviceManager.requestWriteToDevice(UM.OutputDeviceManager.activeDevice, Printer.jobName, { "filter_by_machine": true })
|
||||
}
|
||||
|
||||
style: ButtonStyle {
|
||||
|
|
|
@ -142,7 +142,7 @@ Item
|
|||
UM.MachineManager.setActiveMachineVariant(variantsModel.getItem(index).name);
|
||||
if (typeof(model) !== "undefined" && !model.active) {
|
||||
//Selecting a variant was canceled; undo menu selection
|
||||
checked = false;
|
||||
variantSelectionInstantiator.model.setProperty(index, "active", false);
|
||||
var activeMachineVariantName = UM.MachineManager.activeMachineVariant;
|
||||
var activeMachineVariantIndex = variantSelectionInstantiator.model.find("name", activeMachineVariantName);
|
||||
variantSelectionInstantiator.model.setProperty(activeMachineVariantIndex, "active", true);
|
||||
|
@ -206,7 +206,7 @@ Item
|
|||
UM.MachineManager.setActiveMaterial(machineMaterialsModel.getItem(index).name);
|
||||
if (typeof(model) !== "undefined" && !model.active) {
|
||||
//Selecting a material was canceled; undo menu selection
|
||||
checked = false;
|
||||
materialSelectionInstantiator.model.setProperty(index, "active", false);
|
||||
var activeMaterialName = UM.MachineManager.activeMaterial;
|
||||
var activeMaterialIndex = materialSelectionInstantiator.model.find("name", activeMaterialName);
|
||||
materialSelectionInstantiator.model.setProperty(activeMaterialIndex, "active", true);
|
||||
|
|
|
@ -107,7 +107,6 @@ Item
|
|||
onClicked: {
|
||||
if (infillListView.activeIndex != index)
|
||||
{
|
||||
infillListView.activeIndex = index
|
||||
UM.MachineManager.setSettingValue("infill_sparse_density", model.percentage)
|
||||
}
|
||||
}
|
||||
|
@ -211,8 +210,7 @@ Item
|
|||
hoverEnabled: true
|
||||
onClicked:
|
||||
{
|
||||
parent.checked = !parent.checked
|
||||
UM.MachineManager.setSettingValue("adhesion_type", parent.checked?"brim":"skirt")
|
||||
UM.MachineManager.setSettingValue("adhesion_type", !parent.checked?"brim":"skirt")
|
||||
}
|
||||
onEntered:
|
||||
{
|
||||
|
@ -245,8 +243,7 @@ Item
|
|||
hoverEnabled: true
|
||||
onClicked:
|
||||
{
|
||||
parent.checked = !parent.checked
|
||||
UM.MachineManager.setSettingValue("support_enable", parent.checked)
|
||||
UM.MachineManager.setSettingValue("support_enable", !parent.checked)
|
||||
}
|
||||
onEntered:
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue