mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-15 22:15:52 +08:00
Merge branch 'LipuFei-feature_CURA-3810_material_info_button' into 2.6
This commit is contained in:
commit
3be6526be3
@ -5,7 +5,7 @@ import os.path
|
|||||||
|
|
||||||
from typing import Any, Optional
|
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.FlameProfiler import pyqtSlot
|
||||||
|
|
||||||
from UM.Decorators import override
|
from UM.Decorators import override
|
||||||
@ -250,7 +250,7 @@ class CuraContainerStack(ContainerStack):
|
|||||||
## Get the definition container.
|
## Get the definition container.
|
||||||
#
|
#
|
||||||
# \return The definition container. Should always be a valid container, but can be equal to the empty InstanceContainer.
|
# \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:
|
def definition(self) -> DefinitionContainer:
|
||||||
return self._containers[_ContainerIndexes.Definition]
|
return self._containers[_ContainerIndexes.Definition]
|
||||||
|
|
||||||
|
@ -470,7 +470,7 @@ class MachineManager(QObject):
|
|||||||
|
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
@pyqtProperty("QObject", notify = globalContainerChanged)
|
@pyqtProperty(QObject, notify = globalContainerChanged)
|
||||||
def activeMachine(self) -> "GlobalStack":
|
def activeMachine(self) -> "GlobalStack":
|
||||||
return self._global_container_stack
|
return self._global_container_stack
|
||||||
|
|
||||||
|
@ -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.
|
// Cura is released under the terms of the AGPLv3 or higher.
|
||||||
|
|
||||||
import QtQuick 2.2
|
import QtQuick 2.2
|
||||||
@ -159,7 +159,7 @@ Column
|
|||||||
visible: !extruderSelectionRow.visible
|
visible: !extruderSelectionRow.visible
|
||||||
}
|
}
|
||||||
|
|
||||||
Row
|
Item
|
||||||
{
|
{
|
||||||
id: variantRow
|
id: variantRow
|
||||||
|
|
||||||
@ -196,16 +196,59 @@ Column
|
|||||||
}
|
}
|
||||||
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
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");
|
font: UM.Theme.getFont("default");
|
||||||
color: UM.Theme.getColor("text");
|
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
|
Item
|
||||||
{
|
{
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
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
|
height: UM.Theme.getSize("setting_control").height
|
||||||
|
|
||||||
ToolButton {
|
ToolButton {
|
||||||
|
@ -8,6 +8,37 @@ import QtQuick.Controls.Styles 1.1
|
|||||||
import UM 1.1 as UM
|
import UM 1.1 as UM
|
||||||
|
|
||||||
QtObject {
|
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 {
|
property Component mode_switch: Component {
|
||||||
SwitchStyle {
|
SwitchStyle {
|
||||||
groove: Rectangle {
|
groove: Rectangle {
|
||||||
|
@ -329,6 +329,8 @@
|
|||||||
|
|
||||||
"infill_button_margin": [0.5, 0.5],
|
"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]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user