Rename output device to prevent inheritance naming confusion

This commit is contained in:
ChrisTerBeke 2019-08-02 15:16:08 +02:00
parent baa7b485ef
commit 1fa5628cb2
6 changed files with 14 additions and 13 deletions

View file

@ -75,7 +75,7 @@ class DiscoveredPrinter(QObject):
def readableMachineType(self) -> str: def readableMachineType(self) -> str:
from cura.CuraApplication import CuraApplication from cura.CuraApplication import CuraApplication
machine_manager = CuraApplication.getInstance().getMachineManager() machine_manager = CuraApplication.getInstance().getMachineManager()
# In NetworkOutputDevice, when it updates a printer information, it updates the machine type using the field # In LocalClusterOutputDevice, when it updates a printer information, it updates the machine type using the field
# "machine_variant", and for some reason, it's not the machine type ID/codename/... but a human-readable string # "machine_variant", and for some reason, it's not the machine type ID/codename/... but a human-readable string
# like "Ultimaker 3". The code below handles this case. # like "Ultimaker 3". The code below handles this case.
if self._hasHumanReadableMachineTypeName(self._machine_type): if self._hasHumanReadableMachineTypeName(self._machine_type):

1
plugins/ThingiBrowser Symbolic link
View file

@ -0,0 +1 @@
/home/cterbeke/Code/ChrisTerBeke/ThingiBrowser

View file

@ -23,7 +23,7 @@ from ..UltimakerNetworkedPrinterOutputDevice import UltimakerNetworkedPrinterOut
I18N_CATALOG = i18nCatalog("cura") I18N_CATALOG = i18nCatalog("cura")
class NetworkOutputDevice(UltimakerNetworkedPrinterOutputDevice): class LocalClusterOutputDevice(UltimakerNetworkedPrinterOutputDevice):
activeCameraUrlChanged = pyqtSignal() activeCameraUrlChanged = pyqtSignal()

View file

@ -12,7 +12,7 @@ from cura.Settings.GlobalStack import GlobalStack
from .ZeroConfClient import ZeroConfClient from .ZeroConfClient import ZeroConfClient
from .ClusterApiClient import ClusterApiClient from .ClusterApiClient import ClusterApiClient
from .NetworkOutputDevice import NetworkOutputDevice from .LocalClusterOutputDevice import LocalClusterOutputDevice
from ..CloudFlowMessage import CloudFlowMessage from ..CloudFlowMessage import CloudFlowMessage
from ..Models.Http.PrinterSystemStatus import PrinterSystemStatus from ..Models.Http.PrinterSystemStatus import PrinterSystemStatus
@ -20,8 +20,8 @@ from ..Models.Http.PrinterSystemStatus import PrinterSystemStatus
I18N_CATALOG = i18nCatalog("cura") I18N_CATALOG = i18nCatalog("cura")
## The NetworkOutputDeviceManager is responsible for discovering and managing local networked clusters. ## The LocalClusterOutputDeviceManager is responsible for discovering and managing local networked clusters.
class NetworkOutputDeviceManager: class LocalClusterOutputDeviceManager:
META_NETWORK_KEY = "um_network_key" META_NETWORK_KEY = "um_network_key"
@ -37,7 +37,7 @@ class NetworkOutputDeviceManager:
def __init__(self) -> None: def __init__(self) -> None:
# Persistent dict containing the networked clusters. # Persistent dict containing the networked clusters.
self._discovered_devices = {} # type: Dict[str, NetworkOutputDevice] self._discovered_devices = {} # type: Dict[str, LocalClusterOutputDevice]
self._output_device_manager = CuraApplication.getInstance().getOutputDeviceManager() self._output_device_manager = CuraApplication.getInstance().getOutputDeviceManager()
# Hook up ZeroConf client. # Hook up ZeroConf client.
@ -152,7 +152,7 @@ class NetworkOutputDeviceManager:
if cluster_size == -1: if cluster_size == -1:
return return
device = NetworkOutputDevice(key, address, properties) device = LocalClusterOutputDevice(key, address, properties)
CuraApplication.getInstance().getDiscoveredPrintersModel().addDiscoveredPrinter( CuraApplication.getInstance().getDiscoveredPrintersModel().addDiscoveredPrinter(
ip_address=address, ip_address=address,
key=device.getId(), key=device.getId(),
@ -167,7 +167,7 @@ class NetworkOutputDeviceManager:
## Remove a device. ## Remove a device.
def _onDiscoveredDeviceRemoved(self, device_id: str) -> None: def _onDiscoveredDeviceRemoved(self, device_id: str) -> None:
device = self._discovered_devices.pop(device_id, None) # type: Optional[NetworkOutputDevice] device = self._discovered_devices.pop(device_id, None) # type: Optional[LocalClusterOutputDevice]
if not device: if not device:
return return
device.close() device.close()

View file

@ -13,7 +13,7 @@ from .Models.ClusterMaterial import ClusterMaterial
from .Models.LocalMaterial import LocalMaterial from .Models.LocalMaterial import LocalMaterial
if TYPE_CHECKING: if TYPE_CHECKING:
from .Network.NetworkOutputDevice import NetworkOutputDevice from .Network.LocalClusterOutputDevice import LocalClusterOutputDevice
## Asynchronous job to send material profiles to the printer. ## Asynchronous job to send material profiles to the printer.
@ -21,9 +21,9 @@ if TYPE_CHECKING:
# This way it won't freeze up the interface while sending those materials. # This way it won't freeze up the interface while sending those materials.
class SendMaterialJob(Job): class SendMaterialJob(Job):
def __init__(self, device: "NetworkOutputDevice") -> None: def __init__(self, device: "LocalClusterOutputDevice") -> None:
super().__init__() super().__init__()
self.device = device # type: NetworkOutputDevice self.device = device # type: LocalClusterOutputDevice
## Send the request to the printer and register a callback ## Send the request to the printer and register a callback
def run(self) -> None: def run(self) -> None:

View file

@ -7,7 +7,7 @@ from cura.CuraApplication import CuraApplication
from UM.OutputDevice.OutputDeviceManager import ManualDeviceAdditionAttempt from UM.OutputDevice.OutputDeviceManager import ManualDeviceAdditionAttempt
from UM.OutputDevice.OutputDevicePlugin import OutputDevicePlugin from UM.OutputDevice.OutputDevicePlugin import OutputDevicePlugin
from .Network.NetworkOutputDeviceManager import NetworkOutputDeviceManager from .Network.LocalClusterOutputDeviceManager import LocalClusterOutputDeviceManager
from .Cloud.CloudOutputDeviceManager import CloudOutputDeviceManager from .Cloud.CloudOutputDeviceManager import CloudOutputDeviceManager
@ -18,7 +18,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin):
super().__init__() super().__init__()
# Create a network output device manager that abstracts all network connection logic away. # Create a network output device manager that abstracts all network connection logic away.
self._network_output_device_manager = NetworkOutputDeviceManager() self._network_output_device_manager = LocalClusterOutputDeviceManager()
# Create a cloud output device manager that abstracts all cloud connection logic away. # Create a cloud output device manager that abstracts all cloud connection logic away.
self._cloud_output_device_manager = CloudOutputDeviceManager() self._cloud_output_device_manager = CloudOutputDeviceManager()