update the setting table while loading ucp the seond time

CURA-11403
This commit is contained in:
Saumya Jain 2024-03-04 11:58:21 +01:00
parent 72f6540627
commit f19320cad8
3 changed files with 16 additions and 2 deletions

View File

@ -3,6 +3,7 @@
from PyQt6.QtCore import Qt
from UM.Logger import Logger
from UM.Settings.SettingDefinition import SettingDefinition
from UM.Qt.ListModel import ListModel
@ -19,6 +20,8 @@ class SpecificSettingsModel(ListModel):
self.addRoleName(self.ValueRole, "value")
self._i18n_catalog = None
self._update()
def addSettingsFromStack(self, stack, category, settings):
for setting, value in settings.items():
@ -36,3 +39,8 @@ class SpecificSettingsModel(ListModel):
"label": stack.getProperty(setting, "label"),
"value": value
})
def _update(self):
Logger.log("d", "Updating {model_class_name}.".format(model_class_name = self.__class__.__name__))
self.setItems([])
return

View File

@ -332,7 +332,7 @@ class WorkspaceDialog(QObject):
def allowCreateMachine(self):
return self._allow_create_machine
@pyqtProperty(QObject, constant = True)
@pyqtProperty(QObject)
def exportedSettingModel(self):
return self._exported_settings_model

View File

@ -216,7 +216,6 @@ UM.Dialog
buttonText: tableViewSpecificSettings.shouldBeVisible ? catalog.i18nc("@action:button", "Hide settings") : catalog.i18nc("@action:button", "Show settings")
onButtonClicked: tableViewSpecificSettings.shouldBeVisible = !tableViewSpecificSettings.shouldBeVisible
}
Cura.TableView
{
id: tableViewSpecificSettings
@ -239,6 +238,13 @@ UM.Dialog
rows: manager.exportedSettingModel.items
}
}
property var modelRows: manager.exportedSettingModel.items
onModelRowsChanged:
{
tableModel.clear()
tableModel.rows = modelRows
}
}
comboboxVisible: manager.qualityChangesConflict