mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 19:09:01 +08:00
Use connection type instead of um_network_key to see if a printer has a network connection
CURA-6011
This commit is contained in:
parent
b8a4d8e80d
commit
938287095f
@ -23,7 +23,7 @@ from UM.Settings.SettingFunction import SettingFunction
|
|||||||
from UM.Signal import postponeSignals, CompressTechnique
|
from UM.Signal import postponeSignals, CompressTechnique
|
||||||
|
|
||||||
from cura.Machines.QualityManager import getMachineDefinitionIDForQualitySearch
|
from cura.Machines.QualityManager import getMachineDefinitionIDForQualitySearch
|
||||||
from cura.PrinterOutputDevice import PrinterOutputDevice
|
from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionType
|
||||||
from cura.PrinterOutput.ConfigurationModel import ConfigurationModel
|
from cura.PrinterOutput.ConfigurationModel import ConfigurationModel
|
||||||
from cura.PrinterOutput.ExtruderConfigurationModel import ExtruderConfigurationModel
|
from cura.PrinterOutput.ExtruderConfigurationModel import ExtruderConfigurationModel
|
||||||
from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel
|
from cura.PrinterOutput.MaterialOutputModel import MaterialOutputModel
|
||||||
@ -521,6 +521,13 @@ class MachineManager(QObject):
|
|||||||
def printerConnected(self):
|
def printerConnected(self):
|
||||||
return bool(self._printer_output_devices)
|
return bool(self._printer_output_devices)
|
||||||
|
|
||||||
|
@pyqtProperty(bool, notify=printerConnectedStatusChanged)
|
||||||
|
def activeMachineHasRemoteConnection(self) -> bool:
|
||||||
|
if self._global_container_stack:
|
||||||
|
connection_type = self._global_container_stack.getMetaDataEntry("connection_type")
|
||||||
|
return connection_type in [ConnectionType.NetworkConnection, ConnectionType.CloudConnection]
|
||||||
|
return False
|
||||||
|
|
||||||
@pyqtProperty(str, notify = printerConnectedStatusChanged)
|
@pyqtProperty(str, notify = printerConnectedStatusChanged)
|
||||||
def activeMachineNetworkKey(self) -> str:
|
def activeMachineNetworkKey(self) -> str:
|
||||||
if self._global_container_stack:
|
if self._global_container_stack:
|
||||||
|
@ -134,7 +134,7 @@ Cura.ExpandablePopup
|
|||||||
property bool is_connected: false //If current machine is connected to a printer. Only evaluated upon making popup visible.
|
property bool is_connected: false //If current machine is connected to a printer. Only evaluated upon making popup visible.
|
||||||
onVisibleChanged:
|
onVisibleChanged:
|
||||||
{
|
{
|
||||||
is_connected = Cura.MachineManager.activeMachineNetworkKey !== "" && Cura.MachineManager.printerConnected //Re-evaluate.
|
is_connected = Cura.MachineManager.activeMachineHasRemoteConnection && Cura.MachineManager.printerConnected //Re-evaluate.
|
||||||
}
|
}
|
||||||
|
|
||||||
property int configuration_method: is_connected ? ConfigurationMenu.ConfigurationMethod.Auto : ConfigurationMenu.ConfigurationMethod.Custom //Auto if connected to a printer at start-up, or Custom if not.
|
property int configuration_method: is_connected ? ConfigurationMenu.ConfigurationMethod.Auto : ConfigurationMenu.ConfigurationMethod.Custom //Auto if connected to a printer at start-up, or Custom if not.
|
||||||
|
@ -21,7 +21,7 @@ Rectangle
|
|||||||
property bool hideView: Cura.MachineManager.activeMachineName == ""
|
property bool hideView: Cura.MachineManager.activeMachineName == ""
|
||||||
|
|
||||||
// Is there an output device for this printer?
|
// Is there an output device for this printer?
|
||||||
property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != ""
|
property bool isNetworkPrinter: Cura.MachineManager.activeMachineHasRemoteConnection
|
||||||
property bool printerConnected: Cura.MachineManager.printerConnected
|
property bool printerConnected: Cura.MachineManager.printerConnected
|
||||||
property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands
|
property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands
|
||||||
property var connectedPrinter: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
|
property var connectedPrinter: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
|
||||||
@ -205,7 +205,7 @@ Rectangle
|
|||||||
target: Cura.MachineManager
|
target: Cura.MachineManager
|
||||||
onGlobalContainerChanged:
|
onGlobalContainerChanged:
|
||||||
{
|
{
|
||||||
base.isNetworkPrinter = Cura.MachineManager.activeMachineNetworkKey != ""
|
base.isNetworkPrinter = Cura.MachineManager.activeMachineHasRemoteConnection
|
||||||
base.printerConnected = Cura.MachineManager.printerOutputDevices.length != 0
|
base.printerConnected = Cura.MachineManager.printerOutputDevices.length != 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ Cura.ExpandablePopup
|
|||||||
{
|
{
|
||||||
id: machineSelector
|
id: machineSelector
|
||||||
|
|
||||||
property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != ""
|
property bool isNetworkPrinter: Cura.MachineManager.activeMachineHasRemoteConnection
|
||||||
property bool isPrinterConnected: Cura.MachineManager.printerConnected
|
property bool isPrinterConnected: Cura.MachineManager.printerConnected
|
||||||
property var outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
|
property var outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ ListView
|
|||||||
{
|
{
|
||||||
text: model.name
|
text: model.name
|
||||||
width: listView.width
|
width: listView.width
|
||||||
|
outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user