Merge branch 'master' of github.com:Ultimaker/Cura into CURA-5395-orthographic-view

This commit is contained in:
Jaime van Kessel 2019-05-21 14:23:24 +02:00
commit ca8fa9cfac
4 changed files with 67 additions and 13 deletions

View File

@ -114,6 +114,7 @@ from cura.UI.MachineSettingsManager import MachineSettingsManager
from cura.UI.ObjectsModel import ObjectsModel from cura.UI.ObjectsModel import ObjectsModel
from cura.UI.TextManager import TextManager from cura.UI.TextManager import TextManager
from cura.UI.AddPrinterPagesModel import AddPrinterPagesModel from cura.UI.AddPrinterPagesModel import AddPrinterPagesModel
from cura.UI.RecommendedMode import RecommendedMode
from cura.UI.WelcomePagesModel import WelcomePagesModel from cura.UI.WelcomePagesModel import WelcomePagesModel
from cura.UI.WhatsNewPagesModel import WhatsNewPagesModel from cura.UI.WhatsNewPagesModel import WhatsNewPagesModel
@ -1036,6 +1037,7 @@ class CuraApplication(QtApplication):
qmlRegisterType(WhatsNewPagesModel, "Cura", 1, 0, "WhatsNewPagesModel") qmlRegisterType(WhatsNewPagesModel, "Cura", 1, 0, "WhatsNewPagesModel")
qmlRegisterType(AddPrinterPagesModel, "Cura", 1, 0, "AddPrinterPagesModel") qmlRegisterType(AddPrinterPagesModel, "Cura", 1, 0, "AddPrinterPagesModel")
qmlRegisterType(TextManager, "Cura", 1, 0, "TextManager") qmlRegisterType(TextManager, "Cura", 1, 0, "TextManager")
qmlRegisterType(RecommendedMode, "Cura", 1, 0, "RecommendedMode")
qmlRegisterType(NetworkMJPGImage, "Cura", 1, 0, "NetworkMJPGImage") qmlRegisterType(NetworkMJPGImage, "Cura", 1, 0, "NetworkMJPGImage")

View File

@ -0,0 +1,50 @@
# Copyright (c) 2019 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from PyQt5.QtCore import QObject, pyqtSlot
#
# This object contains helper/convenience functions for Recommended mode.
#
class RecommendedMode(QObject):
# Sets to use the adhesion or not for the "Adhesion" CheckBox in Recommended mode.
@pyqtSlot(bool)
def setAdhesion(self, checked: bool) -> None:
from cura.CuraApplication import CuraApplication
application = CuraApplication.getInstance()
global_stack = application.getMachineManager().activeMachine
if global_stack is None:
return
# Remove the adhesion type value set by the user.
adhesion_type_key = "adhesion_type"
user_changes_container = global_stack.userChanges
if adhesion_type_key in user_changes_container.getAllKeys():
user_changes_container.removeInstance(adhesion_type_key)
# Get the default value of adhesion type after user's value has been removed.
# skirt and none are counted as "no adhesion", the others are considered as "with adhesion". The conditions are
# as the following:
# - if the user checks the adhesion checkbox, get the default value (including the custom quality) for adhesion
# type.
# (1) If the default value is "skirt" or "none" (no adhesion), set adhesion_type to "brim".
# (2) If the default value is "with adhesion", do nothing.
# - if the user unchecks the adhesion checkbox, get the default value (including the custom quality) for
# adhesion type.
# (1) If the default value is "skirt" or "none" (no adhesion), do nothing.
# (2) Otherwise, set adhesion_type to "skirt".
value = global_stack.getProperty(adhesion_type_key, "value")
if checked:
if value in ("skirt", "none"):
value = "brim"
else:
if value not in ("skirt", "none"):
value = "skirt"
user_changes_container.setProperty(adhesion_type_key, "value", value)
__all__ = ["RecommendedMode"]

View File

@ -2482,6 +2482,19 @@
"settable_per_extruder": true "settable_per_extruder": true
} }
} }
},
"switch_extruder_extra_prime_amount":
{
"label": "Nozzle Switch Extra Prime Amount",
"description": "Extra material to prime after nozzle switching.",
"type": "float",
"unit": "mm³",
"default_value": 0,
"minimum_value_warning": "0",
"maximum_value_warning": "100",
"enabled": "retraction_enable",
"settable_per_mesh": false,
"settable_per_extruder": true
} }
} }
}, },

View File

@ -18,6 +18,7 @@ Item
height: childrenRect.height height: childrenRect.height
property real labelColumnWidth: Math.round(width / 3) property real labelColumnWidth: Math.round(width / 3)
property var curaRecommendedMode: Cura.RecommendedMode {}
Cura.IconWithText Cura.IconWithText
{ {
@ -64,19 +65,7 @@ Item
onClicked: onClicked:
{ {
var adhesionType = "skirt"; curaRecommendedMode.setAdhesion(!parent.checked)
if (!parent.checked)
{
// Remove the "user" setting to see if the rest of the stack prescribes a brim or a raft
platformAdhesionType.removeFromContainer(0);
adhesionType = platformAdhesionType.properties.resolve;
if(adhesionType === "skirt" || adhesionType === "none")
{
// If the rest of the stack doesn't prescribe an adhesion-type, default to a brim
adhesionType = "brim";
}
}
platformAdhesionType.setPropertyValue("value", adhesionType);
} }
onEntered: onEntered: