Merge remote-tracking branch 'origin/5.7' into 5.7-translations

This commit is contained in:
Erwan MATHIEU 2024-03-20 09:24:10 +01:00
commit 5de2969abf
5 changed files with 15 additions and 5 deletions

View file

@ -1,7 +1,7 @@
# Copyright (c) 2024 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from PyQt6.QtCore import Qt
from PyQt6.QtCore import Qt, pyqtSignal
from UM.Logger import Logger
from UM.Settings.SettingDefinition import SettingDefinition
@ -22,6 +22,8 @@ class SpecificSettingsModel(ListModel):
self._i18n_catalog = None
self._update()
modelChanged = pyqtSignal()
def addSettingsFromStack(self, stack, category, settings):
for setting, value in settings.items():
@ -39,8 +41,10 @@ class SpecificSettingsModel(ListModel):
"label": stack.getProperty(setting, "label"),
"value": value
})
self.modelChanged.emit()
def _update(self):
Logger.debug(f"Updating {self.__class__.__name__}")
self.setItems([])
self.modelChanged.emit()
return

View file

@ -77,6 +77,7 @@ class WorkspaceDialog(QObject):
self._is_compatible_machine = False
self._allow_create_machine = True
self._exported_settings_model = SpecificSettingsModel()
self._exported_settings_model.modelChanged.connect(self.exportedSettingModelChanged.emit)
self._current_machine_pos_index = 0
self._is_ucp = False
@ -104,6 +105,7 @@ class WorkspaceDialog(QObject):
missingPackagesChanged = pyqtSignal()
isCompatibleMachineChanged = pyqtSignal()
isUcpChanged = pyqtSignal()
exportedSettingModelChanged = pyqtSignal()
@pyqtProperty(bool, notify = isPrinterGroupChanged)
def isPrinterGroup(self) -> bool:
@ -356,10 +358,13 @@ class WorkspaceDialog(QObject):
def allowCreateMachine(self):
return self._allow_create_machine
@pyqtProperty(QObject)
@pyqtProperty(QObject, notify=exportedSettingModelChanged)
def exportedSettingModel(self):
return self._exported_settings_model
@pyqtProperty(int, notify=exportedSettingModelChanged)
def exportedSettingModelRowCount(self):
return self._exported_settings_model.rowCount()
@pyqtSlot()
def closeBackend(self) -> None:
"""Close the backend: otherwise one could end up with "Slicing..."""

View file

@ -184,8 +184,9 @@ UM.Dialog
WorkspaceRow
{
id: numberOfOverrides
leftLabelText: catalog.i18nc("@action:label", "Settings Loaded from UCP file")
rightLabelText: catalog.i18ncp("@action:label", "%1 override", "%1 overrides", manager.exportedSettingModel.rowCount()).arg(manager.exportedSettingModel.rowCount())
rightLabelText: catalog.i18ncp("@action:label", "%1 override", "%1 overrides", manager.exportedSettingModelRowCount).arg(manager.exportedSettingModelRowCount)
buttonText: tableViewSpecificSettings.shouldBeVisible ? catalog.i18nc("@action:button", "Hide settings") : catalog.i18nc("@action:button", "Show settings")
onButtonClicked: tableViewSpecificSettings.shouldBeVisible = !tableViewSpecificSettings.shouldBeVisible
}

View file

@ -91,11 +91,11 @@ Item
}
}
Loader
{
width: parent.width
height: content.height
z: -1
anchors.top: sectionTitleRow.bottom
sourceComponent: content
}

View file

@ -153,7 +153,7 @@ class SimulationPass(RenderPass):
# In the current layer, we show just the indicated paths
if layer == self._layer_view._current_layer_num:
# We look for the position of the head, searching the point of the current path
index = int(self._layer_view.getCurrentPath())
index = int(self._layer_view.getCurrentPath()) if self._layer_view.getCurrentPath() else 0
for polygon in layer_data.getLayer(layer).polygons:
# The size indicates all values in the two-dimension array, and the second dimension is
# always size 3 because we have 3D points.