mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-29 23:34:32 +08:00

Gracefully handle the case where the machine manager is requested to delete the last machine in Cura. In this case, instead of deleting everything of this machine and still keep it as an active machine, the machine manager will set the active machine to None. The QML files which depend on the active machine were changed to properly handle themselves when there is no active machine. CURA-7454
44 lines
1.3 KiB
QML
44 lines
1.3 KiB
QML
// Copyright (c) 2018 Ultimaker B.V.
|
|
// Cura is released under the terms of the LGPLv3 or higher.
|
|
|
|
import QtQuick 2.7
|
|
import QtQuick.Controls 2.3
|
|
|
|
import UM 1.2 as UM
|
|
import Cura 1.0 as Cura
|
|
|
|
ListView
|
|
{
|
|
id: listView
|
|
model: Cura.GlobalStacksModel {}
|
|
section.property: "hasRemoteConnection"
|
|
property real contentHeight: childrenRect.height
|
|
|
|
section.delegate: Label
|
|
{
|
|
text: section == "true" ? catalog.i18nc("@label", "Connected printers") : catalog.i18nc("@label", "Preset printers")
|
|
width: parent.width
|
|
height: UM.Theme.getSize("action_button").height
|
|
leftPadding: UM.Theme.getSize("default_margin").width
|
|
renderType: Text.NativeRendering
|
|
font: UM.Theme.getFont("medium")
|
|
color: UM.Theme.getColor("text_medium")
|
|
verticalAlignment: Text.AlignVCenter
|
|
}
|
|
|
|
delegate: MachineSelectorButton
|
|
{
|
|
text: model.name ? model.name : ""
|
|
width: listView.width
|
|
outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
|
|
|
|
checked: Cura.MachineManager.activeMachine ? Cura.MachineManager.activeMachine.id == model.id : false
|
|
|
|
onClicked:
|
|
{
|
|
toggleContent()
|
|
Cura.MachineManager.setActiveMachine(model.id)
|
|
}
|
|
}
|
|
}
|