mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-21 21:58:01 -06:00
Move hasNetworkedConnection
to GlobalStack
From code review CURA-9277 Co-authored-by: Joey <j.delarago@ultimaker.com>
This commit is contained in:
parent
6253fb2fdc
commit
148263a068
2 changed files with 7 additions and 9 deletions
|
@ -89,15 +89,7 @@ class MachineListModel(ListModel):
|
||||||
machines_manager = CuraApplication.getInstance().getMachineManager()
|
machines_manager = CuraApplication.getInstance().getMachineManager()
|
||||||
online_machine_stacks = machines_manager.getMachinesWithDefinition(definition_id, online_only = True)
|
online_machine_stacks = machines_manager.getMachinesWithDefinition(definition_id, online_only = True)
|
||||||
|
|
||||||
def online_machines_has_connection_filter(machine_stack):
|
online_machine_stacks = list(filter(lambda machine: machine.hasNetworkedConnection(), online_machine_stacks))
|
||||||
# This is required because machines loaded from projects have the is_online="True" but no connection type.
|
|
||||||
# We want to display them the same way as unconnected printers in this case.
|
|
||||||
has_connection = False
|
|
||||||
for connection_type in [ConnectionType.NetworkConnection.value, ConnectionType.CloudConnection.value]:
|
|
||||||
has_connection |= connection_type in machine_stack.configuredConnectionTypes
|
|
||||||
return has_connection
|
|
||||||
|
|
||||||
online_machine_stacks = list(filter(online_machines_has_connection_filter, online_machine_stacks))
|
|
||||||
|
|
||||||
other_machine_stacks.remove(abstract_machine)
|
other_machine_stacks.remove(abstract_machine)
|
||||||
if abstract_machine in online_machine_stacks:
|
if abstract_machine in online_machine_stacks:
|
||||||
|
|
|
@ -347,6 +347,12 @@ class GlobalStack(CuraContainerStack):
|
||||||
nameChanged = pyqtSignal()
|
nameChanged = pyqtSignal()
|
||||||
name = pyqtProperty(str, fget=getName, fset=setName, notify=nameChanged)
|
name = pyqtProperty(str, fget=getName, fset=setName, notify=nameChanged)
|
||||||
|
|
||||||
|
def hasNetworkedConnection(self) -> bool:
|
||||||
|
has_connection = False
|
||||||
|
for connection_type in [ConnectionType.NetworkConnection.value, ConnectionType.CloudConnection.value]:
|
||||||
|
has_connection |= connection_type in self.configuredConnectionTypes
|
||||||
|
return has_connection
|
||||||
|
|
||||||
## private:
|
## private:
|
||||||
global_stack_mime = MimeType(
|
global_stack_mime = MimeType(
|
||||||
name = "application/x-cura-globalstack",
|
name = "application/x-cura-globalstack",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue