diff --git a/cura/Settings/CuraContainerStack.py b/cura/Settings/CuraContainerStack.py index d14f2d04c9..fc90e3b239 100755 --- a/cura/Settings/CuraContainerStack.py +++ b/cura/Settings/CuraContainerStack.py @@ -5,7 +5,7 @@ import os.path from typing import Any, Optional -from PyQt5.QtCore import pyqtProperty, pyqtSignal +from PyQt5.QtCore import pyqtProperty, pyqtSignal, QObject from UM.FlameProfiler import pyqtSlot from UM.Decorators import override @@ -250,7 +250,7 @@ class CuraContainerStack(ContainerStack): ## Get the definition container. # # \return The definition container. Should always be a valid container, but can be equal to the empty InstanceContainer. - @pyqtProperty(DefinitionContainer, fset = setDefinition, notify = pyqtContainersChanged) + @pyqtProperty(QObject, fset = setDefinition, notify = pyqtContainersChanged) def definition(self) -> DefinitionContainer: return self._containers[_ContainerIndexes.Definition] diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 96ccc89ccf..8738b044fb 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -470,7 +470,7 @@ class MachineManager(QObject): return "" - @pyqtProperty("QObject", notify = globalContainerChanged) + @pyqtProperty(QObject, notify = globalContainerChanged) def activeMachine(self) -> "GlobalStack": return self._global_container_stack diff --git a/resources/qml/SidebarHeader.qml b/resources/qml/SidebarHeader.qml index e4070c5d43..32e1db607a 100644 --- a/resources/qml/SidebarHeader.qml +++ b/resources/qml/SidebarHeader.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Ultimaker B.V. +// Copyright (c) 2017 Ultimaker B.V. // Cura is released under the terms of the AGPLv3 or higher. import QtQuick 2.2 @@ -159,7 +159,7 @@ Column visible: !extruderSelectionRow.visible } - Row + Item { id: variantRow @@ -196,16 +196,59 @@ Column } anchors.verticalCenter: parent.verticalCenter - width: parent.width * 0.45 - UM.Theme.getSize("default_margin").width + anchors.left: variantRow.left + width: parent.width * 0.30 font: UM.Theme.getFont("default"); color: UM.Theme.getColor("text"); } + Button + { + id: materialInfoButton + height: parent.height * 0.70 + width: height + + anchors.left: variantLabel.right + anchors.leftMargin: UM.Theme.getSize("default_margin").width * 2 + anchors.verticalCenter: parent.verticalCenter + + visible: extrudersList.visible + + text: "i" + style: UM.Theme.styles.info_button + + onClicked: + { + // open the material URL with web browser + var version = UM.Application.version; + var machineName = Cura.MachineManager.activeMachine.definition.id; + + var url = "https://ultimaker.com/materialcompatibility/" + version + "/" + machineName; + Qt.openUrlExternally(url); + } + + onHoveredChanged: + { + if (hovered) + { + var content = catalog.i18nc("@tooltip", "Click to check the material compatibility on Ultimaker.com."); + base.showTooltip( + extruderSelectionRow, Qt.point(0, extruderSelectionRow.height + variantRow.height / 2), catalog.i18nc("@tooltip", content) + ); + } + else + { + base.hideTooltip(); + } + } + } + Item { anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right - width: parent.width * 0.55 + UM.Theme.getSize("default_margin").width + width: parent.width * 0.50 + UM.Theme.getSize("default_margin").width height: UM.Theme.getSize("setting_control").height ToolButton { diff --git a/resources/themes/cura/styles.qml b/resources/themes/cura/styles.qml index ffe866f2c6..496cc8e489 100755 --- a/resources/themes/cura/styles.qml +++ b/resources/themes/cura/styles.qml @@ -8,6 +8,37 @@ import QtQuick.Controls.Styles 1.1 import UM 1.1 as UM QtObject { + property Component info_button: Component { + ButtonStyle { + label: Text { + renderType: Text.NativeRendering + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + font: UM.Theme.getFont("small") + color: UM.Theme.getColor("button_text") + text: control.text + } + + background: Rectangle { + implicitHeight: UM.Theme.getSize("info_button").height + implicitWidth: width + border.width: 0 + radius: height * 0.5 + + color: { + if (control.pressed) { + return UM.Theme.getColor("button_active"); + } else if (control.hovered) { + return UM.Theme.getColor("button_hover"); + } else { + return UM.Theme.getColor("button"); + } + } + Behavior on color { ColorAnimation { duration: 50; } } + } + } + } + property Component mode_switch: Component { SwitchStyle { groove: Rectangle { diff --git a/resources/themes/cura/theme.json b/resources/themes/cura/theme.json index 5f0b3656c8..e7d49cb5e8 100644 --- a/resources/themes/cura/theme.json +++ b/resources/themes/cura/theme.json @@ -329,6 +329,8 @@ "infill_button_margin": [0.5, 0.5], - "jobspecs_line": [2.0, 2.0] + "jobspecs_line": [2.0, 2.0], + + "info_button": [0.6, 0.6] } }