Commit 355102cc authored by Guillaume Seguin's avatar Guillaume Seguin

Move current layer tracking to pronsole and report in RPC status

parent 97327dfd
...@@ -465,6 +465,7 @@ class pronsole(cmd.Cmd): ...@@ -465,6 +465,7 @@ class pronsole(cmd.Cmd):
self.p.errorcb = self.logError self.p.errorcb = self.logError
self.fgcode = None self.fgcode = None
self.rpc_server = None self.rpc_server = None
self.curlayer = 0
self.listing = 0 self.listing = 0
self.sdfiles = [] self.sdfiles = []
self.paused = False self.paused = False
...@@ -1484,6 +1485,9 @@ class pronsole(cmd.Cmd): ...@@ -1484,6 +1485,9 @@ class pronsole(cmd.Cmd):
listener(l) listener(l)
def layer_change_cb(self, newlayer): def layer_change_cb(self, newlayer):
layerz = self.fgcode.all_layers[newlayer].z
if layerz is not None:
self.curlayer = layerz
if self.compute_eta: if self.compute_eta:
secondselapsed = int(time.time() - self.starttime + self.extra_print_time) secondselapsed = int(time.time() - self.starttime + self.extra_print_time)
self.compute_eta.update_layer(newlayer, secondselapsed) self.compute_eta.update_layer(newlayer, secondselapsed)
......
...@@ -228,7 +228,6 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -228,7 +228,6 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self.p.printsendcb = self.printsentcb self.p.printsendcb = self.printsentcb
self.p.startcb = self.startcb self.p.startcb = self.startcb
self.p.endcb = self.endcb self.p.endcb = self.endcb
self.curlayer = 0
self.cur_button = None self.cur_button = None
self.predisconnect_mainqueue = None self.predisconnect_mainqueue = None
self.predisconnect_queueindex = None self.predisconnect_queueindex = None
...@@ -1637,9 +1636,6 @@ Printrun. If not, see <http://www.gnu.org/licenses/>.""" ...@@ -1637,9 +1636,6 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
def layer_change_cb(self, newlayer): def layer_change_cb(self, newlayer):
"""Callback when the printed layer changed""" """Callback when the printed layer changed"""
pronsole.pronsole.layer_change_cb(self, newlayer) pronsole.pronsole.layer_change_cb(self, newlayer)
layerz = self.fgcode.all_layers[newlayer].z
if layerz is not None:
self.curlayer = layerz
if self.settings.mainviz != "3D" or self.settings.trackcurrentlayer3d: if self.settings.mainviz != "3D" or self.settings.trackcurrentlayer3d:
wx.CallAfter(self.gviz.setlayer, newlayer) wx.CallAfter(self.gviz.setlayer, newlayer)
......
...@@ -39,8 +39,10 @@ class ProntRPC(object): ...@@ -39,8 +39,10 @@ class ProntRPC(object):
temps = parse_temperature_report(self.pronsole.tempreadings) temps = parse_temperature_report(self.pronsole.tempreadings)
else: else:
temps = None temps = None
z = self.pronsole.curlayer
return {"filename": self.pronsole.filename, return {"filename": self.pronsole.filename,
"progress": progress, "progress": progress,
"eta": eta, "eta": eta,
"temps": temps, "temps": temps,
"z": z,
} }
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