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

This commit is contained in:
Jack Ha 2016-12-14 16:53:22 +01:00
commit 2cf181080a
7 changed files with 71 additions and 25 deletions

View file

@ -86,8 +86,10 @@ class SolidView(View):
extruder_id = node.callDecoration("getActiveExtruder")
if extruder_id:
extruder_index = max(0, self._extruders_model.find("id", extruder_id))
material_color = self._extruders_model.getItem(extruder_index)["color"]
try:
material_color = self._extruders_model.getItem(extruder_index)["color"]
except KeyError:
material_color = self._extruders_model.defaultColors[0]
if extruder_index != ExtruderManager.getInstance().activeExtruderIndex:
# Shade objects that are printed with the non-active extruder 25% darker

View file

@ -8,6 +8,7 @@ import io
from UM import Resources
from UM.VersionUpgrade import VersionUpgrade # Superclass of the plugin.
import UM.VersionUpgrade
class VersionUpgrade22to24(VersionUpgrade):
@ -48,9 +49,11 @@ class VersionUpgrade22to24(VersionUpgrade):
# Change the name of variant and insert empty_variant into the stack.
new_container_list = []
for item in container_list:
if not item: # the last item may be an empty string
continue
if item == variant_name:
new_container_list.append(config_name)
new_container_list.append("empty_variant")
new_container_list.append(config_name)
else:
new_container_list.append(item)
@ -62,7 +65,7 @@ class VersionUpgrade22to24(VersionUpgrade):
config.remove_option("general", "containers")
for index in range(len(container_list)):
config.set("containers", index, container_list[index])
config.set("containers", str(index), container_list[index])
output = io.StringIO()
config.write(output)
@ -118,6 +121,26 @@ class VersionUpgrade22to24(VersionUpgrade):
config.write(output)
return [filename], [output.getvalue()]
def upgradePreferences(self, serialised, filename):
config = configparser.ConfigParser(interpolation = None)
config.read_string(serialised)
if not config.has_section("general"):
raise UM.VersionUpgrade.FormatException("No \"general\" section.")
# Make z_seam_x and z_seam_y options visible. In a clean 2.4 they are visible by default.
if config.has_option("general", "visible_settings"):
visible_settings = config.get("general", "visible_settings")
visible_set = set(visible_settings.split(";"))
visible_set.add("z_seam_x")
visible_set.add("z_seam_y")
config.set("general", "visible_settings", ";".join(visible_set))
config.set("general", "version", value="4")
output = io.StringIO()
config.write(output)
return [filename], [output.getvalue()]
def getCfgVersion(self, serialised):
parser = configparser.ConfigParser(interpolation = None)
parser.read_string(serialised)

View file

@ -20,8 +20,10 @@ def getMetaData():
"version_upgrade": {
# From To Upgrade function
("machine_instance", 2): ("machine_stack", 3, upgrade.upgradeMachineInstance),
("extruder_train", 2): ("extruder_train", 3, upgrade.upgradeExtruderTrain)
},
("extruder_train", 2): ("extruder_train", 3, upgrade.upgradeExtruderTrain),
("preferences", 3): ("preferences", 4, upgrade.upgradePreferences)
},
"sources": {
"machine_stack": {
"get_version": upgrade.getCfgVersion,

View file

@ -594,6 +594,8 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer):
# Map XML file product names to internal ids
# TODO: Move this to definition's metadata
__product_id_map = {
"Ultimaker 3": "ultimaker3",
"Ultimaker 3 Extended": "ultimaker3_extended",
"Ultimaker 2": "ultimaker2",
"Ultimaker 2+": "ultimaker2_plus",
"Ultimaker 2 Go": "ultimaker2_go",