mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-08 22:35:03 -06:00
In the main action panel, only show the total amount of material weight
and length (addition of all extruders). The information panel will show each cost separately. Contributes to CURA-5786.
This commit is contained in:
parent
b03695dec6
commit
310539cb6d
4 changed files with 9 additions and 12 deletions
53
resources/qml/ActionPanel/ActionPanelWidget.qml
Normal file
53
resources/qml/ActionPanel/ActionPanelWidget.qml
Normal file
|
@ -0,0 +1,53 @@
|
|||
// 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.1
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
import UM 1.2 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
Rectangle
|
||||
{
|
||||
id: actionPanelWidget
|
||||
|
||||
width: childrenRect.width + 2 * UM.Theme.getSize("thick_margin").width
|
||||
height: childrenRect.height + 2 * UM.Theme.getSize("thick_margin").height
|
||||
|
||||
color: UM.Theme.getColor("main_background")
|
||||
border.width: UM.Theme.getSize("default_lining").width
|
||||
border.color: UM.Theme.getColor("lining")
|
||||
radius: UM.Theme.getSize("default_radius").width
|
||||
visible: CuraApplication.platformActivity
|
||||
|
||||
property bool outputAvailable: UM.Backend.state == UM.Backend.Done || UM.Backend.state == UM.Backend.Disabled
|
||||
|
||||
Loader
|
||||
{
|
||||
id: loader
|
||||
anchors
|
||||
{
|
||||
top: parent.top
|
||||
topMargin: UM.Theme.getSize("thick_margin").height
|
||||
left: parent.left
|
||||
leftMargin: UM.Theme.getSize("thick_margin").width
|
||||
}
|
||||
sourceComponent: outputAvailable ? outputProcessWidget : sliceProcessWidget
|
||||
}
|
||||
|
||||
Behavior on height { NumberAnimation { duration: 100 } }
|
||||
Behavior on width { NumberAnimation { duration: 100 } }
|
||||
|
||||
Component
|
||||
{
|
||||
id: sliceProcessWidget
|
||||
SliceProcessWidget { }
|
||||
}
|
||||
|
||||
Component
|
||||
{
|
||||
id: outputProcessWidget
|
||||
OutputProcessWidget { }
|
||||
}
|
||||
}
|
103
resources/qml/ActionPanel/OutputDevicesActionButton.qml
Normal file
103
resources/qml/ActionPanel/OutputDevicesActionButton.qml
Normal file
|
@ -0,0 +1,103 @@
|
|||
// 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.1
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
import UM 1.1 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
Item
|
||||
{
|
||||
id: widget
|
||||
|
||||
Cura.ActionButton
|
||||
{
|
||||
id: saveToButton
|
||||
height: parent.height
|
||||
|
||||
anchors
|
||||
{
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: deviceSelectionMenu.visible ? deviceSelectionMenu.left : parent.right
|
||||
}
|
||||
|
||||
tooltip: UM.OutputDeviceManager.activeDeviceDescription
|
||||
|
||||
text: UM.OutputDeviceManager.activeDeviceShortDescription
|
||||
|
||||
onClicked:
|
||||
{
|
||||
forceActiveFocus();
|
||||
UM.OutputDeviceManager.requestWriteToDevice(UM.OutputDeviceManager.activeDevice, PrintInformation.jobName,
|
||||
{ "filter_by_machine": true, "preferred_mimetypes": Cura.MachineManager.activeMachine.preferred_output_file_formats });
|
||||
}
|
||||
}
|
||||
|
||||
Cura.ActionButton
|
||||
{
|
||||
id: deviceSelectionMenu
|
||||
height: parent.height
|
||||
|
||||
anchors
|
||||
{
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
}
|
||||
|
||||
tooltip: catalog.i18nc("@info:tooltip", "Select the active output device")
|
||||
iconSource: popup.opened ? UM.Theme.getIcon("arrow_top") : UM.Theme.getIcon("arrow_bottom")
|
||||
color: UM.Theme.getColor("action_panel_secondary")
|
||||
visible: (devicesModel.deviceCount > 1)
|
||||
|
||||
onClicked: popup.opened ? popup.close() : popup.open()
|
||||
|
||||
Popup
|
||||
{
|
||||
id: popup
|
||||
padding: 0
|
||||
|
||||
y: -height
|
||||
x: parent.width - width
|
||||
|
||||
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
|
||||
|
||||
contentItem: Column
|
||||
{
|
||||
Repeater
|
||||
{
|
||||
model: devicesModel
|
||||
|
||||
delegate: Cura.ActionButton
|
||||
{
|
||||
text: model.description
|
||||
color: "transparent"
|
||||
outlineColor: "transparent"
|
||||
cornerRadius: 0
|
||||
hoverColor: UM.Theme.getColor("primary")
|
||||
|
||||
onClicked:
|
||||
{
|
||||
UM.OutputDeviceManager.setActiveDevice(model.id)
|
||||
popup.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
background: Rectangle
|
||||
{
|
||||
opacity: visible ? 1 : 0
|
||||
Behavior on opacity { NumberAnimation { duration: 100 } }
|
||||
radius: UM.Theme.getSize("default_radius")
|
||||
color: UM.Theme.getColor("action_panel_secondary")
|
||||
border.color: UM.Theme.getColor("lining")
|
||||
border.width: UM.Theme.getSize("default_lining").width
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UM.OutputDevicesModel { id: devicesModel }
|
||||
}
|
131
resources/qml/ActionPanel/OutputProcessWidget.qml
Normal file
131
resources/qml/ActionPanel/OutputProcessWidget.qml
Normal file
|
@ -0,0 +1,131 @@
|
|||
// 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.1
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtQuick.Controls 1.4 as Controls1
|
||||
|
||||
import UM 1.1 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
Column
|
||||
{
|
||||
id: widget
|
||||
|
||||
spacing: UM.Theme.getSize("thin_margin").height
|
||||
|
||||
UM.I18nCatalog
|
||||
{
|
||||
id: catalog
|
||||
name: "cura"
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
id: information
|
||||
width: parent.width
|
||||
height: childrenRect.height
|
||||
|
||||
Column
|
||||
{
|
||||
id: timeAndCostsInformation
|
||||
spacing: UM.Theme.getSize("thin_margin").height
|
||||
|
||||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
right: moreInformationIcon.left
|
||||
rightMargin: UM.Theme.getSize("thin_margin").height
|
||||
}
|
||||
|
||||
Cura.IconLabel
|
||||
{
|
||||
id: estimatedTime
|
||||
width: parent.width
|
||||
|
||||
property var printDuration: PrintInformation.currentPrintTime
|
||||
|
||||
text: printDuration.getDisplayString(UM.DurationFormat.Long)
|
||||
source: UM.Theme.getIcon("clock")
|
||||
font: UM.Theme.getFont("small")
|
||||
}
|
||||
|
||||
Cura.IconLabel
|
||||
{
|
||||
id: estimatedCosts
|
||||
width: parent.width
|
||||
|
||||
property var printMaterialLengths: PrintInformation.materialLengths
|
||||
property var printMaterialWeights: PrintInformation.materialWeights
|
||||
|
||||
function getText()
|
||||
{
|
||||
var totalLengths = 0
|
||||
var totalWeights = 0
|
||||
if (printMaterialLengths)
|
||||
{
|
||||
for(var index = 0; index < printMaterialLengths.length; index++)
|
||||
{
|
||||
if(printMaterialLengths[index] > 0)
|
||||
{
|
||||
totalLengths += printMaterialLengths[index]
|
||||
totalWeights += Math.round(printMaterialWeights[index])
|
||||
}
|
||||
}
|
||||
}
|
||||
return totalWeights + "g · " + totalLengths.toFixed(2) + "m"
|
||||
}
|
||||
|
||||
text: getText()
|
||||
source: UM.Theme.getIcon("spool")
|
||||
font: UM.Theme.getFont("very_small")
|
||||
}
|
||||
}
|
||||
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: moreInformationIcon
|
||||
|
||||
anchors
|
||||
{
|
||||
right: parent.right
|
||||
verticalCenter: timeAndCostsInformation.verticalCenter
|
||||
}
|
||||
|
||||
source: UM.Theme.getIcon("info")
|
||||
width: UM.Theme.getSize("section_icon").width
|
||||
height: UM.Theme.getSize("section_icon").height
|
||||
|
||||
sourceSize.width: width
|
||||
sourceSize.height: height
|
||||
|
||||
color: UM.Theme.getColor("text_medium")
|
||||
}
|
||||
}
|
||||
|
||||
Row
|
||||
{
|
||||
id: buttonRow
|
||||
spacing: UM.Theme.getSize("default_margin").width
|
||||
|
||||
Cura.ActionButton
|
||||
{
|
||||
leftPadding: UM.Theme.getSize("default_margin").width
|
||||
rightPadding: UM.Theme.getSize("default_margin").width
|
||||
height: UM.Theme.getSize("action_panel_button").height
|
||||
text: catalog.i18nc("@button", "Preview")
|
||||
color: UM.Theme.getColor("secondary")
|
||||
hoverColor: UM.Theme.getColor("secondary")
|
||||
textColor: UM.Theme.getColor("primary")
|
||||
textHoverColor: UM.Theme.getColor("text")
|
||||
onClicked: UM.Controller.setActiveStage("MonitorStage")
|
||||
}
|
||||
|
||||
Cura.OutputDevicesActionButton
|
||||
{
|
||||
width: UM.Theme.getSize("action_panel_button").width
|
||||
height: UM.Theme.getSize("action_panel_button").height
|
||||
}
|
||||
}
|
||||
}
|
136
resources/qml/ActionPanel/SliceProcessWidget.qml
Normal file
136
resources/qml/ActionPanel/SliceProcessWidget.qml
Normal file
|
@ -0,0 +1,136 @@
|
|||
// 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.1
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtQuick.Controls 1.4 as Controls1
|
||||
|
||||
import UM 1.1 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
Column
|
||||
{
|
||||
id: widget
|
||||
|
||||
width: UM.Theme.getSize("action_panel_button").width
|
||||
|
||||
spacing: UM.Theme.getSize("thin_margin").height
|
||||
|
||||
UM.I18nCatalog
|
||||
{
|
||||
id: catalog
|
||||
name: "cura"
|
||||
}
|
||||
|
||||
property real progress: UM.Backend.progress
|
||||
property int backendState: UM.Backend.state
|
||||
|
||||
function sliceOrStopSlicing()
|
||||
{
|
||||
if (widget.backendState == UM.Backend.NotStarted)
|
||||
{
|
||||
CuraApplication.backend.forceSlice()
|
||||
}
|
||||
else
|
||||
{
|
||||
CuraApplication.backend.stopSlicing()
|
||||
}
|
||||
}
|
||||
|
||||
Cura.IconLabel
|
||||
{
|
||||
id: message
|
||||
width: parent.width
|
||||
visible: widget.backendState == UM.Backend.Error
|
||||
|
||||
text: catalog.i18nc("@label:PrintjobStatus", "Unable to Slice")
|
||||
source: UM.Theme.getIcon("warning")
|
||||
color: UM.Theme.getColor("warning")
|
||||
font: UM.Theme.getFont("very_small")
|
||||
}
|
||||
|
||||
// Progress bar, only visible when the backend is in the process of slice the printjob
|
||||
ProgressBar
|
||||
{
|
||||
id: progressBar
|
||||
width: parent.width
|
||||
height: UM.Theme.getSize("progressbar").height
|
||||
value: progress
|
||||
visible: widget.backendState == UM.Backend.Processing
|
||||
|
||||
background: Rectangle
|
||||
{
|
||||
anchors.fill: parent
|
||||
radius: UM.Theme.getSize("progressbar_radius").width
|
||||
color: UM.Theme.getColor("progressbar_background")
|
||||
}
|
||||
|
||||
contentItem: Item
|
||||
{
|
||||
anchors.fill: parent
|
||||
Rectangle
|
||||
{
|
||||
width: progressBar.visualPosition * parent.width
|
||||
height: parent.height
|
||||
radius: UM.Theme.getSize("progressbar_radius").width
|
||||
color: UM.Theme.getColor("progressbar_control")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Cura.ActionButton
|
||||
{
|
||||
id: prepareButton
|
||||
width: parent.width
|
||||
height: UM.Theme.getSize("action_panel_button").height
|
||||
text:
|
||||
{
|
||||
if ([UM.Backend.NotStarted, UM.Backend.Error].indexOf(widget.backendState) != -1)
|
||||
{
|
||||
return catalog.i18nc("@button", "Slice")
|
||||
}
|
||||
if (autoSlice)
|
||||
{
|
||||
return catalog.i18nc("@button", "Auto slicing...")
|
||||
}
|
||||
return catalog.i18nc("@button", "Cancel")
|
||||
}
|
||||
enabled: !autoSlice && !disabledSlice
|
||||
|
||||
// Get the current value from the preferences
|
||||
property bool autoSlice: UM.Preferences.getValue("general/auto_slice")
|
||||
// Disable the slice process when
|
||||
property bool disabledSlice: [UM.Backend.Done, UM.Backend.Error].indexOf(widget.backendState) != -1
|
||||
|
||||
disabledColor: disabledSlice ? UM.Theme.getColor("action_button_disabled") : "transparent"
|
||||
textDisabledColor: disabledSlice ? UM.Theme.getColor("action_button_disabled_text") : UM.Theme.getColor("primary")
|
||||
outlineDisabledColor: disabledSlice ? UM.Theme.getColor("action_button_disabled_border") : "transparent"
|
||||
|
||||
onClicked: sliceOrStopSlicing()
|
||||
}
|
||||
|
||||
// React when the user changes the preference of having the auto slice enabled
|
||||
Connections
|
||||
{
|
||||
target: UM.Preferences
|
||||
onPreferenceChanged:
|
||||
{
|
||||
var autoSlice = UM.Preferences.getValue("general/auto_slice")
|
||||
prepareButton.autoSlice = autoSlice
|
||||
}
|
||||
}
|
||||
|
||||
// Shortcut for "slice/stop"
|
||||
Controls1.Action
|
||||
{
|
||||
shortcut: "Ctrl+P"
|
||||
onTriggered:
|
||||
{
|
||||
if (prepareButton.enabled)
|
||||
{
|
||||
sliceOrStopSlicing()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue