mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-12 01:07:52 -06:00
Added button that is shown when instruction_link is set in the profile
CURA-5916
This commit is contained in:
parent
eb6f65d4ec
commit
5c94a8223d
3 changed files with 35 additions and 3 deletions
|
@ -6,7 +6,7 @@ import io
|
|||
import json #To parse the product-to-id mapping file.
|
||||
import os.path #To find the product-to-id mapping.
|
||||
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
|
||||
|
||||
from UM.Resources import Resources
|
||||
|
@ -117,7 +117,7 @@ class XmlMaterialProfile(InstanceContainer):
|
|||
## Overridden from InstanceContainer
|
||||
# base file: common settings + supported machines
|
||||
# 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()
|
||||
|
||||
base_file = self.getMetaDataEntry("base_file", "")
|
||||
|
|
|
@ -181,7 +181,18 @@ Item
|
|||
|
||||
readonly property real paddedWidth: parent.width - padding * 2
|
||||
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
|
||||
{
|
||||
|
@ -256,6 +267,27 @@ Item
|
|||
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
|
||||
|
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Loading…
Add table
Add a link
Reference in a new issue