mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-10 08:17:49 -06:00
Cleanup MachineManagementModel
This commit is contained in:
parent
50bf61d823
commit
496c8f2f79
1 changed files with 13 additions and 10 deletions
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
from UM.Qt.ListModel import ListModel
|
from UM.Qt.ListModel import ListModel
|
||||||
|
|
||||||
from PyQt5.QtCore import pyqtSlot, pyqtProperty, Qt, pyqtSignal
|
from PyQt5.QtCore import Qt
|
||||||
|
|
||||||
from UM.Settings.ContainerRegistry import ContainerRegistry
|
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||||
from UM.Settings.ContainerStack import ContainerStack
|
from UM.Settings.ContainerStack import ContainerStack
|
||||||
|
@ -11,6 +11,7 @@ from UM.Settings.ContainerStack import ContainerStack
|
||||||
from UM.i18n import i18nCatalog
|
from UM.i18n import i18nCatalog
|
||||||
catalog = i18nCatalog("cura")
|
catalog = i18nCatalog("cura")
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# This the QML model for the quality management page.
|
# This the QML model for the quality management page.
|
||||||
#
|
#
|
||||||
|
@ -39,7 +40,7 @@ class MachineManagementModel(ListModel):
|
||||||
## Handler for container added/removed events from registry
|
## Handler for container added/removed events from registry
|
||||||
def _onContainerChanged(self, container):
|
def _onContainerChanged(self, container):
|
||||||
# We only need to update when the added / removed container is a stack.
|
# We only need to update when the added / removed container is a stack.
|
||||||
if isinstance(container, ContainerStack):
|
if isinstance(container, ContainerStack) and container.getMetaDataEntry("type") == "machine":
|
||||||
self._update()
|
self._update()
|
||||||
|
|
||||||
## Private convenience function to reset & repopulate the model.
|
## Private convenience function to reset & repopulate the model.
|
||||||
|
@ -47,7 +48,9 @@ class MachineManagementModel(ListModel):
|
||||||
items = []
|
items = []
|
||||||
|
|
||||||
# Get first the network enabled printers
|
# Get first the network enabled printers
|
||||||
network_filter_printers = {"type": "machine", "um_network_key": "*", "hidden": "False"}
|
network_filter_printers = {"type": "machine",
|
||||||
|
"um_network_key": "*",
|
||||||
|
"hidden": "False"}
|
||||||
self._network_container_stacks = ContainerRegistry.getInstance().findContainerStacks(**network_filter_printers)
|
self._network_container_stacks = ContainerRegistry.getInstance().findContainerStacks(**network_filter_printers)
|
||||||
self._network_container_stacks.sort(key = lambda i: i.getMetaDataEntry("connect_group_name"))
|
self._network_container_stacks.sort(key = lambda i: i.getMetaDataEntry("connect_group_name"))
|
||||||
|
|
||||||
|
@ -61,7 +64,7 @@ class MachineManagementModel(ListModel):
|
||||||
"metadata": metadata,
|
"metadata": metadata,
|
||||||
"group": catalog.i18nc("@info:title", "Network enabled printers")})
|
"group": catalog.i18nc("@info:title", "Network enabled printers")})
|
||||||
|
|
||||||
# Get now the local printes
|
# Get now the local printers
|
||||||
local_filter_printers = {"type": "machine", "um_network_key": None}
|
local_filter_printers = {"type": "machine", "um_network_key": None}
|
||||||
self._local_container_stacks = ContainerRegistry.getInstance().findContainerStacks(**local_filter_printers)
|
self._local_container_stacks = ContainerRegistry.getInstance().findContainerStacks(**local_filter_printers)
|
||||||
self._local_container_stacks.sort(key = lambda i: i.getName())
|
self._local_container_stacks.sort(key = lambda i: i.getName())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue