code review fixed for PAP

CURA-11403
This commit is contained in:
Saumya Jain 2024-03-05 14:08:39 +01:00
parent 3312ab66ba
commit 3e23ce1c37
4 changed files with 8 additions and 8 deletions

View file

@ -1985,7 +1985,7 @@ class CuraApplication(QtApplication):
file_name = QUrl(file).toLocalFile()
workspace_reader = self.getWorkspaceFileHandler()
if workspace_reader is None:
Logger.log("w", "Workspace reader not found")
Logger.warning(f"Workspace reader not found, cannot read file {file_name}.")
return
workspace_reader.getReaderForFile(file_name).setOpenAsUcp(True)

View file

@ -41,6 +41,6 @@ class SpecificSettingsModel(ListModel):
})
def _update(self):
Logger.log("d", "Updating {model_class_name}.".format(model_class_name = self.__class__.__name__))
Logger.debug(f"Updating {self.__class__.__name__}")
self.setItems([])
return

View file

@ -184,11 +184,11 @@ class WorkspaceDialog(QObject):
return self._current_machine_name
@staticmethod
def getIndexOfCurrentMachine(list_of_dicts, key, value):
def getIndexOfCurrentMachine(list_of_dicts, key, value, defaultIndex):
for i, d in enumerate(list_of_dicts):
if d.get(key) == value: # found the dictionary
return i;
return 0
return i
return defaultIndex
@pyqtProperty(int, notify = machineNameChanged)
def currentMachinePositionIndex(self):
@ -197,7 +197,7 @@ class WorkspaceDialog(QObject):
@pyqtProperty(QObject, notify = updatableMachinesChanged)
def updatableMachinesModel(self) -> MachineListModel:
if self._current_machine_name != "":
self._current_machine_pos_index = self.getIndexOfCurrentMachine(self._updatable_machines_model.getItems(), "id", self._current_machine_name)
self._current_machine_pos_index = self.getIndexOfCurrentMachine(self._updatable_machines_model.getItems(), "id", self._current_machine_name, defaultIndex = 0)
else:
self._current_machine_pos_index = 0
return cast(MachineListModel, self._updatable_machines_model)

View file

@ -19,7 +19,7 @@ RowLayout
Layout.preferredWidth: UM.Theme.getSize("setting").width
checked: modelData.selected
onClicked: modelData.selected = checked
tooltip: modelData.selectable ? "" :catalog.i18nc("@tooltip", "This setting may not perform well while exporting in UCP. Users are asked to add it at their own risk")
tooltip: modelData.selectable ? "" :catalog.i18nc("@tooltip", "This setting may not perform well while exporting to UCP. Users are asked to add it at their own risk.")
}
UM.Label
@ -31,7 +31,7 @@ RowLayout
{
UM.I18nCatalog { id: catalog; name: "cura" }
text: catalog.i18nc("@tooltip",
"This setting may not perform well while exporting in UCP, Users are asked to add it at their own risk")
"This setting may not perform well while exporting to UCP, Users are asked to add it at their own risk.")
visible: !modelData.selectable
}