mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-04 11:14:21 +08:00
Add warning icon when not all extruders have same intent
CURA-6601
This commit is contained in:
parent
eced1fe907
commit
b19e7cd027
@ -627,6 +627,24 @@ class MachineManager(QObject):
|
||||
intent_category = category
|
||||
return intent_category
|
||||
|
||||
# Provies a list of extruder positions that have a different intent from the active one.
|
||||
@pyqtProperty("QStringList", notify=activeIntentChanged)
|
||||
def extruderPositionsWithNonActiveIntent(self):
|
||||
global_container_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack()
|
||||
|
||||
if not global_container_stack:
|
||||
return []
|
||||
|
||||
active_intent_category = self.activeIntentCategory
|
||||
result = []
|
||||
for extruder in global_container_stack.extruderList:
|
||||
category = extruder.intent.getMetaDataEntry("intent_category", "default")
|
||||
if category != active_intent_category:
|
||||
result.append(str(int(extruder.getMetaDataEntry("position")) + 1))
|
||||
|
||||
return result
|
||||
|
||||
|
||||
## Returns whether there is anything unsupported in the current set-up.
|
||||
#
|
||||
# The current set-up signifies the global stack and all extruder stacks,
|
||||
|
36
resources/qml/PrintSetupSelector/NoIntentIcon.qml
Normal file
36
resources/qml/PrintSetupSelector/NoIntentIcon.qml
Normal file
@ -0,0 +1,36 @@
|
||||
// Copyright (c) 2019 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.10
|
||||
import QtQuick.Controls 2.3
|
||||
|
||||
import UM 1.2 as UM
|
||||
import Cura 1.6 as Cura
|
||||
|
||||
Item
|
||||
{
|
||||
id: icon
|
||||
property var affected_extruders
|
||||
property var intent_type: ""
|
||||
|
||||
implicitWidth: UM.Theme.getSize("section_icon").width
|
||||
implicitHeight: UM.Theme.getSize("section_icon").height
|
||||
|
||||
UM.RecolorImage
|
||||
{
|
||||
source: UM.Theme.getIcon("info")
|
||||
color: UM.Theme.getColor("icon")
|
||||
anchors.fill: parent
|
||||
}
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: parent
|
||||
hoverEnabled: parent.visible
|
||||
onEntered:
|
||||
{
|
||||
var tooltipContent = catalog.i18ncp("@label %1 is filled in with the type of a profile. %2 is filled with a list of numbers (eg '1' or '1, 2')", "There is no %1 profile for the configuration in extruder %2. The default intent will be used instead", "There is no %1 profile for the configurations in extruders %2. The default intent will be used instead", affected_extruders.length).arg(intent_type).arg(affected_extruders)
|
||||
base.showTooltip(icon.parent, Qt.point(-UM.Theme.getSize("thick_margin").width, 0), tooltipContent)
|
||||
}
|
||||
onExited: base.hideTooltip()
|
||||
}
|
||||
}
|
@ -8,7 +8,7 @@ import QtQuick.Controls.Styles 1.4
|
||||
|
||||
import UM 1.2 as UM
|
||||
import Cura 1.6 as Cura
|
||||
|
||||
import ".."
|
||||
Item
|
||||
{
|
||||
id: qualityRow
|
||||
@ -123,6 +123,18 @@ Item
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
NoIntentIcon
|
||||
{
|
||||
affected_extruders: Cura.MachineManager.extruderPositionsWithNonActiveIntent
|
||||
intent_type: model.name
|
||||
anchors.right: intentCategoryLabel.right
|
||||
anchors.rightMargin: UM.Theme.getSize("narrow_margin").width
|
||||
width: intentCategoryLabel.height * 0.75
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
height: width
|
||||
visible: Cura.MachineManager.activeIntentCategory == model.intent_category && affected_extruders.length
|
||||
}
|
||||
|
||||
Cura.RadioCheckbar
|
||||
{
|
||||
anchors
|
||||
|
Loading…
x
Reference in New Issue
Block a user