mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 23:46:22 -06:00
Make remove manual device (also) work (as failure-state of add manual device). [CURA-6294]
This commit is contained in:
parent
f13ceb2a4d
commit
8250c91fc4
2 changed files with 39 additions and 15 deletions
|
@ -258,22 +258,26 @@ class UM3OutputDevicePlugin(OutputDevicePlugin):
|
|||
def _onNetworkRequestFinished(self, reply):
|
||||
reply_url = reply.url().toString()
|
||||
|
||||
address = ""
|
||||
address = reply.url().host()
|
||||
device = None
|
||||
properties = {} # type: Dict[bytes, bytes]
|
||||
|
||||
if "system" in reply_url:
|
||||
if reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) != 200:
|
||||
# Something went wrong with checking the firmware version!
|
||||
return
|
||||
if reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) != 200:
|
||||
# Either:
|
||||
# - Something went wrong with checking the firmware version!
|
||||
# - Something went wrong with checking the amount of printers the cluster has!
|
||||
# - Couldn't find printer at the address when trying to add it manually.
|
||||
if address in self._manual_instances:
|
||||
self.removeManualDeviceSignal.emit(self.getPluginId(), "", address)
|
||||
return
|
||||
|
||||
if "system" in reply_url:
|
||||
try:
|
||||
system_info = json.loads(bytes(reply.readAll()).decode("utf-8"))
|
||||
except:
|
||||
Logger.log("e", "Something went wrong converting the JSON.")
|
||||
return
|
||||
|
||||
address = reply.url().host()
|
||||
has_cluster_capable_firmware = Version(system_info["firmware"]) > self._min_cluster_version
|
||||
instance_name = "manual:%s" % address
|
||||
properties = {
|
||||
|
@ -301,16 +305,12 @@ class UM3OutputDevicePlugin(OutputDevicePlugin):
|
|||
self._network_manager.get(cluster_request)
|
||||
|
||||
elif "printers" in reply_url:
|
||||
if reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) != 200:
|
||||
# Something went wrong with checking the amount of printers the cluster has!
|
||||
return
|
||||
# So we confirmed that the device is in fact a cluster printer, and we should now know how big it is.
|
||||
try:
|
||||
cluster_printers_list = json.loads(bytes(reply.readAll()).decode("utf-8"))
|
||||
except:
|
||||
Logger.log("e", "Something went wrong converting the JSON.")
|
||||
return
|
||||
address = reply.url().host()
|
||||
instance_name = "manual:%s" % address
|
||||
if instance_name in self._discovered_devices:
|
||||
device = self._discovered_devices[instance_name]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue