mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 11:35:52 +08:00
CURA-4870 Make the configuration selector only available for network
printers. Show the connection icon also for printers connected via USB or Octoprint.
This commit is contained in:
parent
7c875c154f
commit
1cf832653c
@ -10,17 +10,22 @@ import UM 1.2 as UM
|
|||||||
import Cura 1.0 as Cura
|
import Cura 1.0 as Cura
|
||||||
import "Menus"
|
import "Menus"
|
||||||
|
|
||||||
ToolButton {
|
ToolButton
|
||||||
|
{
|
||||||
id: base
|
id: base
|
||||||
property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != ""
|
property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != ""
|
||||||
|
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
|
||||||
property var printerStatus: Cura.MachineManager.printerOutputDevices.length != 0 ? "connected" : "disconnected"
|
property var printerStatus: Cura.MachineManager.printerOutputDevices.length != 0 ? "connected" : "disconnected"
|
||||||
text: isNetworkPrinter ? Cura.MachineManager.activeMachineNetworkGroupName : Cura.MachineManager.activeMachineName
|
text: isNetworkPrinter ? Cura.MachineManager.activeMachineNetworkGroupName : Cura.MachineManager.activeMachineName
|
||||||
|
|
||||||
tooltip: Cura.MachineManager.activeMachineName
|
tooltip: Cura.MachineManager.activeMachineName
|
||||||
|
|
||||||
style: ButtonStyle {
|
style: ButtonStyle
|
||||||
background: Rectangle {
|
{
|
||||||
color: {
|
background: Rectangle
|
||||||
|
{
|
||||||
|
color:
|
||||||
|
{
|
||||||
if (control.pressed) {
|
if (control.pressed) {
|
||||||
return UM.Theme.getColor("sidebar_header_active");
|
return UM.Theme.getColor("sidebar_header_active");
|
||||||
}
|
}
|
||||||
@ -33,7 +38,8 @@ ToolButton {
|
|||||||
}
|
}
|
||||||
Behavior on color { ColorAnimation { duration: 50; } }
|
Behavior on color { ColorAnimation { duration: 50; } }
|
||||||
|
|
||||||
UM.RecolorImage {
|
UM.RecolorImage
|
||||||
|
{
|
||||||
id: downArrow
|
id: downArrow
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
@ -46,18 +52,21 @@ ToolButton {
|
|||||||
source: UM.Theme.getIcon("arrow_bottom")
|
source: UM.Theme.getIcon("arrow_bottom")
|
||||||
}
|
}
|
||||||
|
|
||||||
PrinterStatusIcon {
|
PrinterStatusIcon
|
||||||
|
{
|
||||||
id: printerStatusIcon
|
id: printerStatusIcon
|
||||||
visible: isNetworkPrinter
|
visible: printerConnected
|
||||||
status: printerStatus
|
status: printerStatus
|
||||||
anchors {
|
anchors
|
||||||
|
{
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
left: parent.left
|
left: parent.left
|
||||||
leftMargin: UM.Theme.getSize("sidebar_margin").width
|
leftMargin: UM.Theme.getSize("sidebar_margin").width
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label
|
||||||
|
{
|
||||||
id: sidebarComboBoxLabel
|
id: sidebarComboBoxLabel
|
||||||
color: UM.Theme.getColor("sidebar_header_text_active")
|
color: UM.Theme.getColor("sidebar_header_text_active")
|
||||||
text: control.text;
|
text: control.text;
|
||||||
@ -74,14 +83,4 @@ ToolButton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
menu: PrinterMenu { }
|
menu: PrinterMenu { }
|
||||||
|
|
||||||
// Make the toolbutton react when the outputdevice changes
|
|
||||||
Connections
|
|
||||||
{
|
|
||||||
target: Cura.MachineManager
|
|
||||||
onOutputDevicesChanged:
|
|
||||||
{
|
|
||||||
base.isNetworkPrinter = Cura.MachineManager.activeMachineNetworkKey != ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,8 @@ Rectangle
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MachineSelection {
|
MachineSelection
|
||||||
|
{
|
||||||
id: machineSelection
|
id: machineSelection
|
||||||
width: base.width - configSelection.width - separator.width
|
width: base.width - configSelection.width - separator.width
|
||||||
height: UM.Theme.getSize("sidebar_header").height
|
height: UM.Theme.getSize("sidebar_header").height
|
||||||
@ -105,9 +106,10 @@ Rectangle
|
|||||||
anchors.left: machineSelection.right
|
anchors.left: machineSelection.right
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigurationSelection {
|
ConfigurationSelection
|
||||||
|
{
|
||||||
id: configSelection
|
id: configSelection
|
||||||
visible: isNetworkPrinter && !sidebar.monitoringPrint && !sidebar.hideSettings
|
visible: isNetworkPrinter
|
||||||
width: visible ? Math.round(base.width * 0.15) : 0
|
width: visible ? Math.round(base.width * 0.15) : 0
|
||||||
height: UM.Theme.getSize("sidebar_header").height
|
height: UM.Theme.getSize("sidebar_header").height
|
||||||
anchors.top: base.top
|
anchors.top: base.top
|
||||||
|
Loading…
x
Reference in New Issue
Block a user