Commit 06acbd71 authored by Guillaume Seguin's avatar Guillaume Seguin

Use None in RPC server

parent 7f96ca82
...@@ -9,7 +9,7 @@ class ProntRPC(object): ...@@ -9,7 +9,7 @@ class ProntRPC(object):
def __init__(self, pronsole, port = RPC_PORT): def __init__(self, pronsole, port = RPC_PORT):
self.pronsole = pronsole self.pronsole = pronsole
self.server = SimpleXMLRPCServer(("localhost", port)) self.server = SimpleXMLRPCServer(("localhost", port), allow_none = True)
self.server.register_function(self.get_status, 'status') self.server.register_function(self.get_status, 'status')
self.thread = Thread(target = self.run_server) self.thread = Thread(target = self.run_server)
self.thread.start() self.thread.start()
...@@ -26,11 +26,11 @@ class ProntRPC(object): ...@@ -26,11 +26,11 @@ class ProntRPC(object):
progress = 100 * float(self.pronsole.p.queueindex) / len(self.pronsole.p.mainqueue) progress = 100 * float(self.pronsole.p.queueindex) / len(self.pronsole.p.mainqueue)
elif self.pronsole.sdprinting: elif self.pronsole.sdprinting:
progress = self.percentdone progress = self.percentdone
else: progress = -1 else: progress = None
if self.pronsole.p.printing or self.pronsole.sdprinting: if self.pronsole.p.printing or self.pronsole.sdprinting:
eta = self.get_eta() eta = self.get_eta()
else: else:
eta = -1 eta = None
return {"filename": self.pronsole.filename, return {"filename": self.pronsole.filename,
"progress": progress, "progress": progress,
"eta": eta, "eta": eta,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment