mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 02:35:53 +08:00
Merge remote-tracking branch 'origin/3.5'
This commit is contained in:
commit
6929d96119
@ -39,6 +39,7 @@ Item {
|
|||||||
property real lowerValue: minimumValue
|
property real lowerValue: minimumValue
|
||||||
|
|
||||||
property bool layersVisible: true
|
property bool layersVisible: true
|
||||||
|
property bool manuallyChanged: true // Indicates whether the value was changed manually or during simulation
|
||||||
|
|
||||||
function getUpperValueFromSliderHandle() {
|
function getUpperValueFromSliderHandle() {
|
||||||
return upperHandle.getValue()
|
return upperHandle.getValue()
|
||||||
@ -96,7 +97,8 @@ Item {
|
|||||||
visible: sliderRoot.layersVisible
|
visible: sliderRoot.layersVisible
|
||||||
|
|
||||||
// set the new value when dragging
|
// set the new value when dragging
|
||||||
function onHandleDragged () {
|
function onHandleDragged() {
|
||||||
|
sliderRoot.manuallyChanged = true
|
||||||
|
|
||||||
upperHandle.y = y - upperHandle.height
|
upperHandle.y = y - upperHandle.height
|
||||||
lowerHandle.y = y + height
|
lowerHandle.y = y + height
|
||||||
@ -109,7 +111,7 @@ Item {
|
|||||||
UM.SimulationView.setMinimumLayer(lowerValue)
|
UM.SimulationView.setMinimumLayer(lowerValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
function setValue (value) {
|
function setValue(value) {
|
||||||
var range = sliderRoot.upperValue - sliderRoot.lowerValue
|
var range = sliderRoot.upperValue - sliderRoot.lowerValue
|
||||||
value = Math.min(value, sliderRoot.maximumValue)
|
value = Math.min(value, sliderRoot.maximumValue)
|
||||||
value = Math.max(value, sliderRoot.minimumValue + range)
|
value = Math.max(value, sliderRoot.minimumValue + range)
|
||||||
@ -168,7 +170,8 @@ Item {
|
|||||||
color: upperHandleLabel.activeFocus ? sliderRoot.handleActiveColor : sliderRoot.upperHandleColor
|
color: upperHandleLabel.activeFocus ? sliderRoot.handleActiveColor : sliderRoot.upperHandleColor
|
||||||
visible: sliderRoot.layersVisible
|
visible: sliderRoot.layersVisible
|
||||||
|
|
||||||
function onHandleDragged () {
|
function onHandleDragged() {
|
||||||
|
sliderRoot.manuallyChanged = true
|
||||||
|
|
||||||
// don't allow the lower handle to be heigher than the upper handle
|
// don't allow the lower handle to be heigher than the upper handle
|
||||||
if (lowerHandle.y - (y + height) < sliderRoot.minimumRangeHandleSize) {
|
if (lowerHandle.y - (y + height) < sliderRoot.minimumRangeHandleSize) {
|
||||||
@ -183,7 +186,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get the upper value based on the slider position
|
// get the upper value based on the slider position
|
||||||
function getValue () {
|
function getValue() {
|
||||||
var result = y / (sliderRoot.height - (2 * sliderRoot.handleSize + sliderRoot.minimumRangeHandleSize))
|
var result = y / (sliderRoot.height - (2 * sliderRoot.handleSize + sliderRoot.minimumRangeHandleSize))
|
||||||
result = sliderRoot.maximumValue + result * (sliderRoot.minimumValue - (sliderRoot.maximumValue - sliderRoot.minimumValue))
|
result = sliderRoot.maximumValue + result * (sliderRoot.minimumValue - (sliderRoot.maximumValue - sliderRoot.minimumValue))
|
||||||
result = sliderRoot.roundValues ? Math.round(result) : result
|
result = sliderRoot.roundValues ? Math.round(result) : result
|
||||||
@ -191,7 +194,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set the slider position based on the upper value
|
// set the slider position based on the upper value
|
||||||
function setValue (value) {
|
function setValue(value) {
|
||||||
// Normalize values between range, since using arrow keys will create out-of-the-range values
|
// Normalize values between range, since using arrow keys will create out-of-the-range values
|
||||||
value = sliderRoot.normalizeValue(value)
|
value = sliderRoot.normalizeValue(value)
|
||||||
|
|
||||||
@ -205,8 +208,16 @@ Item {
|
|||||||
sliderRoot.updateRangeHandle()
|
sliderRoot.updateRangeHandle()
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onUpPressed: upperHandleLabel.setValue(upperHandleLabel.value + ((event.modifiers & Qt.ShiftModifier) ? 10 : 1))
|
Keys.onUpPressed:
|
||||||
Keys.onDownPressed: upperHandleLabel.setValue(upperHandleLabel.value - ((event.modifiers & Qt.ShiftModifier) ? 10 : 1))
|
{
|
||||||
|
sliderRoot.manuallyChanged = true
|
||||||
|
upperHandleLabel.setValue(upperHandleLabel.value + ((event.modifiers & Qt.ShiftModifier) ? 10 : 1))
|
||||||
|
}
|
||||||
|
Keys.onDownPressed:
|
||||||
|
{
|
||||||
|
sliderRoot.manuallyChanged = true
|
||||||
|
upperHandleLabel.setValue(upperHandleLabel.value - ((event.modifiers & Qt.ShiftModifier) ? 10 : 1))
|
||||||
|
}
|
||||||
|
|
||||||
// dragging
|
// dragging
|
||||||
MouseArea {
|
MouseArea {
|
||||||
@ -256,7 +267,8 @@ Item {
|
|||||||
|
|
||||||
visible: sliderRoot.layersVisible
|
visible: sliderRoot.layersVisible
|
||||||
|
|
||||||
function onHandleDragged () {
|
function onHandleDragged() {
|
||||||
|
sliderRoot.manuallyChanged = true
|
||||||
|
|
||||||
// don't allow the upper handle to be lower than the lower handle
|
// don't allow the upper handle to be lower than the lower handle
|
||||||
if (y - (upperHandle.y + upperHandle.height) < sliderRoot.minimumRangeHandleSize) {
|
if (y - (upperHandle.y + upperHandle.height) < sliderRoot.minimumRangeHandleSize) {
|
||||||
@ -271,7 +283,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get the lower value from the current slider position
|
// get the lower value from the current slider position
|
||||||
function getValue () {
|
function getValue() {
|
||||||
var result = (y - (sliderRoot.handleSize + sliderRoot.minimumRangeHandleSize)) / (sliderRoot.height - (2 * sliderRoot.handleSize + sliderRoot.minimumRangeHandleSize));
|
var result = (y - (sliderRoot.handleSize + sliderRoot.minimumRangeHandleSize)) / (sliderRoot.height - (2 * sliderRoot.handleSize + sliderRoot.minimumRangeHandleSize));
|
||||||
result = sliderRoot.maximumValue - sliderRoot.minimumRange + result * (sliderRoot.minimumValue - (sliderRoot.maximumValue - sliderRoot.minimumRange))
|
result = sliderRoot.maximumValue - sliderRoot.minimumRange + result * (sliderRoot.minimumValue - (sliderRoot.maximumValue - sliderRoot.minimumRange))
|
||||||
result = sliderRoot.roundValues ? Math.round(result) : result
|
result = sliderRoot.roundValues ? Math.round(result) : result
|
||||||
@ -279,7 +291,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set the slider position based on the lower value
|
// set the slider position based on the lower value
|
||||||
function setValue (value) {
|
function setValue(value) {
|
||||||
// Normalize values between range, since using arrow keys will create out-of-the-range values
|
// Normalize values between range, since using arrow keys will create out-of-the-range values
|
||||||
value = sliderRoot.normalizeValue(value)
|
value = sliderRoot.normalizeValue(value)
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ Item {
|
|||||||
property real handleValue: maximumValue
|
property real handleValue: maximumValue
|
||||||
|
|
||||||
property bool pathsVisible: true
|
property bool pathsVisible: true
|
||||||
|
property bool manuallyChanged: true // Indicates whether the value was changed manually or during simulation
|
||||||
|
|
||||||
function getHandleValueFromSliderHandle () {
|
function getHandleValueFromSliderHandle () {
|
||||||
return handle.getValue()
|
return handle.getValue()
|
||||||
@ -97,6 +98,7 @@ Item {
|
|||||||
visible: sliderRoot.pathsVisible
|
visible: sliderRoot.pathsVisible
|
||||||
|
|
||||||
function onHandleDragged () {
|
function onHandleDragged () {
|
||||||
|
sliderRoot.manuallyChanged = true
|
||||||
|
|
||||||
// update the range handle
|
// update the range handle
|
||||||
sliderRoot.updateRangeHandle()
|
sliderRoot.updateRangeHandle()
|
||||||
@ -128,8 +130,16 @@ Item {
|
|||||||
sliderRoot.updateRangeHandle()
|
sliderRoot.updateRangeHandle()
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onRightPressed: handleLabel.setValue(handleLabel.value + ((event.modifiers & Qt.ShiftModifier) ? 10 : 1))
|
Keys.onRightPressed:
|
||||||
Keys.onLeftPressed: handleLabel.setValue(handleLabel.value - ((event.modifiers & Qt.ShiftModifier) ? 10 : 1))
|
{
|
||||||
|
sliderRoot.manuallyChanged = true
|
||||||
|
handleLabel.setValue(handleLabel.value + ((event.modifiers & Qt.ShiftModifier) ? 10 : 1))
|
||||||
|
}
|
||||||
|
Keys.onLeftPressed:
|
||||||
|
{
|
||||||
|
sliderRoot.manuallyChanged = true
|
||||||
|
handleLabel.setValue(handleLabel.value - ((event.modifiers & Qt.ShiftModifier) ? 10 : 1))
|
||||||
|
}
|
||||||
|
|
||||||
// dragging
|
// dragging
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
@ -623,7 +623,15 @@ Item
|
|||||||
{
|
{
|
||||||
target: UM.SimulationView
|
target: UM.SimulationView
|
||||||
onMaxPathsChanged: pathSlider.setHandleValue(UM.SimulationView.currentPath)
|
onMaxPathsChanged: pathSlider.setHandleValue(UM.SimulationView.currentPath)
|
||||||
onCurrentPathChanged: pathSlider.setHandleValue(UM.SimulationView.currentPath)
|
onCurrentPathChanged:
|
||||||
|
{
|
||||||
|
// Only pause the simulation when the layer was changed manually, not when the simulation is running
|
||||||
|
if (pathSlider.manuallyChanged)
|
||||||
|
{
|
||||||
|
playButton.pauseSimulation()
|
||||||
|
}
|
||||||
|
pathSlider.setHandleValue(UM.SimulationView.currentPath)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure the slider handlers show the correct value after switching views
|
// make sure the slider handlers show the correct value after switching views
|
||||||
@ -667,9 +675,14 @@ Item
|
|||||||
{
|
{
|
||||||
target: UM.SimulationView
|
target: UM.SimulationView
|
||||||
onMaxLayersChanged: layerSlider.setUpperValue(UM.SimulationView.currentLayer)
|
onMaxLayersChanged: layerSlider.setUpperValue(UM.SimulationView.currentLayer)
|
||||||
|
onMinimumLayerChanged: layerSlider.setLowerValue(UM.SimulationView.minimumLayer)
|
||||||
onCurrentLayerChanged:
|
onCurrentLayerChanged:
|
||||||
{
|
{
|
||||||
playButton.pauseSimulation()
|
// Only pause the simulation when the layer was changed manually, not when the simulation is running
|
||||||
|
if (layerSlider.manuallyChanged)
|
||||||
|
{
|
||||||
|
playButton.pauseSimulation()
|
||||||
|
}
|
||||||
layerSlider.setUpperValue(UM.SimulationView.currentLayer)
|
layerSlider.setUpperValue(UM.SimulationView.currentLayer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -719,6 +732,8 @@ Item
|
|||||||
iconSource = "./resources/simulation_resume.svg"
|
iconSource = "./resources/simulation_resume.svg"
|
||||||
simulationTimer.stop()
|
simulationTimer.stop()
|
||||||
status = 0
|
status = 0
|
||||||
|
layerSlider.manuallyChanged = true
|
||||||
|
pathSlider.manuallyChanged = true
|
||||||
}
|
}
|
||||||
|
|
||||||
function resumeSimulation()
|
function resumeSimulation()
|
||||||
@ -726,7 +741,8 @@ Item
|
|||||||
UM.SimulationView.setSimulationRunning(true)
|
UM.SimulationView.setSimulationRunning(true)
|
||||||
iconSource = "./resources/simulation_pause.svg"
|
iconSource = "./resources/simulation_pause.svg"
|
||||||
simulationTimer.start()
|
simulationTimer.start()
|
||||||
status = 1
|
layerSlider.manuallyChanged = false
|
||||||
|
pathSlider.manuallyChanged = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -770,7 +786,6 @@ Item
|
|||||||
{
|
{
|
||||||
UM.SimulationView.setCurrentLayer(currentLayer+1)
|
UM.SimulationView.setCurrentLayer(currentLayer+1)
|
||||||
UM.SimulationView.setCurrentPath(0)
|
UM.SimulationView.setCurrentPath(0)
|
||||||
playButton.resumeSimulation()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -778,6 +793,8 @@ Item
|
|||||||
UM.SimulationView.setCurrentPath(currentPath+1)
|
UM.SimulationView.setCurrentPath(currentPath+1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// The status must be set here instead of in the resumeSimulation function otherwise it won't work
|
||||||
|
// correctly, because part of the logic is in this trigger function.
|
||||||
playButton.status = 1
|
playButton.status = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ class Toolbox(QObject, Extension):
|
|||||||
|
|
||||||
self._application = application # type: CuraApplication
|
self._application = application # type: CuraApplication
|
||||||
|
|
||||||
self._sdk_version = None # type: Optional[int]
|
self._sdk_version = None # type: Optional[Union[str, int]]
|
||||||
self._cloud_api_version = None # type: Optional[int]
|
self._cloud_api_version = None # type: Optional[int]
|
||||||
self._cloud_api_root = None # type: Optional[str]
|
self._cloud_api_root = None # type: Optional[str]
|
||||||
self._api_url = None # type: Optional[str]
|
self._api_url = None # type: Optional[str]
|
||||||
@ -207,14 +207,14 @@ class Toolbox(QObject, Extension):
|
|||||||
return cura.CuraVersion.CuraCloudAPIVersion # type: ignore
|
return cura.CuraVersion.CuraCloudAPIVersion # type: ignore
|
||||||
|
|
||||||
# Get the packages version depending on Cura version settings.
|
# Get the packages version depending on Cura version settings.
|
||||||
def _getSDKVersion(self) -> int:
|
def _getSDKVersion(self) -> Union[int, str]:
|
||||||
if not hasattr(cura, "CuraVersion"):
|
if not hasattr(cura, "CuraVersion"):
|
||||||
return self._plugin_registry.APIVersion
|
return self._plugin_registry.APIVersion
|
||||||
if not hasattr(cura.CuraVersion, "CuraSDKVersion"): # type: ignore
|
if not hasattr(cura.CuraVersion, "CuraSDKVersion"): # type: ignore
|
||||||
return self._plugin_registry.APIVersion
|
return self._plugin_registry.APIVersion
|
||||||
if not cura.CuraVersion.CuraSDKVersion: # type: ignore
|
if not cura.CuraVersion.CuraSDKVersion: # type: ignore
|
||||||
return self._plugin_registry.APIVersion
|
return self._plugin_registry.APIVersion
|
||||||
return cura.CuraVersion.CuraSDKVersion # type: ignore
|
return cura.CuraVersion.CuraSDKVersion # type: ignore
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def browsePackages(self) -> None:
|
def browsePackages(self) -> None:
|
||||||
@ -499,17 +499,17 @@ class Toolbox(QObject, Extension):
|
|||||||
local_version = Version(local_package["package_version"])
|
local_version = Version(local_package["package_version"])
|
||||||
remote_version = Version(remote_package["package_version"])
|
remote_version = Version(remote_package["package_version"])
|
||||||
if self._getSDKVersion() == "dev":
|
if self._getSDKVersion() == "dev":
|
||||||
sdk_version = int(self._plugin_registry.APIVersion)
|
sdk_version = self._plugin_registry.APIVersion
|
||||||
else:
|
else:
|
||||||
sdk_version = int(self._getSDKVersion())
|
sdk_version = self._getSDKVersion()
|
||||||
can_upgrade = False
|
can_upgrade = False
|
||||||
if remote_version > local_version:
|
if remote_version > local_version:
|
||||||
can_upgrade = True
|
can_upgrade = True
|
||||||
# A package with the same version can be built to have different SDK versions. So, for a package with the same
|
# A package with the same version can be built to have different SDK versions. So, for a package with the same
|
||||||
# version, we also need to check if the current one has a lower SDK version. If so, this package should also
|
# version, we also need to check if the current one has a lower SDK version. If so, this package should also
|
||||||
# be upgradable.
|
# be upgradable.
|
||||||
elif remote_version == local_version and local_package.get("sdk_version", 0) < sdk_version:
|
elif remote_version == local_version:
|
||||||
can_upgrade = True
|
can_upgrade = local_package.get("sdk_version", 0) < remote_package.get("sdk_version", 0)
|
||||||
|
|
||||||
return can_upgrade
|
return can_upgrade
|
||||||
|
|
||||||
|
@ -45,7 +45,11 @@ Item
|
|||||||
Component.onCompleted: materialListView.expandActiveMaterial(active_root_material_id)
|
Component.onCompleted: materialListView.expandActiveMaterial(active_root_material_id)
|
||||||
|
|
||||||
// Every time the selected item has changed, notify to the details panel
|
// Every time the selected item has changed, notify to the details panel
|
||||||
onCurrentItemChanged: materialDetailsPanel.currentItem = currentItem
|
onCurrentItemChanged:
|
||||||
|
{
|
||||||
|
forceActiveFocus()
|
||||||
|
materialDetailsPanel.currentItem = currentItem
|
||||||
|
}
|
||||||
|
|
||||||
// Main layout
|
// Main layout
|
||||||
Label
|
Label
|
||||||
|
Loading…
x
Reference in New Issue
Block a user