mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-13 20:45:57 +08:00
Merge branch 'master' of github.com:Ultimaker/Cura
This commit is contained in:
commit
2cf181080a
@ -351,8 +351,11 @@ class ExtruderManager(QObject):
|
|||||||
#The platform adhesion extruder. Not used if using none.
|
#The platform adhesion extruder. Not used if using none.
|
||||||
if global_stack.getProperty("adhesion_type", "value") != "none":
|
if global_stack.getProperty("adhesion_type", "value") != "none":
|
||||||
used_extruder_stack_ids.add(self.extruderIds[str(global_stack.getProperty("adhesion_extruder_nr", "value"))])
|
used_extruder_stack_ids.add(self.extruderIds[str(global_stack.getProperty("adhesion_extruder_nr", "value"))])
|
||||||
|
try:
|
||||||
return [container_registry.findContainerStacks(id = stack_id)[0] for stack_id in used_extruder_stack_ids]
|
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.
|
## Removes the container stack and user profile for the extruders for a specific machine.
|
||||||
#
|
#
|
||||||
|
@ -86,8 +86,10 @@ class SolidView(View):
|
|||||||
extruder_id = node.callDecoration("getActiveExtruder")
|
extruder_id = node.callDecoration("getActiveExtruder")
|
||||||
if extruder_id:
|
if extruder_id:
|
||||||
extruder_index = max(0, self._extruders_model.find("id", extruder_id))
|
extruder_index = max(0, self._extruders_model.find("id", extruder_id))
|
||||||
|
try:
|
||||||
material_color = self._extruders_model.getItem(extruder_index)["color"]
|
material_color = self._extruders_model.getItem(extruder_index)["color"]
|
||||||
|
except KeyError:
|
||||||
|
material_color = self._extruders_model.defaultColors[0]
|
||||||
|
|
||||||
if extruder_index != ExtruderManager.getInstance().activeExtruderIndex:
|
if extruder_index != ExtruderManager.getInstance().activeExtruderIndex:
|
||||||
# Shade objects that are printed with the non-active extruder 25% darker
|
# Shade objects that are printed with the non-active extruder 25% darker
|
||||||
|
@ -8,6 +8,7 @@ import io
|
|||||||
|
|
||||||
from UM import Resources
|
from UM import Resources
|
||||||
from UM.VersionUpgrade import VersionUpgrade # Superclass of the plugin.
|
from UM.VersionUpgrade import VersionUpgrade # Superclass of the plugin.
|
||||||
|
import UM.VersionUpgrade
|
||||||
|
|
||||||
class VersionUpgrade22to24(VersionUpgrade):
|
class VersionUpgrade22to24(VersionUpgrade):
|
||||||
|
|
||||||
@ -48,9 +49,11 @@ class VersionUpgrade22to24(VersionUpgrade):
|
|||||||
# Change the name of variant and insert empty_variant into the stack.
|
# Change the name of variant and insert empty_variant into the stack.
|
||||||
new_container_list = []
|
new_container_list = []
|
||||||
for item in container_list:
|
for item in container_list:
|
||||||
|
if not item: # the last item may be an empty string
|
||||||
|
continue
|
||||||
if item == variant_name:
|
if item == variant_name:
|
||||||
new_container_list.append(config_name)
|
|
||||||
new_container_list.append("empty_variant")
|
new_container_list.append("empty_variant")
|
||||||
|
new_container_list.append(config_name)
|
||||||
else:
|
else:
|
||||||
new_container_list.append(item)
|
new_container_list.append(item)
|
||||||
|
|
||||||
@ -62,7 +65,7 @@ class VersionUpgrade22to24(VersionUpgrade):
|
|||||||
config.remove_option("general", "containers")
|
config.remove_option("general", "containers")
|
||||||
|
|
||||||
for index in range(len(container_list)):
|
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()
|
output = io.StringIO()
|
||||||
config.write(output)
|
config.write(output)
|
||||||
@ -118,6 +121,26 @@ class VersionUpgrade22to24(VersionUpgrade):
|
|||||||
config.write(output)
|
config.write(output)
|
||||||
return [filename], [output.getvalue()]
|
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):
|
def getCfgVersion(self, serialised):
|
||||||
parser = configparser.ConfigParser(interpolation = None)
|
parser = configparser.ConfigParser(interpolation = None)
|
||||||
parser.read_string(serialised)
|
parser.read_string(serialised)
|
||||||
|
@ -20,7 +20,9 @@ def getMetaData():
|
|||||||
"version_upgrade": {
|
"version_upgrade": {
|
||||||
# From To Upgrade function
|
# From To Upgrade function
|
||||||
("machine_instance", 2): ("machine_stack", 3, upgrade.upgradeMachineInstance),
|
("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": {
|
"sources": {
|
||||||
"machine_stack": {
|
"machine_stack": {
|
||||||
|
@ -594,6 +594,8 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer):
|
|||||||
# Map XML file product names to internal ids
|
# Map XML file product names to internal ids
|
||||||
# TODO: Move this to definition's metadata
|
# TODO: Move this to definition's metadata
|
||||||
__product_id_map = {
|
__product_id_map = {
|
||||||
|
"Ultimaker 3": "ultimaker3",
|
||||||
|
"Ultimaker 3 Extended": "ultimaker3_extended",
|
||||||
"Ultimaker 2": "ultimaker2",
|
"Ultimaker 2": "ultimaker2",
|
||||||
"Ultimaker 2+": "ultimaker2_plus",
|
"Ultimaker 2+": "ultimaker2_plus",
|
||||||
"Ultimaker 2 Go": "ultimaker2_go",
|
"Ultimaker 2 Go": "ultimaker2_go",
|
||||||
|
@ -1190,7 +1190,7 @@
|
|||||||
"type": "int",
|
"type": "int",
|
||||||
"minimum_value": "0",
|
"minimum_value": "0",
|
||||||
"maximum_value_warning": "4",
|
"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'",
|
"enabled": "infill_sparse_density > 0 and infill_pattern != 'cubicsubdiv'",
|
||||||
"settable_per_mesh": true
|
"settable_per_mesh": true
|
||||||
},
|
},
|
||||||
|
@ -46,7 +46,8 @@ UM.Dialog
|
|||||||
left: parent.left;
|
left: parent.left;
|
||||||
top: parent.top;
|
top: parent.top;
|
||||||
right: parent.right;
|
right: parent.right;
|
||||||
bottom: parent.bottom;
|
bottom: machineNameRow.top;
|
||||||
|
bottomMargin: UM.Theme.getSize("default_margin").height
|
||||||
}
|
}
|
||||||
|
|
||||||
ListView
|
ListView
|
||||||
@ -65,6 +66,7 @@ UM.Dialog
|
|||||||
section.delegate: Button
|
section.delegate: Button
|
||||||
{
|
{
|
||||||
text: section
|
text: section
|
||||||
|
width: machineList.width
|
||||||
style: ButtonStyle
|
style: ButtonStyle
|
||||||
{
|
{
|
||||||
background: Rectangle
|
background: Rectangle
|
||||||
@ -102,8 +104,8 @@ UM.Dialog
|
|||||||
base.activeCategory = section;
|
base.activeCategory = section;
|
||||||
if (machineList.model.getItem(machineList.currentIndex).section != section) {
|
if (machineList.model.getItem(machineList.currentIndex).section != section) {
|
||||||
// Find the first machine from this section
|
// Find the first machine from this section
|
||||||
for(var i = 0; i < sortedMachineDefinitionsModel.count; i++) {
|
for(var i = 0; i < machineList.model.rowCount(); i++) {
|
||||||
var item = sortedMachineDefinitionsModel.getItem(i);
|
var item = machineList.model.getItem(i);
|
||||||
if (item.section == section) {
|
if (item.section == section) {
|
||||||
machineList.currentIndex = i;
|
machineList.currentIndex = i;
|
||||||
break;
|
break;
|
||||||
@ -169,9 +171,21 @@ UM.Dialog
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Row
|
||||||
|
{
|
||||||
|
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
|
TextField
|
||||||
{
|
{
|
||||||
id: machineName;
|
id: machineName
|
||||||
text: getMachineName()
|
text: getMachineName()
|
||||||
implicitWidth: UM.Theme.getSize("standard_list_input").width
|
implicitWidth: UM.Theme.getSize("standard_list_input").width
|
||||||
maximumLength: 40
|
maximumLength: 40
|
||||||
@ -183,7 +197,7 @@ UM.Dialog
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
property var machine_name_validator: Cura.MachineNameValidator { }
|
property var machine_name_validator: Cura.MachineNameValidator { }
|
||||||
anchors.bottom:parent.bottom
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Button
|
Button
|
||||||
|
Loading…
x
Reference in New Issue
Block a user