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

View File

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

View File

@ -184,8 +184,9 @@ UM.Dialog
WorkspaceRow WorkspaceRow
{ {
id: numberOfOverrides
leftLabelText: catalog.i18nc("@action:label", "Settings Loaded from UCP file") 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") buttonText: tableViewSpecificSettings.shouldBeVisible ? catalog.i18nc("@action:button", "Hide settings") : catalog.i18nc("@action:button", "Show settings")
onButtonClicked: tableViewSpecificSettings.shouldBeVisible = !tableViewSpecificSettings.shouldBeVisible onButtonClicked: tableViewSpecificSettings.shouldBeVisible = !tableViewSpecificSettings.shouldBeVisible
} }

View File

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

View File

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