Merge branch 'master' of github.com:Ultimaker/Cura into transparent_limit_to_extruder

This commit is contained in:
Arjen Hiemstra 2017-05-17 10:26:48 +02:00
commit 9686df285d
28 changed files with 205 additions and 189 deletions

View file

@ -433,7 +433,8 @@ class BuildVolume(SceneNode):
self._global_container_stack.getProperty("raft_interface_thickness", "value") + self._global_container_stack.getProperty("raft_interface_thickness", "value") +
self._global_container_stack.getProperty("raft_surface_layers", "value") * self._global_container_stack.getProperty("raft_surface_layers", "value") *
self._global_container_stack.getProperty("raft_surface_thickness", "value") + self._global_container_stack.getProperty("raft_surface_thickness", "value") +
self._global_container_stack.getProperty("raft_airgap", "value")) self._global_container_stack.getProperty("raft_airgap", "value") -
self._global_container_stack.getProperty("layer_0_z_overlap", "value"))
# Rounding errors do not matter, we check if raft_thickness has changed at all # Rounding errors do not matter, we check if raft_thickness has changed at all
if old_raft_thickness != self._raft_thickness: if old_raft_thickness != self._raft_thickness:
@ -951,7 +952,7 @@ class BuildVolume(SceneNode):
return max(min(value, max_value), min_value) return max(min(value, max_value), min_value)
_skirt_settings = ["adhesion_type", "skirt_gap", "skirt_line_count", "skirt_brim_line_width", "brim_width", "brim_line_count", "raft_margin", "draft_shield_enabled", "draft_shield_dist"] _skirt_settings = ["adhesion_type", "skirt_gap", "skirt_line_count", "skirt_brim_line_width", "brim_width", "brim_line_count", "raft_margin", "draft_shield_enabled", "draft_shield_dist"]
_raft_settings = ["adhesion_type", "raft_base_thickness", "raft_interface_thickness", "raft_surface_layers", "raft_surface_thickness", "raft_airgap"] _raft_settings = ["adhesion_type", "raft_base_thickness", "raft_interface_thickness", "raft_surface_layers", "raft_surface_thickness", "raft_airgap", "layer_0_z_overlap"]
_extra_z_settings = ["retraction_hop_enabled", "retraction_hop"] _extra_z_settings = ["retraction_hop_enabled", "retraction_hop"]
_prime_settings = ["extruder_prime_pos_x", "extruder_prime_pos_y", "extruder_prime_pos_z", "prime_blob_enable"] _prime_settings = ["extruder_prime_pos_x", "extruder_prime_pos_y", "extruder_prime_pos_z", "prime_blob_enable"]
_tower_settings = ["prime_tower_enable", "prime_tower_size", "prime_tower_position_x", "prime_tower_position_y"] _tower_settings = ["prime_tower_enable", "prime_tower_size", "prime_tower_position_x", "prime_tower_position_y"]

View file

@ -328,8 +328,7 @@ class ConvexHullDecorator(SceneNodeDecorator):
return self.__isDescendant(root, node.getParent()) return self.__isDescendant(root, node.getParent())
_affected_settings = [ _affected_settings = [
"adhesion_type", "raft_base_thickness", "raft_interface_thickness", "raft_surface_layers", "adhesion_type", "raft_margin", "print_sequence",
"raft_surface_thickness", "raft_airgap", "raft_margin", "print_sequence",
"skirt_gap", "skirt_line_count", "skirt_brim_line_width", "skirt_distance", "brim_line_count"] "skirt_gap", "skirt_line_count", "skirt_brim_line_width", "skirt_distance", "brim_line_count"]
## Settings that change the convex hull. ## Settings that change the convex hull.

View file

@ -99,6 +99,11 @@ if not MYPY:
class CuraApplication(QtApplication): class CuraApplication(QtApplication):
# SettingVersion represents the set of settings available in the machine/extruder definitions.
# You need to make sure that this version number needs to be increased if there is any non-backwards-compatible
# changes of the settings.
SettingVersion = 1
class ResourceTypes: class ResourceTypes:
QmlFiles = Resources.UserType + 1 QmlFiles = Resources.UserType + 1
Firmware = Resources.UserType + 2 Firmware = Resources.UserType + 2
@ -169,11 +174,11 @@ class CuraApplication(QtApplication):
UM.VersionUpgradeManager.VersionUpgradeManager.getInstance().setCurrentVersions( UM.VersionUpgradeManager.VersionUpgradeManager.getInstance().setCurrentVersions(
{ {
("quality", InstanceContainer.Version): (self.ResourceTypes.QualityInstanceContainer, "application/x-uranium-instancecontainer"), ("quality_changes", InstanceContainer.Version * 1000000 + self.SettingVersion): (self.ResourceTypes.QualityInstanceContainer, "application/x-uranium-instancecontainer"),
("machine_stack", ContainerStack.Version): (self.ResourceTypes.MachineStack, "application/x-uranium-containerstack"), ("machine_stack", ContainerStack.Version): (self.ResourceTypes.MachineStack, "application/x-uranium-containerstack"),
("extruder_train", ContainerStack.Version): (self.ResourceTypes.ExtruderStack, "application/x-uranium-extruderstack"), ("extruder_train", ContainerStack.Version): (self.ResourceTypes.ExtruderStack, "application/x-uranium-extruderstack"),
("preferences", Preferences.Version): (Resources.Preferences, "application/x-uranium-preferences"), ("preferences", Preferences.Version): (Resources.Preferences, "application/x-uranium-preferences"),
("user", InstanceContainer.Version): (self.ResourceTypes.UserInstanceContainer, "application/x-uranium-instancecontainer") ("user", InstanceContainer.Version * 1000000 + self.SettingVersion): (self.ResourceTypes.UserInstanceContainer, "application/x-uranium-instancecontainer")
} }
) )

View file

@ -918,7 +918,8 @@ class ContainerManager(QObject):
quality_changes.setDefinition(self._container_registry.findContainers(id = "fdmprinter")[0]) quality_changes.setDefinition(self._container_registry.findContainers(id = "fdmprinter")[0])
else: else:
quality_changes.setDefinition(QualityManager.getInstance().getParentMachineDefinition(machine_definition)) quality_changes.setDefinition(QualityManager.getInstance().getParentMachineDefinition(machine_definition))
quality_changes.addMetaDataEntry("setting_version", quality_changes.getDefinition().getMetaDataEntry("setting_version", default = 0)) from cura.CuraApplication import CuraApplication
quality_changes.addMetaDataEntry("setting_version", CuraApplication.SettingVersion)
return quality_changes return quality_changes

View file

@ -22,6 +22,8 @@ from . import GlobalStack
from .ContainerManager import ContainerManager from .ContainerManager import ContainerManager
from .ExtruderManager import ExtruderManager from .ExtruderManager import ExtruderManager
from cura.CuraApplication import CuraApplication
from UM.i18n import i18nCatalog from UM.i18n import i18nCatalog
catalog = i18nCatalog("cura") catalog = i18nCatalog("cura")
@ -43,7 +45,7 @@ class CuraContainerRegistry(ContainerRegistry):
if isinstance(container, InstanceContainer) and type(container) != type(self.getEmptyInstanceContainer()): if isinstance(container, InstanceContainer) and type(container) != type(self.getEmptyInstanceContainer()):
#Check against setting version of the definition. #Check against setting version of the definition.
required_setting_version = int(container.getDefinition().getMetaDataEntry("setting_version", default = 0)) required_setting_version = CuraApplication.SettingVersion
actual_setting_version = int(container.getMetaDataEntry("setting_version", default = 0)) actual_setting_version = int(container.getMetaDataEntry("setting_version", default = 0))
if required_setting_version != actual_setting_version: if required_setting_version != actual_setting_version:
Logger.log("w", "Instance container {container_id} is outdated. Its setting version is {actual_setting_version} but it should be {required_setting_version}.".format(container_id = container.getId(), actual_setting_version = actual_setting_version, required_setting_version = required_setting_version)) Logger.log("w", "Instance container {container_id} is outdated. Its setting version is {actual_setting_version} but it should be {required_setting_version}.".format(container_id = container.getId(), actual_setting_version = actual_setting_version, required_setting_version = required_setting_version))

View file

@ -9,7 +9,6 @@ from UM.Settings.ContainerRegistry import ContainerRegistry
from .GlobalStack import GlobalStack from .GlobalStack import GlobalStack
from .ExtruderStack import ExtruderStack from .ExtruderStack import ExtruderStack
from .CuraContainerStack import CuraContainerStack
from typing import Optional from typing import Optional
@ -76,7 +75,8 @@ class CuraStackBuilder:
user_container = InstanceContainer(new_stack_id + "_user") user_container = InstanceContainer(new_stack_id + "_user")
user_container.addMetaDataEntry("type", "user") user_container.addMetaDataEntry("type", "user")
user_container.addMetaDataEntry("extruder", new_stack_id) user_container.addMetaDataEntry("extruder", new_stack_id)
user_container.addMetaDataEntry("setting_version", machine_definition.getMetaDataEntry("setting_version", default = 0)) from cura.CuraApplication import CuraApplication
user_container.addMetaDataEntry("setting_version", CuraApplication.SettingVersion)
user_container.setDefinition(machine_definition) user_container.setDefinition(machine_definition)
stack.setUserChanges(user_container) stack.setUserChanges(user_container)
@ -125,7 +125,8 @@ class CuraStackBuilder:
user_container = InstanceContainer(new_stack_id + "_user") user_container = InstanceContainer(new_stack_id + "_user")
user_container.addMetaDataEntry("type", "user") user_container.addMetaDataEntry("type", "user")
user_container.addMetaDataEntry("machine", new_stack_id) user_container.addMetaDataEntry("machine", new_stack_id)
user_container.addMetaDataEntry("setting_version", definition.getMetaDataEntry("setting_version", default = 0)) from cura.CuraApplication import CuraApplication
user_container.addMetaDataEntry("setting_version", CuraApplication.SettingVersion)
user_container.setDefinition(definition) user_container.setDefinition(definition)
stack.setUserChanges(user_container) stack.setUserChanges(user_container)

View file

@ -20,6 +20,7 @@ from typing import Optional, List, TYPE_CHECKING, Union
if TYPE_CHECKING: if TYPE_CHECKING:
from cura.Settings.ExtruderStack import ExtruderStack from cura.Settings.ExtruderStack import ExtruderStack
from cura.Settings.GlobalStack import GlobalStack
## Manages all existing extruder stacks. ## Manages all existing extruder stacks.
@ -362,7 +363,8 @@ class ExtruderManager(QObject):
user_profile = InstanceContainer(extruder_stack_id + "_current_settings") # Add an empty user profile. user_profile = InstanceContainer(extruder_stack_id + "_current_settings") # Add an empty user profile.
user_profile.addMetaDataEntry("type", "user") user_profile.addMetaDataEntry("type", "user")
user_profile.addMetaDataEntry("extruder", extruder_stack_id) user_profile.addMetaDataEntry("extruder", extruder_stack_id)
user_profile.addMetaDataEntry("setting_version", machine_definition.getMetaDataEntry("setting_version", default = 0)) from cura.CuraApplication import CuraApplication
user_profile.addMetaDataEntry("setting_version", CuraApplication.SettingVersion)
user_profile.setDefinition(machine_definition) user_profile.setDefinition(machine_definition)
container_registry.addContainer(user_profile) container_registry.addContainer(user_profile)
container_stack.addContainer(user_profile) container_stack.addContainer(user_profile)
@ -458,7 +460,7 @@ class ExtruderManager(QObject):
# \param machine_id The machine to remove the extruders for. # \param machine_id The machine to remove the extruders for.
def removeMachineExtruders(self, machine_id: str): def removeMachineExtruders(self, machine_id: str):
for extruder in self.getMachineExtruders(machine_id): for extruder in self.getMachineExtruders(machine_id):
ContainerRegistry.getInstance().removeContainer(extruder.user.getId()) ContainerRegistry.getInstance().removeContainer(extruder.userChanges.getId())
ContainerRegistry.getInstance().removeContainer(extruder.getId()) ContainerRegistry.getInstance().removeContainer(extruder.getId())
## Returns extruders for a specific machine. ## Returns extruders for a specific machine.

View file

@ -46,6 +46,12 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
self._extruder_stack_suffix = "." + ContainerRegistry.getMimeTypeForContainer(ExtruderStack).preferredSuffix self._extruder_stack_suffix = "." + ContainerRegistry.getMimeTypeForContainer(ExtruderStack).preferredSuffix
self._global_stack_suffix = "." + ContainerRegistry.getMimeTypeForContainer(GlobalStack).preferredSuffix self._global_stack_suffix = "." + ContainerRegistry.getMimeTypeForContainer(GlobalStack).preferredSuffix
# Certain instance container types are ignored because we make the assumption that only we make those types
# of containers. They are:
# - quality
# - variant
self._ignored_instance_container_types = {"quality", "variant"}
self._resolve_strategies = {} self._resolve_strategies = {}
self._id_mapping = {} self._id_mapping = {}
@ -183,6 +189,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
num_user_settings = 0 num_user_settings = 0
quality_changes_conflict = False quality_changes_conflict = False
definition_changes_conflict = False definition_changes_conflict = False
for each_instance_container_file in instance_container_files: for each_instance_container_file in instance_container_files:
container_id = self._stripFileToId(each_instance_container_file) container_id = self._stripFileToId(each_instance_container_file)
instance_container = InstanceContainer(container_id) instance_container = InstanceContainer(container_id)
@ -208,14 +215,12 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
if definition_changes: if definition_changes:
if definition_changes[0] != instance_container: if definition_changes[0] != instance_container:
definition_changes_conflict = True definition_changes_conflict = True
elif container_type == "quality":
# If the quality name is not set (either by quality or changes, set it now)
# Quality changes should always override this (as they are "on top")
if quality_name == "":
quality_name = instance_container.getName()
quality_type = instance_container.getName()
elif container_type == "user": elif container_type == "user":
num_user_settings += len(instance_container._instances) num_user_settings += len(instance_container._instances)
elif container_type in self._ignored_instance_container_types:
# Ignore certain instance container types
Logger.log("w", "Ignoring instance container [%s] with type [%s]", container_id, container_type)
continue
Job.yieldThread() Job.yieldThread()
@ -417,13 +422,29 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
quality_and_definition_changes_instance_containers = [] quality_and_definition_changes_instance_containers = []
for instance_container_file in instance_container_files: for instance_container_file in instance_container_files:
container_id = self._stripFileToId(instance_container_file) container_id = self._stripFileToId(instance_container_file)
serialized = archive.open(instance_container_file).read().decode("utf-8")
# HACK! we ignore the "metadata/type = quality" instance containers!
parser = configparser.ConfigParser()
parser.read_string(serialized)
if not parser.has_option("metadata", "type"):
Logger.log("w", "Cannot find metadata/type in %s, ignoring it", instance_container_file)
continue
if parser.get("metadata", "type") == "quality":
continue
instance_container = InstanceContainer(container_id) instance_container = InstanceContainer(container_id)
# Deserialize InstanceContainer by converting read data from bytes to string # Deserialize InstanceContainer by converting read data from bytes to string
instance_container.deserialize(archive.open(instance_container_file).read().decode("utf-8")) instance_container.deserialize(serialized)
container_type = instance_container.getMetaDataEntry("type") container_type = instance_container.getMetaDataEntry("type")
Job.yieldThread() Job.yieldThread()
if container_type == "user":
if container_type in self._ignored_instance_container_types:
# Ignore certain instance container types
Logger.log("w", "Ignoring instance container [%s] with type [%s]", container_id, container_type)
continue
elif container_type == "user":
# Check if quality changes already exists. # Check if quality changes already exists.
user_containers = self._container_registry.findInstanceContainers(id = container_id) user_containers = self._container_registry.findInstanceContainers(id = container_id)
if not user_containers: if not user_containers:
@ -571,8 +592,27 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
if container_stacks: if container_stacks:
# this container stack already exists, try to resolve # this container stack already exists, try to resolve
stack = container_stacks[0] stack = container_stacks[0]
if self._resolve_strategies["machine"] == "override": if self._resolve_strategies["machine"] == "override":
pass # do nothing # NOTE: This is the same code as those in the lower part
global_stacks = self._container_registry.findContainerStacks(id = global_stack_id_original)
# deserialize new extruder stack over the current ones
if global_stacks:
old_extruder_stack_id = global_stacks[0].extruders[index].getId()
# HACK delete file
self._container_registry._deleteFiles(global_stacks[0].extruders[index])
global_stacks[0].extruders[index].deserialize(archive.open(extruder_stack_file).read().decode("utf-8"))
# HACK
global_stacks[0]._extruders = global_stacks[0]._extruders[:2]
# HACK update cache
del self._container_registry._id_container_cache[old_extruder_stack_id]
new_extruder_stack_id = global_stacks[0].extruders[index].getId()
self._container_registry._id_container_cache[new_extruder_stack_id] = global_stacks[0].extruders[index]
stack = global_stacks[0].extruders[index]
else:
Logger.log("w", "Could not find global stack, while I expected it: %s" % global_stack_id_original)
elif self._resolve_strategies["machine"] == "new": elif self._resolve_strategies["machine"] == "new":
# create a new extruder stack from this one # create a new extruder stack from this one
new_id = self.getNewId(container_id) new_id = self.getNewId(container_id)

View file

@ -7,6 +7,7 @@ from cura.Settings.ExtruderManager import ExtruderManager
import zipfile import zipfile
from io import StringIO from io import StringIO
import copy import copy
import configparser
class ThreeMFWorkspaceWriter(WorkspaceWriter): class ThreeMFWorkspaceWriter(WorkspaceWriter):
@ -48,6 +49,16 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter):
Preferences.getInstance().writeToFile(preferences_string) Preferences.getInstance().writeToFile(preferences_string)
archive.writestr(preferences_file, preferences_string.getvalue()) archive.writestr(preferences_file, preferences_string.getvalue())
# Save Cura version
version_file = zipfile.ZipInfo("Cura/version.ini")
version_config_parser = configparser.ConfigParser()
version_config_parser.add_section("versions")
version_config_parser.set("versions", "cura_version", Application.getStaticVersion())
version_file_string = StringIO()
version_config_parser.write(version_file_string)
archive.writestr(version_file, version_file_string.getvalue())
# Close the archive & reset states. # Close the archive & reset states.
archive.close() archive.close()
mesh_writer.setStoreArchive(False) mesh_writer.setStoreArchive(False)

View file

@ -14,7 +14,7 @@ from UM.Settings.DefinitionContainer import DefinitionContainer
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
from UM.Logger import Logger from UM.Logger import Logger
from cura.Settings.CuraContainerRegistry import CuraContainerRegistry from cura.CuraApplication import CuraApplication
from cura.Settings.ExtruderManager import ExtruderManager from cura.Settings.ExtruderManager import ExtruderManager
import UM.i18n import UM.i18n
@ -99,7 +99,7 @@ class MachineSettingsAction(MachineAction):
definition = container_stack.getBottom() definition = container_stack.getBottom()
definition_changes_container.setDefinition(definition) definition_changes_container.setDefinition(definition)
definition_changes_container.addMetaDataEntry("type", "definition_changes") definition_changes_container.addMetaDataEntry("type", "definition_changes")
definition_changes_container.addMetaDataEntry("setting_version", definition.getMetaDataEntry("setting_version", default = 0)) definition_changes_container.addMetaDataEntry("setting_version", CuraApplication.SettingVersion)
self._container_registry.addContainer(definition_changes_container) self._container_registry.addContainer(definition_changes_container)
container_stack.definitionChanges = definition_changes_container container_stack.definitionChanges = definition_changes_container

View file

@ -11,7 +11,7 @@ from UM.Application import Application
catalog = i18nCatalog("cura") catalog = i18nCatalog("cura")
import UM.Settings.InstanceContainer import UM.Settings.InstanceContainer
from cura.CuraApplication import CuraApplication
## The Ultimaker Original can have a few revisions & upgrades. This action helps with selecting them, so they are added ## The Ultimaker Original can have a few revisions & upgrades. This action helps with selecting them, so they are added
# as a variant. # as a variant.
@ -49,7 +49,7 @@ class UMOUpgradeSelection(MachineAction):
definition = global_container_stack.getBottom() definition = global_container_stack.getBottom()
definition_changes_container.setDefinition(definition) definition_changes_container.setDefinition(definition)
definition_changes_container.addMetaDataEntry("type", "definition_changes") definition_changes_container.addMetaDataEntry("type", "definition_changes")
definition_changes_container.addMetaDataEntry("setting_version", definition.getMetaDataEntry("setting_version", default = 0)) definition_changes_container.addMetaDataEntry("setting_version", CuraApplication.SettingVersion)
UM.Settings.ContainerRegistry.ContainerRegistry.getInstance().addContainer(definition_changes_container) UM.Settings.ContainerRegistry.ContainerRegistry.getInstance().addContainer(definition_changes_container)
# Insert definition_changes between the definition and the variant # Insert definition_changes between the definition and the variant

View file

@ -142,6 +142,16 @@ class VersionUpgrade22to24(VersionUpgrade):
config.write(output) config.write(output)
return [filename], [output.getvalue()] return [filename], [output.getvalue()]
def upgradeQuality(self, serialised, filename):
config = configparser.ConfigParser(interpolation = None)
config.read_string(serialised) # Read the input string as config file.
config.set("metadata", "type", "quality_changes") # Update metadata/type to quality_changes
config.set("general", "version", "2") # Just bump the version number. That is all we need for now.
output = io.StringIO()
config.write(output)
return [filename], [output.getvalue()]
def getCfgVersion(self, serialised): def getCfgVersion(self, serialised):
parser = configparser.ConfigParser(interpolation = None) parser = configparser.ConfigParser(interpolation = None)
parser.read_string(serialised) parser.read_string(serialised)

View file

@ -21,9 +21,9 @@ def getMetaData():
# From To Upgrade function # From To Upgrade function
("machine_instance", 2000000): ("machine_stack", 3000000, upgrade.upgradeMachineInstance), ("machine_instance", 2000000): ("machine_stack", 3000000, upgrade.upgradeMachineInstance),
("extruder_train", 2000000): ("extruder_train", 3000000, upgrade.upgradeExtruderTrain), ("extruder_train", 2000000): ("extruder_train", 3000000, upgrade.upgradeExtruderTrain),
("preferences", 3000000): ("preferences", 4000000, upgrade.upgradePreferences) ("preferences", 3000000): ("preferences", 4000000, upgrade.upgradePreferences),
("quality", 2000000): ("quality_changes", 2000000, upgrade.upgradeQuality),
}, },
"sources": { "sources": {
"machine_stack": { "machine_stack": {
"get_version": upgrade.getCfgVersion, "get_version": upgrade.getCfgVersion,

View file

@ -5,6 +5,7 @@ import configparser #To parse the files we need to upgrade and write the new fil
import io #To serialise configparser output to a string. import io #To serialise configparser output to a string.
from UM.VersionUpgrade import VersionUpgrade from UM.VersionUpgrade import VersionUpgrade
from cura.CuraApplication import CuraApplication
_removed_settings = { #Settings that were removed in 2.5. _removed_settings = { #Settings that were removed in 2.5.
"start_layers_at_same_position", "start_layers_at_same_position",
@ -86,11 +87,17 @@ class VersionUpgrade25to26(VersionUpgrade):
parser["values"][replacement] = parser["values"][replaced_setting] #Copy to replacement before removing the original! parser["values"][replacement] = parser["values"][replaced_setting] #Copy to replacement before removing the original!
del replaced_setting del replaced_setting
#Change the version number in the file. for each_section in ("general", "metadata"):
if parser.has_section("general"): if not parser.has_section(each_section):
parser["general"]["setting_version"] = "1" parser.add_section(each_section)
# Change the version number in the file.
parser["metadata"]["setting_version"] = str(CuraApplication.SettingVersion)
# Update version
parser["general"]["version"] = "2"
#Re-serialise the file. #Re-serialise the file.
output = io.StringIO() output = io.StringIO()
parser.write(output) parser.write(output)
return [filename], [output.getvalue()] return [filename], [output.getvalue()]

View file

@ -18,14 +18,16 @@ def getMetaData():
"api": 3 "api": 3
}, },
"version_upgrade": { "version_upgrade": {
# From To Upgrade function # From To Upgrade function
("preferences", 4000000): ("preferences", 4000001, upgrade.upgradePreferences), ("preferences", 4000000): ("preferences", 4000001, upgrade.upgradePreferences),
("quality", 2000000): ("quality", 2000001, upgrade.upgradeInstanceContainer), # NOTE: All the instance containers share the same general/version, so we have to update all of them
("variant", 2000000): ("variant", 2000001, upgrade.upgradeInstanceContainer), #We can re-use upgradeContainerStack since there is nothing specific to quality, variant or user profiles being changed. # if any is updated.
("user", 2000000): ("user", 2000001, upgrade.upgradeInstanceContainer) ("quality_changes", 2000000): ("quality_changes", 2000001, upgrade.upgradeInstanceContainer),
("user", 2000000): ("user", 2000001, upgrade.upgradeInstanceContainer),
("quality", 2000000): ("quality", 2000001, upgrade.upgradeInstanceContainer),
}, },
"sources": { "sources": {
"quality": { "quality_changes": {
"get_version": upgrade.getCfgVersion, "get_version": upgrade.getCfgVersion,
"location": {"./quality"} "location": {"./quality"}
}, },
@ -36,7 +38,7 @@ def getMetaData():
"user": { "user": {
"get_version": upgrade.getCfgVersion, "get_version": upgrade.getCfgVersion,
"location": {"./user"} "location": {"./user"}
} },
} }
} }

View file

@ -2555,7 +2555,6 @@
"default_value": 20, "default_value": 20,
"value": "jerk_support_interface", "value": "jerk_support_interface",
"minimum_value": "0.1", "minimum_value": "0.1",
"minimum_value_warning": "5",
"maximum_value_warning": "50", "maximum_value_warning": "50",
"enabled": "resolveOrValue('jerk_enabled') and extruderValue(support_roof_extruder_nr, 'support_roof_enable') and support_enable", "enabled": "resolveOrValue('jerk_enabled') and extruderValue(support_roof_extruder_nr, 'support_roof_enable') and support_enable",
"limit_to_extruder": "support_roof_extruder_nr", "limit_to_extruder": "support_roof_extruder_nr",
@ -2571,7 +2570,6 @@
"default_value": 20, "default_value": 20,
"value": "jerk_support_interface", "value": "jerk_support_interface",
"minimum_value": "0.1", "minimum_value": "0.1",
"minimum_value_warning": "5",
"maximum_value_warning": "50", "maximum_value_warning": "50",
"enabled": "resolveOrValue('jerk_enabled') and extruderValue(support_bottom_extruder_nr, 'support_bottom_enable') and support_enable", "enabled": "resolveOrValue('jerk_enabled') and extruderValue(support_bottom_extruder_nr, 'support_bottom_enable') and support_enable",
"limit_to_extruder": "support_bottom_extruder_nr", "limit_to_extruder": "support_bottom_extruder_nr",
@ -3624,7 +3622,7 @@
"none": "None" "none": "None"
}, },
"default_value": "brim", "default_value": "brim",
"limit_to_extruder": "adhesion_extruder_nr", "resolve": "extruderValue(adhesion_extruder_nr, 'adhesion_type')",
"settable_per_mesh": false, "settable_per_mesh": false,
"settable_per_extruder": false "settable_per_extruder": false
}, },

View file

@ -15,22 +15,19 @@ SettingItem
contents: ComboBox contents: ComboBox
{ {
id: control id: control
anchors.fill: parent
model: Cura.ExtrudersModel model: Cura.ExtrudersModel { }
{
id: extruders_model
onModelChanged: control.color = extruders_model.getItem(control.currentIndex).color
}
property string color:
{
var model_color = extruders_model.getItem(control.currentIndex).color;
return (model_color) ? model_color : "";
}
textRole: "name" textRole: "name"
anchors.fill: parent onActivated:
onCurrentIndexChanged: updateCurrentColor(); {
forceActiveFocus();
propertyProvider.setPropertyValue("value", model.getItem(index).index);
}
currentIndex: propertyProvider.properties.value
MouseArea MouseArea
{ {
@ -59,7 +56,19 @@ SettingItem
} }
} }
border.width: UM.Theme.getSize("default_lining").width border.width: UM.Theme.getSize("default_lining").width
border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : control.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border") border.color:
{
if(!enabled)
{
return UM.Theme.getColor("setting_control_disabled_border");
}
if(control.hovered || base.activeFocus)
{
UM.Theme.getColor("setting_control_border_highlight")
}
return UM.Theme.getColor("setting_control_border")
}
} }
label: Item label: Item
{ {
@ -68,35 +77,36 @@ SettingItem
id: swatch id: swatch
height: UM.Theme.getSize("setting_control").height / 2 height: UM.Theme.getSize("setting_control").height / 2
width: height width: height
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_lining").width
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
color: control.color
border.width: UM.Theme.getSize("default_lining").width border.width: UM.Theme.getSize("default_lining").width
border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : UM.Theme.getColor("setting_control_border") border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border")
color: control.currentText != "" ? control.model.getItem(control.currentIndex).color : ""
} }
Label Label
{ {
anchors.left: swatch.right anchors
anchors.leftMargin: UM.Theme.getSize("default_lining").width {
anchors.right: downArrow.left left: swatch.right;
anchors.rightMargin: UM.Theme.getSize("default_lining").width right: arrow.left;
anchors.verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
margins: UM.Theme.getSize("default_lining").width
}
width: parent.width - swatch.width;
text: control.currentText text: control.currentText
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text") color: enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
elide: Text.ElideRight elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
UM.RecolorImage UM.RecolorImage
{ {
id: downArrow id: arrow
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
source: UM.Theme.getIcon("arrow_bottom") source: UM.Theme.getIcon("arrow_bottom")
@ -109,57 +119,5 @@ SettingItem
} }
} }
} }
onActivated:
{
forceActiveFocus();
propertyProvider.setPropertyValue("value", extruders_model.getItem(index).index);
control.color = extruders_model.getItem(index).color;
}
onModelChanged: updateCurrentIndex();
Binding
{
target: control
property: "currentIndex"
value:
{
for(var i = 0; i < extruders_model.rowCount(); ++i)
{
if(extruders_model.getItem(i).index == propertyProvider.properties.value)
{
return i;
}
}
return -1;
}
}
// In some cases we want to update the current color without updating the currentIndex, so it's a seperate function.
function updateCurrentColor()
{
for(var i = 0; i < extruders_model.rowCount(); ++i)
{
if(extruders_model.getItem(i).index == currentIndex)
{
control.color = extruders_model.getItem(i).color;
return;
}
}
}
function updateCurrentIndex()
{
for(var i = 0; i < extruders_model.rowCount(); ++i)
{
if(extruders_model.getItem(i).index == propertyProvider.properties.value)
{
control.currentIndex = i;
return;
}
}
currentIndex = -1;
}
} }
} }

View file

@ -1,14 +0,0 @@
[general]
version = 2
name = Not Supported
definition = ultimaker3
[metadata]
weight = 0
type = quality
quality_type = normal
material = generic_tpu_ultimaker3_AA_0.8
supported = False
setting_version = 1
[values]

View file

@ -1,14 +0,0 @@
[general]
version = 2
name = Not Supported
definition = ultimaker3
[metadata]
weight = 0
type = quality
quality_type = superdraft
material = generic_tpu_ultimaker3_AA_0.8
supported = False
setting_version = 1
[values]

View file

@ -13,10 +13,6 @@ setting_version = 1
[values] [values]
material_print_temperature = =default_material_print_temperature + 10 material_print_temperature = =default_material_print_temperature + 10
material_standby_temperature = 100 material_standby_temperature = 100
prime_tower_enable = False
skin_overlap = 20 skin_overlap = 20
support_interface_height = 0.8 support_interface_height = 0.8
prime_tower_enable = False
speed_support_interface = =math.ceil(speed_support * 20 / 25)
jerk_support_interface = =math.ceil(jerk_support * 1 / 5)
acceleration_support_interface = =math.ceil(acceleration_support * 100 / 500 )
support_xy_distance = =round(line_width * 1.5, 2)

View file

@ -13,10 +13,6 @@ setting_version = 1
[values] [values]
material_print_temperature = =default_material_print_temperature + 5 material_print_temperature = =default_material_print_temperature + 5
material_standby_temperature = 100 material_standby_temperature = 100
prime_tower_enable = False
skin_overlap = 15 skin_overlap = 15
support_interface_height = 0.8 support_interface_height = 0.8
prime_tower_enable = False
speed_support_interface = =math.ceil(speed_support * 20 / 25)
jerk_support_interface = =math.ceil(jerk_support * 1 / 5)
acceleration_support_interface = =math.ceil(acceleration_support * 100 / 500 )
support_xy_distance = =round(line_width * 1.5, 2)

View file

@ -11,11 +11,7 @@ material = generic_pva_ultimaker3_BB_0.4
setting_version = 1 setting_version = 1
[values] [values]
support_infill_rate = 25
support_interface_height = 0.8
material_standby_temperature = 100 material_standby_temperature = 100
prime_tower_enable = False prime_tower_enable = False
speed_support_interface = =math.ceil(speed_support * 20 / 25) support_infill_rate = 25
jerk_support_interface = =math.ceil(jerk_support * 1 / 5) support_interface_height = 0.8
acceleration_support_interface = =math.ceil(acceleration_support * 100 / 500 )
support_xy_distance = =round(line_width * 1.5, 2)

View file

@ -11,11 +11,7 @@ material = generic_pva_ultimaker3_BB_0.4
setting_version = 1 setting_version = 1
[values] [values]
support_infill_rate = 25
support_interface_height = 0.8
material_standby_temperature = 100 material_standby_temperature = 100
prime_tower_enable = False prime_tower_enable = False
speed_support_interface = =math.ceil(speed_support * 20 / 25) support_infill_rate = 25
jerk_support_interface = =math.ceil(jerk_support * 1 / 5) support_interface_height = 0.8
acceleration_support_interface = =math.ceil(acceleration_support * 100 / 500 )
support_xy_distance = =round(line_width * 1.5, 2)

View file

@ -75,7 +75,7 @@ support_line_width = =round(line_width * 0.4 / 0.35, 2)
support_offset = 1.5 support_offset = 1.5
support_pattern = triangles support_pattern = triangles
support_use_towers = False support_use_towers = False
support_xy_distance = =wall_line_width_0 / 2 support_xy_distance = =round(wall_line_width_0 * 0.75, 2)
support_xy_distance_overhang = =wall_line_width_0 / 4 support_xy_distance_overhang = =wall_line_width_0 / 4
support_z_distance = 0 support_z_distance = 0
switch_extruder_prime_speed = 15 switch_extruder_prime_speed = 15

View file

@ -36,5 +36,5 @@ support_interface_skip_height = =layer_height
support_join_distance = 3 support_join_distance = 3
support_line_width = =round(line_width * 0.4 / 0.35, 2) support_line_width = =round(line_width * 0.4 / 0.35, 2)
support_offset = 3 support_offset = 3
support_xy_distance = =wall_line_width_0 * 3 support_xy_distance = =round(wall_line_width_0 * 0.75, 2)
support_xy_distance_overhang = =wall_line_width_0 / 2 support_xy_distance_overhang = =wall_line_width_0 / 2

View file

@ -11,7 +11,9 @@ setting_version = 1
[values] [values]
acceleration_enabled = True acceleration_enabled = True
acceleration_print = 4000 acceleration_print = 4000
acceleration_support_interface = =math.ceil(acceleration_topbottom * 100 / 500) acceleration_support = =math.ceil(acceleration_print * 2000 / 4000)
acceleration_support_interface = =math.ceil(acceleration_support * 1500 / 2000)
acceleration_support_bottom = =math.ceil(acceleration_support_interface * 100 / 1500)
brim_width = 3 brim_width = 3
cool_fan_speed = 50 cool_fan_speed = 50
cool_min_speed = 5 cool_min_speed = 5
@ -21,7 +23,9 @@ infill_pattern = triangles
infill_wipe_dist = 0 infill_wipe_dist = 0
jerk_enabled = True jerk_enabled = True
jerk_print = 25 jerk_print = 25
jerk_support_interface = =math.ceil(jerk_topbottom * 1 / 5) jerk_support = =math.ceil(jerk_print * 15 / 25)
jerk_support_interface = =math.ceil(jerk_support * 10 / 15)
jerk_support_bottom = =math.ceil(jerk_support_interface * 1 / 10)
layer_height = 0.2 layer_height = 0.2
machine_min_cool_heat_time_window = 15 machine_min_cool_heat_time_window = 15
machine_nozzle_heat_up_speed = 1.5 machine_nozzle_heat_up_speed = 1.5
@ -54,20 +58,24 @@ retraction_prime_speed = 15
skin_overlap = 5 skin_overlap = 5
speed_layer_0 = 20 speed_layer_0 = 20
speed_print = 35 speed_print = 35
speed_support_interface = =math.ceil(speed_topbottom * 15 / 20) speed_support = =math.ceil(speed_print * 25 / 35)
speed_support_interface = =math.ceil(speed_support * 20 / 25)
speed_support_bottom = =math.ceil(speed_support_interface * 10 / 20)
speed_wall_0 = =math.ceil(speed_wall * 25 / 30) speed_wall_0 = =math.ceil(speed_wall * 25 / 30)
support_angle = 60 support_angle = 60
support_bottom_height = =layer_height * 2 support_bottom_height = =layer_height * 2
support_bottom_pattern = zigzag
support_bottom_stair_step_height = =layer_height support_bottom_stair_step_height = =layer_height
support_infill_rate = 25 support_infill_rate = 25
support_interface_enable = True support_interface_enable = True
support_interface_height = =layer_height * 5 support_interface_height = =layer_height * 5
support_interface_skip_height = =layer_height
support_join_distance = 3 support_join_distance = 3
support_line_width = =round(line_width * 0.4 / 0.35, 2) support_line_width = =round(line_width * 0.4 / 0.35, 2)
support_offset = 1.5 support_offset = 1.5
support_pattern = triangles support_pattern = triangles
support_use_towers = False support_use_towers = False
support_xy_distance = =wall_line_width_0 / 2 support_xy_distance = =round(wall_line_width_0 * 0.75, 2)
support_xy_distance_overhang = =wall_line_width_0 / 4 support_xy_distance_overhang = =wall_line_width_0 / 4
support_z_distance = 0 support_z_distance = 0
switch_extruder_prime_speed = 15 switch_extruder_prime_speed = 15

View file

@ -9,20 +9,32 @@ type = variant
setting_version = 1 setting_version = 1
[values] [values]
cool_fan_speed_max = 100 acceleration_support = =math.ceil(acceleration_print * 2000 / 4000)
acceleration_support_interface = =math.ceil(acceleration_support * 1500 / 2000)
acceleration_support_bottom = =math.ceil(acceleration_support_interface * 100 / 1500)
cool_fan_speed_max = =cool_fan_speed
jerk_support = =math.ceil(jerk_print * 15 / 25)
jerk_support_interface = =math.ceil(jerk_support * 10 / 15)
jerk_support_bottom = =math.ceil(jerk_support_interface * 1 / 10)
machine_nozzle_heat_up_speed = 1.5 machine_nozzle_heat_up_speed = 1.5
machine_nozzle_size = 0.4
material_bed_temperature = 60
material_print_temperature = 215 material_print_temperature = 215
raft_acceleration = =acceleration_layer_0 raft_base_speed = 20
raft_jerk = =jerk_layer_0 raft_interface_speed = 20
raft_speed = 25
retraction_extrusion_window = =retraction_amount retraction_extrusion_window = =retraction_amount
speed_layer_0 = 20
speed_support = =math.ceil(speed_print * 25 / 35)
speed_support_interface = =math.ceil(speed_support * 20 / 25)
speed_support_bottom = =math.ceil(speed_support_interface * 10 / 20)
speed_wall_0 = =math.ceil(speed_wall * 25 / 30) speed_wall_0 = =math.ceil(speed_wall * 25 / 30)
support_bottom_height = =layer_height * 2 support_bottom_height = =layer_height * 2
support_bottom_pattern = zigzag
support_bottom_stair_step_height = =layer_height support_bottom_stair_step_height = =layer_height
support_infill_rate = 25
support_interface_enable = True support_interface_enable = True
support_interface_skip_height = =layer_height
support_join_distance = 3
support_line_width = =round(line_width * 0.4 / 0.35, 2) support_line_width = =round(line_width * 0.4 / 0.35, 2)
support_pattern = triangles support_offset = 3
support_use_towers = False support_xy_distance = =round(wall_line_width_0 * 0.75, 2)
support_xy_distance = =wall_line_width_0 * 3
support_xy_distance_overhang = =wall_line_width_0 / 2 support_xy_distance_overhang = =wall_line_width_0 / 2

View file

@ -68,11 +68,12 @@ def test_addContainerGlobalStack(container_registry, definition_container):
assert type(mock_super_add_container.call_args_list[0][0][0]) == GlobalStack assert type(mock_super_add_container.call_args_list[0][0][0]) == GlobalStack
def test_addContainerGoodSettingVersion(container_registry, definition_container): def test_addContainerGoodSettingVersion(container_registry, definition_container):
definition_container.getMetaData()["setting_version"] = 3 from cura.CuraApplication import CuraApplication
definition_container.getMetaData()["setting_version"] = CuraApplication.SettingVersion
container_registry.addContainer(definition_container) container_registry.addContainer(definition_container)
instance = UM.Settings.InstanceContainer.InstanceContainer(container_id = "Test Instance") instance = UM.Settings.InstanceContainer.InstanceContainer(container_id = "Test Instance")
instance.addMetaDataEntry("setting_version", 3) instance.addMetaDataEntry("setting_version", CuraApplication.SettingVersion)
instance.setDefinition(definition_container) instance.setDefinition(definition_container)
mock_super_add_container = unittest.mock.MagicMock() #Take the role of the Uranium-ContainerRegistry where the resulting containers get registered. mock_super_add_container = unittest.mock.MagicMock() #Take the role of the Uranium-ContainerRegistry where the resulting containers get registered.
@ -82,7 +83,8 @@ def test_addContainerGoodSettingVersion(container_registry, definition_container
mock_super_add_container.assert_called_once_with(instance) #The instance must have been registered now. mock_super_add_container.assert_called_once_with(instance) #The instance must have been registered now.
def test_addContainerNoSettingVersion(container_registry, definition_container): def test_addContainerNoSettingVersion(container_registry, definition_container):
definition_container.getMetaData()["setting_version"] = 3 from cura.CuraApplication import CuraApplication
definition_container.getMetaData()["setting_version"] = CuraApplication.SettingVersion
container_registry.addContainer(definition_container) container_registry.addContainer(definition_container)
instance = UM.Settings.InstanceContainer.InstanceContainer(container_id = "Test Instance") instance = UM.Settings.InstanceContainer.InstanceContainer(container_id = "Test Instance")
@ -96,7 +98,8 @@ def test_addContainerNoSettingVersion(container_registry, definition_container):
mock_super_add_container.assert_not_called() #Should not get passed on to UM.Settings.ContainerRegistry.addContainer, because the setting_version is interpreted as 0! mock_super_add_container.assert_not_called() #Should not get passed on to UM.Settings.ContainerRegistry.addContainer, because the setting_version is interpreted as 0!
def test_addContainerBadSettingVersion(container_registry, definition_container): def test_addContainerBadSettingVersion(container_registry, definition_container):
definition_container.getMetaData()["setting_version"] = 3 from cura.CuraApplication import CuraApplication
definition_container.getMetaData()["setting_version"] = CuraApplication.SettingVersion
container_registry.addContainer(definition_container) container_registry.addContainer(definition_container)
instance = UM.Settings.InstanceContainer.InstanceContainer(container_id = "Test Instance") instance = UM.Settings.InstanceContainer.InstanceContainer(container_id = "Test Instance")