mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-30 07:44:22 +08:00
Merge branch 'master' into CS-234_network_plugin_code_quality
This commit is contained in:
commit
92d07ddb71
@ -127,7 +127,7 @@ class MachineErrorChecker(QObject):
|
|||||||
|
|
||||||
# Populate the (stack, key) tuples to check
|
# Populate the (stack, key) tuples to check
|
||||||
self._stacks_and_keys_to_check = deque()
|
self._stacks_and_keys_to_check = deque()
|
||||||
for stack in [global_stack] + list(global_stack.extruders.values()):
|
for stack in global_stack.extruders.values():
|
||||||
for key in stack.getAllKeys():
|
for key in stack.getAllKeys():
|
||||||
self._stacks_and_keys_to_check.append((stack, key))
|
self._stacks_and_keys_to_check.append((stack, key))
|
||||||
|
|
||||||
|
@ -85,7 +85,14 @@ class VariantManager:
|
|||||||
if variant_definition not in self._machine_to_buildplate_dict_map:
|
if variant_definition not in self._machine_to_buildplate_dict_map:
|
||||||
self._machine_to_buildplate_dict_map[variant_definition] = OrderedDict()
|
self._machine_to_buildplate_dict_map[variant_definition] = OrderedDict()
|
||||||
|
|
||||||
|
try:
|
||||||
variant_container = self._container_registry.findContainers(type = "variant", id = variant_metadata["id"])[0]
|
variant_container = self._container_registry.findContainers(type = "variant", id = variant_metadata["id"])[0]
|
||||||
|
except IndexError as e:
|
||||||
|
# It still needs to break, but we want to know what variant ID made it break.
|
||||||
|
msg = "Unable to find build plate variant with the id [%s]" % variant_metadata["id"]
|
||||||
|
Logger.logException("e", msg)
|
||||||
|
raise IndexError(msg)
|
||||||
|
|
||||||
buildplate_type = variant_container.getProperty("machine_buildplate_type", "value")
|
buildplate_type = variant_container.getProperty("machine_buildplate_type", "value")
|
||||||
if buildplate_type not in self._machine_to_buildplate_dict_map[variant_definition]:
|
if buildplate_type not in self._machine_to_buildplate_dict_map[variant_definition]:
|
||||||
self._machine_to_variant_dict_map[variant_definition][buildplate_type] = dict()
|
self._machine_to_variant_dict_map[variant_definition][buildplate_type] = dict()
|
||||||
|
@ -129,8 +129,9 @@ class CuraStackBuilder:
|
|||||||
extruder_definition = registry.findDefinitionContainers(id = extruder_definition_id)[0]
|
extruder_definition = registry.findDefinitionContainers(id = extruder_definition_id)[0]
|
||||||
except IndexError as e:
|
except IndexError as e:
|
||||||
# It still needs to break, but we want to know what extruder ID made it break.
|
# It still needs to break, but we want to know what extruder ID made it break.
|
||||||
Logger.log("e", "Unable to find extruder with the id %s", extruder_definition_id)
|
msg = "Unable to find extruder definition with the id [%s]" % extruder_definition_id
|
||||||
raise e
|
Logger.logException("e", msg)
|
||||||
|
raise IndexError(msg)
|
||||||
|
|
||||||
# get material container for extruders
|
# get material container for extruders
|
||||||
material_container = application.empty_material_container
|
material_container = application.empty_material_container
|
||||||
|
@ -381,7 +381,13 @@ class ExtruderManager(QObject):
|
|||||||
elif extruder_stack_0.definition.getId() != expected_extruder_definition_0_id:
|
elif extruder_stack_0.definition.getId() != expected_extruder_definition_0_id:
|
||||||
Logger.log("e", "Single extruder printer [{printer}] expected extruder [{expected}], but got [{got}]. I'm making it [{expected}].".format(
|
Logger.log("e", "Single extruder printer [{printer}] expected extruder [{expected}], but got [{got}]. I'm making it [{expected}].".format(
|
||||||
printer = global_stack.getId(), expected = expected_extruder_definition_0_id, got = extruder_stack_0.definition.getId()))
|
printer = global_stack.getId(), expected = expected_extruder_definition_0_id, got = extruder_stack_0.definition.getId()))
|
||||||
|
try:
|
||||||
extruder_definition = container_registry.findDefinitionContainers(id = expected_extruder_definition_0_id)[0]
|
extruder_definition = container_registry.findDefinitionContainers(id = expected_extruder_definition_0_id)[0]
|
||||||
|
except IndexError as e:
|
||||||
|
# It still needs to break, but we want to know what extruder ID made it break.
|
||||||
|
msg = "Unable to find extruder definition with the id [%s]" % expected_extruder_definition_0_id
|
||||||
|
Logger.logException("e", msg)
|
||||||
|
raise IndexError(msg)
|
||||||
extruder_stack_0.definition = extruder_definition
|
extruder_stack_0.definition = extruder_definition
|
||||||
|
|
||||||
## Get all extruder values for a certain setting.
|
## Get all extruder values for a certain setting.
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
# Copyright (c) 2018 Ultimaker B.V.
|
# Copyright (c) 2019 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
from ..Script import Script
|
from ..Script import Script
|
||||||
|
|
||||||
from UM.Application import Application #To get the current printer's settings.
|
from UM.Application import Application #To get the current printer's settings.
|
||||||
|
from typing import List, Tuple
|
||||||
|
|
||||||
class PauseAtHeight(Script):
|
class PauseAtHeight(Script):
|
||||||
def __init__(self):
|
def __init__(self) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
def getSettingDataString(self):
|
def getSettingDataString(self) -> str:
|
||||||
return """{
|
return """{
|
||||||
"name": "Pause at height",
|
"name": "Pause at height",
|
||||||
"key": "PauseAtHeight",
|
"key": "PauseAtHeight",
|
||||||
@ -113,11 +114,9 @@ class PauseAtHeight(Script):
|
|||||||
}
|
}
|
||||||
}"""
|
}"""
|
||||||
|
|
||||||
def getNextXY(self, layer: str):
|
## Get the X and Y values for a layer (will be used to get X and Y of the
|
||||||
"""
|
# layer after the pause).
|
||||||
Get the X and Y values for a layer (will be used to get X and Y of
|
def getNextXY(self, layer: str) -> Tuple[float, float]:
|
||||||
the layer after the pause
|
|
||||||
"""
|
|
||||||
lines = layer.split("\n")
|
lines = layer.split("\n")
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if self.getValue(line, "X") is not None and self.getValue(line, "Y") is not None:
|
if self.getValue(line, "X") is not None and self.getValue(line, "Y") is not None:
|
||||||
@ -126,8 +125,10 @@ class PauseAtHeight(Script):
|
|||||||
return x, y
|
return x, y
|
||||||
return 0, 0
|
return 0, 0
|
||||||
|
|
||||||
def execute(self, data: list):
|
## Inserts the pause commands.
|
||||||
"""data is a list. Each index contains a layer"""
|
# \param data: List of layers.
|
||||||
|
# \return New list of layers.
|
||||||
|
def execute(self, data: List[str]) -> List[str]:
|
||||||
pause_at = self.getSettingValueByKey("pause_at")
|
pause_at = self.getSettingValueByKey("pause_at")
|
||||||
pause_height = self.getSettingValueByKey("pause_height")
|
pause_height = self.getSettingValueByKey("pause_height")
|
||||||
pause_layer = self.getSettingValueByKey("pause_layer")
|
pause_layer = self.getSettingValueByKey("pause_layer")
|
||||||
|
@ -127,6 +127,8 @@ class SliceInfo(QObject, Extension):
|
|||||||
data["active_mode"] = "custom"
|
data["active_mode"] = "custom"
|
||||||
|
|
||||||
data["camera_view"] = application.getPreferences().getValue("general/camera_perspective_mode")
|
data["camera_view"] = application.getPreferences().getValue("general/camera_perspective_mode")
|
||||||
|
if data["camera_view"] == "orthographic":
|
||||||
|
data["camera_view"] = "orthogonal" #The database still only recognises the old name "orthogonal".
|
||||||
|
|
||||||
definition_changes = global_stack.definitionChanges
|
definition_changes = global_stack.definitionChanges
|
||||||
machine_settings_changed_by_user = False
|
machine_settings_changed_by_user = False
|
||||||
|
@ -196,8 +196,9 @@ _quality_changes_to_creality_base = {
|
|||||||
"creality_cr10_extruder_0",
|
"creality_cr10_extruder_0",
|
||||||
"creality_cr10s4_extruder_0",
|
"creality_cr10s4_extruder_0",
|
||||||
"creality_cr10s5_extruder_0",
|
"creality_cr10s5_extruder_0",
|
||||||
"creality_ender3_extruder_0"
|
"creality_ender3_extruder_0",
|
||||||
"creality_cr10",
|
"creality_cr10",
|
||||||
|
"creality_cr10s",
|
||||||
"creality_cr10s4",
|
"creality_cr10s4",
|
||||||
"creality_cr10s5",
|
"creality_cr10s5",
|
||||||
"creality_ender3",
|
"creality_ender3",
|
||||||
|
@ -39,6 +39,17 @@ class VersionUpgrade42to43(VersionUpgrade):
|
|||||||
setting_version = int(parser.get("metadata", "setting_version", fallback = "0"))
|
setting_version = int(parser.get("metadata", "setting_version", fallback = "0"))
|
||||||
return format_version * 1000000 + setting_version
|
return format_version * 1000000 + setting_version
|
||||||
|
|
||||||
|
def upgradePreferences(self, serialized: str, filename: str):
|
||||||
|
parser = configparser.ConfigParser(interpolation = None)
|
||||||
|
parser.read_string(serialized)
|
||||||
|
|
||||||
|
if "camera_perspective_mode" in parser["general"] and parser["general"]["camera_perspective_mode"] == "orthogonal":
|
||||||
|
parser["general"]["camera_perspective_mode"] = "orthographic"
|
||||||
|
|
||||||
|
result = io.StringIO()
|
||||||
|
parser.write(result)
|
||||||
|
return [filename], [result.getvalue()]
|
||||||
|
|
||||||
## Upgrades instance containers to have the new version
|
## Upgrades instance containers to have the new version
|
||||||
# number.
|
# number.
|
||||||
#
|
#
|
||||||
|
@ -14,6 +14,7 @@ def getMetaData() -> Dict[str, Any]:
|
|||||||
return {
|
return {
|
||||||
"version_upgrade": {
|
"version_upgrade": {
|
||||||
# From To Upgrade function
|
# From To Upgrade function
|
||||||
|
("preferences", 6000008): ("preferences", 6000009, upgrade.upgradePreferences),
|
||||||
("machine_stack", 4000008): ("machine_stack", 4000009, upgrade.upgradeStack),
|
("machine_stack", 4000008): ("machine_stack", 4000009, upgrade.upgradeStack),
|
||||||
("extruder_train", 4000008): ("extruder_train", 4000009, upgrade.upgradeStack),
|
("extruder_train", 4000008): ("extruder_train", 4000009, upgrade.upgradeStack),
|
||||||
("definition_changes", 4000008): ("definition_changes", 4000009, upgrade.upgradeInstanceContainer),
|
("definition_changes", 4000008): ("definition_changes", 4000009, upgrade.upgradeInstanceContainer),
|
||||||
@ -22,6 +23,10 @@ def getMetaData() -> Dict[str, Any]:
|
|||||||
("user", 4000008): ("user", 4000009, upgrade.upgradeInstanceContainer),
|
("user", 4000008): ("user", 4000009, upgrade.upgradeInstanceContainer),
|
||||||
},
|
},
|
||||||
"sources": {
|
"sources": {
|
||||||
|
"preferences": {
|
||||||
|
"get_version": upgrade.getCfgVersion,
|
||||||
|
"location": {"."}
|
||||||
|
},
|
||||||
"machine_stack": {
|
"machine_stack": {
|
||||||
"get_version": upgrade.getCfgVersion,
|
"get_version": upgrade.getCfgVersion,
|
||||||
"location": {"./machine_instances"}
|
"location": {"./machine_instances"}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
"machine_max_feedrate_x": { "value": 500 },
|
"machine_max_feedrate_x": { "value": 500 },
|
||||||
"machine_max_feedrate_y": { "value": 500 },
|
"machine_max_feedrate_y": { "value": 500 },
|
||||||
"machine_max_feedrate_z": { "value": 5 },
|
"machine_max_feedrate_z": { "value": 10 },
|
||||||
"machine_max_feedrate_e": { "value": 50 },
|
"machine_max_feedrate_e": { "value": 50 },
|
||||||
|
|
||||||
"machine_max_acceleration_x": { "value": 500 },
|
"machine_max_acceleration_x": { "value": 500 },
|
||||||
|
@ -1326,7 +1326,7 @@ msgstr "Nascondi o esponi giunzione"
|
|||||||
#: fdmprinter.def.json
|
#: fdmprinter.def.json
|
||||||
msgctxt "z_seam_corner option z_seam_corner_weighted"
|
msgctxt "z_seam_corner option z_seam_corner_weighted"
|
||||||
msgid "Smart Hiding"
|
msgid "Smart Hiding"
|
||||||
msgstr "Smart Hiding"
|
msgstr "Occultamento intelligente"
|
||||||
|
|
||||||
#: fdmprinter.def.json
|
#: fdmprinter.def.json
|
||||||
msgctxt "z_seam_relative label"
|
msgctxt "z_seam_relative label"
|
||||||
|
@ -31,6 +31,7 @@ Menu
|
|||||||
return Cura.MachineManager.activeVariantNames[extruderIndex] == model.hotend_name
|
return Cura.MachineManager.activeVariantNames[extruderIndex] == model.hotend_name
|
||||||
}
|
}
|
||||||
exclusiveGroup: group
|
exclusiveGroup: group
|
||||||
|
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
Cura.MachineManager.setVariant(menu.extruderIndex, model.container_node);
|
Cura.MachineManager.setVariant(menu.extruderIndex, model.container_node);
|
||||||
}
|
}
|
||||||
|
@ -15,15 +15,10 @@ Menu
|
|||||||
PrinterMenu { title: catalog.i18nc("@title:menu menubar:settings", "&Printer") }
|
PrinterMenu { title: catalog.i18nc("@title:menu menubar:settings", "&Printer") }
|
||||||
|
|
||||||
property var activeMachine: Cura.MachineManager.activeMachine
|
property var activeMachine: Cura.MachineManager.activeMachine
|
||||||
|
|
||||||
onAboutToShow: extruderInstantiator.active = true
|
|
||||||
onAboutToHide: extruderInstantiator.active = false
|
|
||||||
Instantiator
|
Instantiator
|
||||||
{
|
{
|
||||||
id: extruderInstantiator
|
id: extruderInstantiator
|
||||||
model: activeMachine == null ? null : activeMachine.extruderList
|
model: activeMachine == null ? null : activeMachine.extruderList
|
||||||
active: false
|
|
||||||
asynchronous: true
|
|
||||||
Menu
|
Menu
|
||||||
{
|
{
|
||||||
title: modelData.name
|
title: modelData.name
|
||||||
@ -39,41 +34,20 @@ Menu
|
|||||||
MenuItem
|
MenuItem
|
||||||
{
|
{
|
||||||
text: catalog.i18nc("@action:inmenu", "Set as Active Extruder")
|
text: catalog.i18nc("@action:inmenu", "Set as Active Extruder")
|
||||||
// HACK: Instead of directly binding to the onTriggered handle, we have to use this workaround.
|
onTriggered: Cura.ExtruderManager.setActiveExtruderIndex(model.index)
|
||||||
// I've narrowed it down to it being an issue with the instantiator (removing that makes the
|
|
||||||
// onTriggered work directly again).
|
|
||||||
Component.onCompleted:
|
|
||||||
{
|
|
||||||
var index = model.index
|
|
||||||
triggered.connect(function(){Cura.ExtruderManager.setActiveExtruderIndex(index)})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuItem
|
MenuItem
|
||||||
{
|
{
|
||||||
text: catalog.i18nc("@action:inmenu", "Enable Extruder")
|
text: catalog.i18nc("@action:inmenu", "Enable Extruder")
|
||||||
// HACK: Instead of directly binding to the onTriggered handle, we have to use this workaround.
|
onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, true)
|
||||||
// I've narrowed it down to it being an issue with the instantiator (removing that makes the
|
|
||||||
// onTriggered work directly again).
|
|
||||||
Component.onCompleted:
|
|
||||||
{
|
|
||||||
var index = model.index
|
|
||||||
triggered.connect(function(){Cura.MachineManager.setExtruderEnabled(index, true)})
|
|
||||||
}
|
|
||||||
visible: !Cura.MachineManager.getExtruder(model.index).isEnabled
|
visible: !Cura.MachineManager.getExtruder(model.index).isEnabled
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuItem
|
MenuItem
|
||||||
{
|
{
|
||||||
text: catalog.i18nc("@action:inmenu", "Disable Extruder")
|
text: catalog.i18nc("@action:inmenu", "Disable Extruder")
|
||||||
// HACK: Instead of directly binding to the onTriggered handle, we have to use this workaround.
|
onTriggered: Cura.MachineManager.setExtruderEnabled(index, false)
|
||||||
// I've narrowed it down to it being an issue with the instantiator (removing that makes the
|
|
||||||
// onTriggered work directly again).
|
|
||||||
Component.onCompleted:
|
|
||||||
{
|
|
||||||
var index = model.index
|
|
||||||
triggered.connect(function(){Cura.MachineManager.setExtruderEnabled(index, false)})
|
|
||||||
}
|
|
||||||
visible: Cura.MachineManager.getExtruder(model.index).isEnabled
|
visible: Cura.MachineManager.getExtruder(model.index).isEnabled
|
||||||
enabled: Cura.MachineManager.numberExtrudersEnabled > 1
|
enabled: Cura.MachineManager.numberExtrudersEnabled > 1
|
||||||
}
|
}
|
||||||
|
@ -58,11 +58,11 @@ Menu
|
|||||||
{
|
{
|
||||||
text: catalog.i18nc("@action:inmenu menubar:view", "Orthographic")
|
text: catalog.i18nc("@action:inmenu menubar:view", "Orthographic")
|
||||||
checkable: true
|
checkable: true
|
||||||
checked: cameraViewMenu.cameraMode == "orthogonal"
|
checked: cameraViewMenu.cameraMode == "orthographic"
|
||||||
onTriggered:
|
onTriggered:
|
||||||
{
|
{
|
||||||
UM.Preferences.setValue("general/camera_perspective_mode", "orthogonal")
|
UM.Preferences.setValue("general/camera_perspective_mode", "orthographic")
|
||||||
checked = cameraViewMenu.cameraMode == "orthogonal"
|
checked = cameraViewMenu.cameraMode == "orthographic"
|
||||||
}
|
}
|
||||||
exclusiveGroup: group
|
exclusiveGroup: group
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ UM.PreferencesPage
|
|||||||
append({ text: "日本語", code: "ja_JP" })
|
append({ text: "日本語", code: "ja_JP" })
|
||||||
append({ text: "한국어", code: "ko_KR" })
|
append({ text: "한국어", code: "ko_KR" })
|
||||||
append({ text: "Nederlands", code: "nl_NL" })
|
append({ text: "Nederlands", code: "nl_NL" })
|
||||||
append({ text: "Polski", code: "pl_PL" })
|
//Polish is disabled for being incomplete: append({ text: "Polski", code: "pl_PL" })
|
||||||
append({ text: "Português do Brasil", code: "pt_BR" })
|
append({ text: "Português do Brasil", code: "pt_BR" })
|
||||||
append({ text: "Português", code: "pt_PT" })
|
append({ text: "Português", code: "pt_PT" })
|
||||||
append({ text: "Русский", code: "ru_RU" })
|
append({ text: "Русский", code: "ru_RU" })
|
||||||
@ -368,7 +368,7 @@ UM.PreferencesPage
|
|||||||
{
|
{
|
||||||
width: childrenRect.width;
|
width: childrenRect.width;
|
||||||
height: childrenRect.height;
|
height: childrenRect.height;
|
||||||
text: zoomToMouseCheckbox.enabled ? catalog.i18nc("@info:tooltip", "Should zooming move in the direction of the mouse?") : catalog.i18nc("@info:tooltip", "Zooming towards the mouse is not supported in the orthogonal perspective.")
|
text: zoomToMouseCheckbox.enabled ? catalog.i18nc("@info:tooltip", "Should zooming move in the direction of the mouse?") : catalog.i18nc("@info:tooltip", "Zooming towards the mouse is not supported in the orthographic perspective.")
|
||||||
|
|
||||||
CheckBox
|
CheckBox
|
||||||
{
|
{
|
||||||
@ -389,7 +389,7 @@ UM.PreferencesPage
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
zoomToMouseCheckbox.enabled = UM.Preferences.getValue("general/camera_perspective_mode") !== "orthogonal";
|
zoomToMouseCheckbox.enabled = UM.Preferences.getValue("general/camera_perspective_mode") !== "orthographic";
|
||||||
zoomToMouseCheckbox.checked = boolCheck(UM.Preferences.getValue("view/zoom_to_mouse")) && zoomToMouseCheckbox.enabled;
|
zoomToMouseCheckbox.checked = boolCheck(UM.Preferences.getValue("view/zoom_to_mouse")) && zoomToMouseCheckbox.enabled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -481,7 +481,7 @@ UM.PreferencesPage
|
|||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
append({ text: catalog.i18n("Perspective"), code: "perspective" })
|
append({ text: catalog.i18n("Perspective"), code: "perspective" })
|
||||||
append({ text: catalog.i18n("Orthogonal"), code: "orthogonal" })
|
append({ text: catalog.i18n("Orthographic"), code: "orthographic" })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,6 +102,7 @@ Item
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
base.currentItem = null
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,6 +58,11 @@ Item
|
|||||||
{
|
{
|
||||||
forceActiveFocus()
|
forceActiveFocus()
|
||||||
materialDetailsPanel.currentItem = currentItem
|
materialDetailsPanel.currentItem = currentItem
|
||||||
|
// CURA-6679 If the current item is gone after the model update, reset the current item to the active material.
|
||||||
|
if (currentItem == null)
|
||||||
|
{
|
||||||
|
resetExpandedActiveMaterial()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Main layout
|
// Main layout
|
||||||
|
Loading…
x
Reference in New Issue
Block a user