|
@@ -1,3 +1,6 @@
|
|
|
+# Copyright (c) 2017 Ultimaker B.V.
|
|
|
+# Cura is released under the terms of the AGPLv3 or higher.
|
|
|
+
|
|
|
from UM.OutputDevice.OutputDevicePlugin import OutputDevicePlugin
|
|
|
from . import NetworkPrinterOutputDevice
|
|
|
|
|
@@ -75,9 +78,13 @@ class NetworkPrinterOutputDevicePlugin(OutputDevicePlugin):
|
|
|
self._manual_instances.append(address)
|
|
|
self._preferences.setValue("um3networkprinting/manual_instances", ",".join(self._manual_instances))
|
|
|
|
|
|
- name = address
|
|
|
instance_name = "manual:%s" % address
|
|
|
- properties = { b"name": name.encode("utf-8"), b"manual": b"true", b"incomplete": b"true" }
|
|
|
+ properties = {
|
|
|
+ b"name": address.encode("utf-8"),
|
|
|
+ b"address": address.encode("utf-8"),
|
|
|
+ b"manual": b"true",
|
|
|
+ b"incomplete": b"true"
|
|
|
+ }
|
|
|
|
|
|
if instance_name not in self._printers:
|
|
|
# Add a preliminary printer instance
|
|
@@ -112,10 +119,14 @@ class NetworkPrinterOutputDevicePlugin(OutputDevicePlugin):
|
|
|
if status_code == 200:
|
|
|
system_info = json.loads(bytes(reply.readAll()).decode("utf-8"))
|
|
|
address = reply.url().host()
|
|
|
- name = ("%s (%s)" % (system_info["name"], address))
|
|
|
|
|
|
instance_name = "manual:%s" % address
|
|
|
- properties = { b"name": name.encode("utf-8"), b"firmware_version": system_info["firmware"].encode("utf-8"), b"manual": b"true" }
|
|
|
+ properties = {
|
|
|
+ b"name": system_info["name"].encode("utf-8"),
|
|
|
+ b"address": address.encode("utf-8"),
|
|
|
+ b"firmware_version": system_info["firmware"].encode("utf-8"),
|
|
|
+ b"manual": b"true"
|
|
|
+ }
|
|
|
if instance_name in self._printers:
|
|
|
# Only replace the printer if it is still in the list of (manual) printers
|
|
|
self.removePrinter(instance_name)
|