Merge pull request #6438 from Ultimaker/CS-298_network_screen_printer_name

Use printer type name instead of id
This commit is contained in:
Marijn Dee 2019-09-30 09:34:10 +02:00 committed by GitHub
commit 05a9418755
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View file

@ -212,10 +212,7 @@ Cura.MachineAction
text:
{
if (base.selectedDevice) {
// It would be great to use a more readable machine type here,
// 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 base.selectedDevice.printerTypeName
}
return ""
}

View file

@ -60,9 +60,13 @@ class UltimakerNetworkedPrinterOutputDevice(NetworkedPrinterOutputDevice):
self._time_of_last_response = 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"))
# 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.
self._printers = [] # type: List[PrinterOutputModel]
self._has_received_printers = False
@ -87,6 +91,11 @@ class UltimakerNetworkedPrinterOutputDevice(NetworkedPrinterOutputDevice):
def address(self) -> str:
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.
@pyqtProperty("QVariantList", notify=printJobsChanged)
def printJobs(self) -> List[UM3PrintJobOutputModel]: