mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 15:37:27 -06:00
CURA-5518 Check whether the the findDefinitionContainers return any
element or not.
This commit is contained in:
parent
6737dfac47
commit
56c7c6f2b2
2 changed files with 8 additions and 2 deletions
|
@ -216,7 +216,10 @@ class MachineManager(QObject):
|
||||||
|
|
||||||
@pyqtProperty(int, constant=True)
|
@pyqtProperty(int, constant=True)
|
||||||
def totalNumberOfSettings(self) -> int:
|
def totalNumberOfSettings(self) -> int:
|
||||||
return len(ContainerRegistry.getInstance().findDefinitionContainers(id = "fdmprinter")[0].getAllKeys())
|
general_definition_containers = ContainerRegistry.getInstance().findDefinitionContainers(id = "fdmprinter")
|
||||||
|
if not general_definition_containers:
|
||||||
|
return 0
|
||||||
|
return len(general_definition_containers[0].getAllKeys())
|
||||||
|
|
||||||
def _onGlobalContainerChanged(self) -> None:
|
def _onGlobalContainerChanged(self) -> None:
|
||||||
if self._global_container_stack:
|
if self._global_container_stack:
|
||||||
|
|
|
@ -187,7 +187,10 @@ class WorkspaceDialog(QObject):
|
||||||
|
|
||||||
@pyqtProperty(int, constant = True)
|
@pyqtProperty(int, constant = True)
|
||||||
def totalNumberOfSettings(self):
|
def totalNumberOfSettings(self):
|
||||||
return len(ContainerRegistry.getInstance().findDefinitionContainers(id="fdmprinter")[0].getAllKeys())
|
general_definition_containers = ContainerRegistry.getInstance().findDefinitionContainers(id = "fdmprinter")
|
||||||
|
if not general_definition_containers:
|
||||||
|
return 0
|
||||||
|
return len(general_definition_containers[0].getAllKeys())
|
||||||
|
|
||||||
@pyqtProperty(int, notify = numVisibleSettingsChanged)
|
@pyqtProperty(int, notify = numVisibleSettingsChanged)
|
||||||
def numVisibleSettings(self):
|
def numVisibleSettings(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue