Simplify GlobalStacksModel

CURA-6483
This commit is contained in:
Lipu Fei 2019-04-30 12:45:58 +02:00
parent ed8127777c
commit d6f4ddc322

View File

@ -5,6 +5,7 @@ from PyQt5.QtCore import Qt, QTimer
from UM.Qt.ListModel import ListModel from UM.Qt.ListModel import ListModel
from UM.i18n import i18nCatalog from UM.i18n import i18nCatalog
from UM.Util import parseBool
from cura.PrinterOutput.PrinterOutputDevice import ConnectionType from cura.PrinterOutput.PrinterOutputDevice import ConnectionType
from cura.Settings.CuraContainerRegistry import CuraContainerRegistry from cura.Settings.CuraContainerRegistry import CuraContainerRegistry
@ -54,7 +55,6 @@ class GlobalStacksModel(ListModel):
items = [] items = []
container_stacks = CuraContainerRegistry.getInstance().findContainerStacks(type = "machine") container_stacks = CuraContainerRegistry.getInstance().findContainerStacks(type = "machine")
for container_stack in container_stacks: for container_stack in container_stacks:
has_remote_connection = False has_remote_connection = False
@ -62,7 +62,7 @@ class GlobalStacksModel(ListModel):
has_remote_connection |= connection_type in [ConnectionType.NetworkConnection.value, has_remote_connection |= connection_type in [ConnectionType.NetworkConnection.value,
ConnectionType.CloudConnection.value] ConnectionType.CloudConnection.value]
if container_stack.getMetaDataEntry("hidden", False) in ["True", True]: if parseBool(container_stack.getMetaDataEntry("hidden", False)):
continue continue
section_name = "Network enabled printers" if has_remote_connection else "Local printers" section_name = "Network enabled printers" if has_remote_connection else "Local printers"