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

@ -351,8 +351,11 @@ class ExtruderManager(QObject):
#The platform adhesion extruder. Not used if using none.
if global_stack.getProperty("adhesion_type", "value") != "none":
used_extruder_stack_ids.add(self.extruderIds[str(global_stack.getProperty("adhesion_extruder_nr", "value"))])
return [container_registry.findContainerStacks(id = stack_id)[0] for stack_id in used_extruder_stack_ids]
try:
return [container_registry.findContainerStacks(id = stack_id)[0] for stack_id in used_extruder_stack_ids]
except IndexError: # One or more of the extruders was not found.
UM.Logger.log("e", "Unable to find one or more of the extruders in %s", used_extruder_stack_ids)
return []
## Removes the container stack and user profile for the extruders for a specific machine.
#

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",

View File

@ -1190,7 +1190,7 @@
"type": "int",
"minimum_value": "0",
"maximum_value_warning": "4",
"maximum_value": "20 - math.log(infill_line_distance) / math.log(2)",
"maximum_value": "(20 - math.log(infill_line_distance) / math.log(2)) if infill_line_distance > 0 else 0",
"enabled": "infill_sparse_density > 0 and infill_pattern != 'cubicsubdiv'",
"settable_per_mesh": true
},

View File

@ -46,7 +46,8 @@ UM.Dialog
left: parent.left;
top: parent.top;
right: parent.right;
bottom: parent.bottom;
bottom: machineNameRow.top;
bottomMargin: UM.Theme.getSize("default_margin").height
}
ListView
@ -65,6 +66,7 @@ UM.Dialog
section.delegate: Button
{
text: section
width: machineList.width
style: ButtonStyle
{
background: Rectangle
@ -102,8 +104,8 @@ UM.Dialog
base.activeCategory = section;
if (machineList.model.getItem(machineList.currentIndex).section != section) {
// Find the first machine from this section
for(var i = 0; i < sortedMachineDefinitionsModel.count; i++) {
var item = sortedMachineDefinitionsModel.getItem(i);
for(var i = 0; i < machineList.model.rowCount(); i++) {
var item = machineList.model.getItem(i);
if (item.section == section) {
machineList.currentIndex = i;
break;
@ -169,21 +171,33 @@ UM.Dialog
}
}
TextField
Row
{
id: machineName;
text: getMachineName()
implicitWidth: UM.Theme.getSize("standard_list_input").width
maximumLength: 40
//validator: Cura.MachineNameValidator { } //TODO: Gives a segfault in PyQt5.6. For now, we must use a signal on text changed.
validator: RegExpValidator
{
regExp: {
machineName.machine_name_validator.machineNameRegex
}
}
property var machine_name_validator: Cura.MachineNameValidator { }
id: machineNameRow
anchors.bottom:parent.bottom
spacing: UM.Theme.getSize("default_margin").width
Label
{
text: catalog.i18nc("@label", "Printer Name:")
anchors.verticalCenter: machineName.verticalCenter
}
TextField
{
id: machineName
text: getMachineName()
implicitWidth: UM.Theme.getSize("standard_list_input").width
maximumLength: 40
//validator: Cura.MachineNameValidator { } //TODO: Gives a segfault in PyQt5.6. For now, we must use a signal on text changed.
validator: RegExpValidator
{
regExp: {
machineName.machine_name_validator.machineNameRegex
}
}
property var machine_name_validator: Cura.MachineNameValidator { }
}
}
Button