Merge branch 'CURA-5916-show-printing-guidelines-for-custom-material-section'

Contributes to issue CURA-5916.
This commit is contained in:
Ghostkeeper 2019-02-08 09:32:56 +01:00
commit 506ce2e6e5
No known key found for this signature in database
GPG Key ID: 86BEF881AE2CF276
4 changed files with 49 additions and 10 deletions

View File

@ -6,7 +6,7 @@ import io
import json #To parse the product-to-id mapping file. import json #To parse the product-to-id mapping file.
import os.path #To find the product-to-id mapping. import os.path #To find the product-to-id mapping.
import sys import sys
from typing import Any, Dict, List, Optional, Tuple, cast from typing import Any, Dict, List, Optional, Tuple, cast, Set
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
from UM.Resources import Resources from UM.Resources import Resources
@ -117,7 +117,7 @@ class XmlMaterialProfile(InstanceContainer):
## Overridden from InstanceContainer ## Overridden from InstanceContainer
# base file: common settings + supported machines # base file: common settings + supported machines
# machine / variant combination: only changes for itself. # machine / variant combination: only changes for itself.
def serialize(self, ignored_metadata_keys: Optional[set] = None): def serialize(self, ignored_metadata_keys: Optional[Set[str]] = None):
registry = ContainerRegistry.getInstance() registry = ContainerRegistry.getInstance()
base_file = self.getMetaDataEntry("base_file", "") base_file = self.getMetaDataEntry("base_file", "")

View File

@ -181,11 +181,22 @@ Item
readonly property real paddedWidth: parent.width - padding * 2 readonly property real paddedWidth: parent.width - padding * 2
property real textWidth: Math.round(paddedWidth * 0.3) property real textWidth: Math.round(paddedWidth * 0.3)
property real controlWidth: paddedWidth - textWidth property real controlWidth:
{
if(instructionLink == "")
{
return paddedWidth - textWidth
}
else
{
return paddedWidth - textWidth - UM.Theme.getSize("print_setup_big_item").height * 0.5 - UM.Theme.getSize("default_margin").width
}
}
property string instructionLink:Cura.ContainerManager.getContainerMetaDataEntry(Cura.MachineManager.activeStack.material.id, "instruction_link", "")
Row Row
{ {
height: UM.Theme.getSize("print_setup_item").height height: visible ? childrenRect.height : 0
visible: extrudersModel.count > 1 // If there is only one extruder, there is no point to enable/disable that. visible: extrudersModel.count > 1 // If there is only one extruder, there is no point to enable/disable that.
Label Label
@ -222,7 +233,7 @@ Item
Row Row
{ {
height: UM.Theme.getSize("print_setup_big_item").height height: visible ? childrenRect.height: 0
visible: Cura.MachineManager.hasMaterials visible: Cura.MachineManager.hasMaterials
Label Label
@ -246,8 +257,8 @@ Item
text: Cura.MachineManager.activeStack != null ? Cura.MachineManager.activeStack.material.name : "" text: Cura.MachineManager.activeStack != null ? Cura.MachineManager.activeStack.material.name : ""
tooltip: text tooltip: text
height: UM.Theme.getSize("print_setup_big_item").height
width: selectors.controlWidth width: selectors.controlWidth
height: UM.Theme.getSize("print_setup_big_item").height
style: UM.Theme.styles.print_setup_header_button style: UM.Theme.styles.print_setup_header_button
activeFocusOnPress: true activeFocusOnPress: true
@ -256,11 +267,32 @@ Item
extruderIndex: Cura.ExtruderManager.activeExtruderIndex extruderIndex: Cura.ExtruderManager.activeExtruderIndex
} }
} }
Item
{
width: instructionButton.width + 2 * UM.Theme.getSize("default_margin").width
height: instructionButton.visible ? materialSelection.height: 0
Button
{
id: instructionButton
hoverEnabled: true
contentItem: Item {}
height: 0.5 * materialSelection.height
width: height
anchors.centerIn: parent
background: UM.RecolorImage
{
source: UM.Theme.getIcon("printing_guideline")
color: instructionButton.hovered ? UM.Theme.getColor("primary") : UM.Theme.getColor("icon")
}
visible: selectors.instructionLink != ""
onClicked:Qt.openUrlExternally(selectors.instructionLink)
}
}
} }
Row Row
{ {
height: UM.Theme.getSize("print_setup_big_item").height height: visible ? childrenRect.height: 0
visible: Cura.MachineManager.hasVariants visible: Cura.MachineManager.hasVariants
Label Label
@ -279,7 +311,6 @@ Item
id: variantSelection id: variantSelection
text: Cura.MachineManager.activeVariantName text: Cura.MachineManager.activeVariantName
tooltip: Cura.MachineManager.activeVariantName tooltip: Cura.MachineManager.activeVariantName
height: UM.Theme.getSize("print_setup_big_item").height height: UM.Theme.getSize("print_setup_big_item").height
width: selectors.controlWidth width: selectors.controlWidth
style: UM.Theme.styles.print_setup_header_button style: UM.Theme.styles.print_setup_header_button
@ -292,7 +323,7 @@ Item
Row Row
{ {
id: warnings id: warnings
height: UM.Theme.getSize("print_setup_big_item").height height: visible ? childrenRect.height : 0
visible: buildplateCompatibilityError || buildplateCompatibilityWarning visible: buildplateCompatibilityError || buildplateCompatibilityWarning
property bool buildplateCompatibilityError: !Cura.MachineManager.variantBuildplateCompatible && !Cura.MachineManager.variantBuildplateUsable property bool buildplateCompatibilityError: !Cura.MachineManager.variantBuildplateCompatible && !Cura.MachineManager.variantBuildplateUsable

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="18px" height="18px" viewBox="0 0 18 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 52.6 (67491) - http://www.bohemiancoding.com/sketch -->
<title>Icon/ guideline on hover</title>
<desc>Created with Sketch.</desc>
<g id="Icon/-guideline-on-hover" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M16,18 L15,18 L3,18 C1.8954305,18 1,17.1045695 1,16 L1,2 C1,0.8954305 1.8954305,2.02906125e-16 3,0 L15,0 L15,14 L3.5,14 C2.67157288,14 2,14.6715729 2,15.5 C2,16.3284271 2.67157288,17 3.5,17 L15,17 L16,17 L16,16 L4,16 L4,15 L16,15 L16,2 L17,2 L17,18 L16,18 Z M8.75,11.25 C8.75,10.835625 8.414375,10.5 8,10.5 C7.585625,10.5 7.25,10.835625 7.25,11.25 C7.25,11.664375 7.585625,12 8,12 C8.414375,12 8.75,11.664375 8.75,11.25 Z M11,6 C11,4.34325 9.65675,3 8,3 C6.34325,3 5,4.34325 5,6 C5,6.414 5.335625,6.75 5.75,6.75 C6.164375,6.75 6.5,6.414 6.5,6 C6.5,5.171625 7.171625,4.5 8,4.5 C8.828375,4.5 9.5,5.171625 9.5,6 C9.5,6.828375 8.828375,7.5 8,7.5 C7.585625,7.5 7.25,7.836 7.25,8.25 L7.25,9 C7.25,9.414 7.585625,9.75 8,9.75 C8.414375,9.75 8.75,9.414 8.75,9 L8.75,8.893875 C10.041125,8.559 11,7.396125 11,6 Z" id="Combined-Shape" fill="#3282FF"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -442,7 +442,6 @@
"print_setup_widget": [38.0, 30.0], "print_setup_widget": [38.0, 30.0],
"print_setup_mode_toggle": [0.0, 2.0], "print_setup_mode_toggle": [0.0, 2.0],
"print_setup_item": [0.0, 2.0],
"print_setup_extruder_box": [0.0, 6.0], "print_setup_extruder_box": [0.0, 6.0],
"print_setup_slider_groove": [0.16, 0.16], "print_setup_slider_groove": [0.16, 0.16],
"print_setup_slider_handle": [1.0, 1.0], "print_setup_slider_handle": [1.0, 1.0],