Use printer type name instead of id

This commit is contained in:
ChrisTerBeke 2019-09-27 21:09:53 +02:00
parent 93f2641be7
commit 99832c3a68
No known key found for this signature in database
GPG key ID: A49F1AB9D7E0C263
2 changed files with 11 additions and 5 deletions

View file

@ -212,10 +212,7 @@ Cura.MachineAction
text: text:
{ {
if (base.selectedDevice) { if (base.selectedDevice) {
// It would be great to use a more readable machine type here, return base.selectedDevice.printerTypeName
// but the new discoveredPrintersModel is not used yet in the UM networking actions.
// TODO: remove actions or replace 'connect via network' button with new flow?
return base.selectedDevice.printerType
} }
return "" return ""
} }

View file

@ -60,9 +60,13 @@ class UltimakerNetworkedPrinterOutputDevice(NetworkedPrinterOutputDevice):
self._time_of_last_response = time() self._time_of_last_response = time()
self._time_of_last_request = time() self._time_of_last_request = time()
# Set the display name from the properties # Set the display name from the properties.
self.setName(self.getProperty("name")) self.setName(self.getProperty("name"))
# Set the display name of the printer type.
definitions = CuraApplication.getInstance().getContainerRegistry().findContainers(id = self.printerType)
self._printer_type_name = definitions[0].getName() if definitions else ""
# Keeps track of all printers in the cluster. # Keeps track of all printers in the cluster.
self._printers = [] # type: List[PrinterOutputModel] self._printers = [] # type: List[PrinterOutputModel]
self._has_received_printers = False self._has_received_printers = False
@ -87,6 +91,11 @@ class UltimakerNetworkedPrinterOutputDevice(NetworkedPrinterOutputDevice):
def address(self) -> str: def address(self) -> str:
return self._address return self._address
## The display name of the printer.
@pyqtProperty(str, constant=True)
def printerTypeName(self) -> str:
return self._printer_type_name
# Get all print jobs for this cluster. # Get all print jobs for this cluster.
@pyqtProperty("QVariantList", notify=printJobsChanged) @pyqtProperty("QVariantList", notify=printJobsChanged)
def printJobs(self) -> List[UM3PrintJobOutputModel]: def printJobs(self) -> List[UM3PrintJobOutputModel]: