mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 06:05:52 +08:00
Add Shortcut action Ctrl+P to slice or stop slicing.
Contributes to CURA-5786.
This commit is contained in:
parent
79ed15aee1
commit
45af4eec90
@ -4,6 +4,7 @@
|
|||||||
import QtQuick 2.7
|
import QtQuick 2.7
|
||||||
import QtQuick.Controls 2.1
|
import QtQuick.Controls 2.1
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
|
import QtQuick.Controls 1.4 as Controls1
|
||||||
|
|
||||||
import UM 1.1 as UM
|
import UM 1.1 as UM
|
||||||
import Cura 1.0 as Cura
|
import Cura 1.0 as Cura
|
||||||
@ -25,12 +26,24 @@ Column
|
|||||||
property real progress: UM.Backend.progress
|
property real progress: UM.Backend.progress
|
||||||
property int backendState: UM.Backend.state
|
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
|
Item
|
||||||
{
|
{
|
||||||
id: message
|
id: message
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: childrenRect.height
|
height: childrenRect.height
|
||||||
visible: widget.backendState == 4
|
visible: widget.backendState == 4 // == BackendState.Error
|
||||||
|
|
||||||
UM.RecolorImage
|
UM.RecolorImage
|
||||||
{
|
{
|
||||||
@ -66,7 +79,7 @@ Column
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
height: UM.Theme.getSize("progressbar").height
|
height: UM.Theme.getSize("progressbar").height
|
||||||
value: progress
|
value: progress
|
||||||
visible: widget.backendState == 2
|
visible: widget.backendState == 2 // == BackendState.Processing
|
||||||
|
|
||||||
background: Rectangle
|
background: Rectangle
|
||||||
{
|
{
|
||||||
@ -93,7 +106,21 @@ Column
|
|||||||
id: prepareButton
|
id: prepareButton
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: UM.Theme.getSize("action_panel_button").height
|
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
|
enabled: !autoSlice
|
||||||
|
|
||||||
// Get the current value from the preferences
|
// Get the current value from the preferences
|
||||||
@ -103,17 +130,7 @@ Column
|
|||||||
textDisabledColor: UM.Theme.getColor("primary")
|
textDisabledColor: UM.Theme.getColor("primary")
|
||||||
outlineDisabledColor: "transparent"
|
outlineDisabledColor: "transparent"
|
||||||
|
|
||||||
onClicked:
|
onClicked: sliceOrStopSlicing()
|
||||||
{
|
|
||||||
if ([1, 5].indexOf(widget.backendState) != -1)
|
|
||||||
{
|
|
||||||
CuraApplication.backend.forceSlice()
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CuraApplication.backend.stopSlicing()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// React when the user changes the preference of having the auto slice enabled
|
// React when the user changes the preference of having the auto slice enabled
|
||||||
@ -126,4 +143,17 @@ Column
|
|||||||
prepareButton.autoSlice = autoSlice
|
prepareButton.autoSlice = autoSlice
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Shortcut for "slice/stop"
|
||||||
|
Controls1.Action
|
||||||
|
{
|
||||||
|
shortcut: "Ctrl+P"
|
||||||
|
onTriggered:
|
||||||
|
{
|
||||||
|
if (prepareButton.enabled)
|
||||||
|
{
|
||||||
|
sliceOrStopSlicing()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user