Revert "CURA-4946 Add the quality_definition metadata entry to the gcode so when"

This reverts commit 744313af27.
This commit is contained in:
Diego Prado Gesto 2018-02-20 09:30:05 +01:00
parent 7e8ee00e06
commit 6a4f519238
2 changed files with 5 additions and 17 deletions

View file

@ -228,23 +228,16 @@ class CuraContainerRegistry(ContainerRegistry):
Logger.log("e", "Incorrect profile [%s]. Could not find global profile", file_name) Logger.log("e", "Incorrect profile [%s]. Could not find global profile", file_name)
return { "status": "error", return { "status": "error",
"message": catalog.i18nc("@info:status Don't translate the XML tags <filename> or <message>!", "This profile <filename>{0}</filename> contains incorrect data, could not import it.", file_name)} "message": catalog.i18nc("@info:status Don't translate the XML tags <filename> or <message>!", "This profile <filename>{0}</filename> contains incorrect data, could not import it.", file_name)}
# In a profile we can have the quality_definition metadata, but if not, we get the definition
profile_definition = global_profile.getMetaDataEntry("quality_definition")
if not profile_definition:
profile_definition = global_profile.getMetaDataEntry("definition") profile_definition = global_profile.getMetaDataEntry("definition")
expected_machine_definition = "fdmprinter"
# The expected machine definition may be the quality_definition if defined or the current definition id
expected_machine_definition = None
if parseBool(global_container_stack.getMetaDataEntry("has_machine_quality", "False")): if parseBool(global_container_stack.getMetaDataEntry("has_machine_quality", "False")):
expected_machine_definition = global_container_stack.getMetaDataEntry("quality_definition") expected_machine_definition = global_container_stack.getMetaDataEntry("quality_definition")
if not expected_machine_definition: if not expected_machine_definition:
expected_machine_definition = global_container_stack.definition.getId() expected_machine_definition = global_container_stack.definition.getId()
if expected_machine_definition is not None and profile_definition is not None and profile_definition != expected_machine_definition: if expected_machine_definition is not None and profile_definition is not None and profile_definition != expected_machine_definition:
Logger.log("e", "Profile [%s] is for machine [%s] but the current active machine is [%s]. Will not import the profile", file_name, profile_definition, expected_machine_definition) Logger.log("e", "Profile [%s] is for machine [%s] but the current active machine is [%s]. Will not import the profile", file_name, profile_definition, expected_machine_definition)
return { "status": "error", return { "status": "error",
"message": catalog.i18nc("@info:status Don't translate the XML tags <filename> or <message>!", "The machine defined in profile <filename>{0}</filename> ({1}) doesn't match with your current machine ({2}), could not import it.", file_name, profile_definition, expected_machine_definition)} "message": catalog.i18nc("@info:status Don't translate the XML tags <filename> or <message>!", "The machine defined in profile <filename>{0}</filename> doesn't match with your current machine, could not import it.", file_name)}
name_seed = os.path.splitext(os.path.basename(file_name))[0] name_seed = os.path.splitext(os.path.basename(file_name))[0]
new_name = self.uniqueName(name_seed) new_name = self.uniqueName(name_seed)

View file

@ -5,7 +5,6 @@ from UM.Mesh.MeshWriter import MeshWriter
from UM.Logger import Logger from UM.Logger import Logger
from UM.Application import Application from UM.Application import Application
from UM.Settings.InstanceContainer import InstanceContainer from UM.Settings.InstanceContainer import InstanceContainer
from UM.Util import parseBool
from cura.Settings.ExtruderManager import ExtruderManager from cura.Settings.ExtruderManager import ExtruderManager
@ -121,10 +120,6 @@ class GCodeWriter(MeshWriter):
if flat_global_container.getMetaDataEntry("quality_type", None) is None: if flat_global_container.getMetaDataEntry("quality_type", None) is None:
flat_global_container.addMetaDataEntry("quality_type", stack.quality.getMetaDataEntry("quality_type", "normal")) flat_global_container.addMetaDataEntry("quality_type", stack.quality.getMetaDataEntry("quality_type", "normal"))
# Ensure that quality_definition is set. (Can happen if we have empty quality changes).
if parseBool(stack.getMetaDataEntry("has_machine_quality", "False")):
flat_global_container.addMetaDataEntry("quality_definition", stack.getMetaDataEntry("quality_definition"))
serialized = flat_global_container.serialize() serialized = flat_global_container.serialize()
data = {"global_quality": serialized} data = {"global_quality": serialized}