mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-08 14:34:01 -06:00
Add Shortcut action Ctrl+P to slice or stop slicing.
Contributes to CURA-5786.
This commit is contained in:
parent
79ed15aee1
commit
45af4eec90
1 changed files with 44 additions and 14 deletions
|
@ -4,6 +4,7 @@
|
|||
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
|
||||
|
@ -25,12 +26,24 @@ Column
|
|||
property real progress: UM.Backend.progress
|
||||
property int backendState: UM.Backend.state
|
||||
|
||||
function sliceOrStopSlicing()
|
||||
{
|
||||
if ([1, 5].indexOf(widget.backendState) != -1) // == BackendState.NotStarted or BackendState.Disabled
|
||||
{
|
||||
CuraApplication.backend.forceSlice()
|
||||
}
|
||||
else
|
||||
{
|
||||
CuraApplication.backend.stopSlicing()
|
||||
}
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
id: message
|
||||
width: parent.width
|
||||
height: childrenRect.height
|
||||
visible: widget.backendState == 4
|
||||
visible: widget.backendState == 4 // == BackendState.Error
|
||||
|
||||
UM.RecolorImage
|
||||
{
|
||||
|
@ -66,7 +79,7 @@ Column
|
|||
width: parent.width
|
||||
height: UM.Theme.getSize("progressbar").height
|
||||
value: progress
|
||||
visible: widget.backendState == 2
|
||||
visible: widget.backendState == 2 // == BackendState.Processing
|
||||
|
||||
background: Rectangle
|
||||
{
|
||||
|
@ -93,7 +106,21 @@ Column
|
|||
id: prepareButton
|
||||
width: parent.width
|
||||
height: UM.Theme.getSize("action_panel_button").height
|
||||
text: autoSlice ? catalog.i18nc("@button", "Auto slicing...") : (widget.backendState == 1 ? catalog.i18nc("@button", "Slice") : catalog.i18nc("@button", "Cancel"))
|
||||
text:
|
||||
{
|
||||
if (autoSlice)
|
||||
{
|
||||
return catalog.i18nc("@button", "Auto slicing...")
|
||||
}
|
||||
else if ([1, 5].indexOf(widget.backendState) != -1) // == BackendState.NotStarted or BackendState.Disabled
|
||||
{
|
||||
return catalog.i18nc("@button", "Slice")
|
||||
}
|
||||
else
|
||||
{
|
||||
return catalog.i18nc("@button", "Cancel")
|
||||
}
|
||||
}
|
||||
enabled: !autoSlice
|
||||
|
||||
// Get the current value from the preferences
|
||||
|
@ -103,17 +130,7 @@ Column
|
|||
textDisabledColor: UM.Theme.getColor("primary")
|
||||
outlineDisabledColor: "transparent"
|
||||
|
||||
onClicked:
|
||||
{
|
||||
if ([1, 5].indexOf(widget.backendState) != -1)
|
||||
{
|
||||
CuraApplication.backend.forceSlice()
|
||||
}
|
||||
else
|
||||
{
|
||||
CuraApplication.backend.stopSlicing()
|
||||
}
|
||||
}
|
||||
onClicked: sliceOrStopSlicing()
|
||||
}
|
||||
|
||||
// React when the user changes the preference of having the auto slice enabled
|
||||
|
@ -126,4 +143,17 @@ Column
|
|||
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