Commit f972ebee authored by Guillaume Seguin's avatar Guillaume Seguin

Fix #524: correctly set status text in gcview

parent e9c59669
...@@ -412,11 +412,26 @@ class GcodeViewFrame(GvizBaseFrame, GcodeViewLoader): ...@@ -412,11 +412,26 @@ class GcodeViewFrame(GvizBaseFrame, GcodeViewLoader):
self.Bind(wx.EVT_TOOL, lambda x: self.glpanel.inject(), id = 6) self.Bind(wx.EVT_TOOL, lambda x: self.glpanel.inject(), id = 6)
self.Bind(wx.EVT_TOOL, lambda x: self.glpanel.editlayer(), id = 7) self.Bind(wx.EVT_TOOL, lambda x: self.glpanel.editlayer(), id = 7)
def setlayercb(self, layer):
self.layerslider.SetValue(layer)
self.update_status("")
def update_status(self, extra):
layer = self.model.num_layers_to_draw
filtered = [k for k, v in self.model.layer_idxs_map.iteritems() if v == layer]
if filtered:
z = filtered[0]
message = _("Layer %d -%s Z = %.03f mm") % (layer + 1, extra, z)
else:
message = _("Entire object")
wx.CallAfter(self.SetStatusText, message, 0)
def process_slider(self, event): def process_slider(self, event):
new_layer = self.layerslider.GetValue() new_layer = self.layerslider.GetValue()
new_layer = min(self.model.max_layers + 1, new_layer) new_layer = min(self.model.max_layers + 1, new_layer)
new_layer = max(1, new_layer) new_layer = max(1, new_layer)
self.model.num_layers_to_draw = new_layer self.model.num_layers_to_draw = new_layer
self.update_status("")
wx.CallAfter(self.Refresh) wx.CallAfter(self.Refresh)
def set_current_gline(self, gline): def set_current_gline(self, gline):
......
...@@ -105,7 +105,7 @@ class GvizWindow(GvizBaseFrame): ...@@ -105,7 +105,7 @@ class GvizWindow(GvizBaseFrame):
def process_slider(self, event): def process_slider(self, event):
self.p.layerindex = self.layerslider.GetValue() self.p.layerindex = self.layerslider.GetValue()
z = self.p.get_currentz() z = self.p.get_currentz()
self.SetStatusText(_("Layer %d - Going Up - Z = %.03f mm") % (self.p.layerindex + 1, z), 0) wx.CallAfter(self.SetStatusText, _("Layer %d - Z = %.03f mm") % (self.p.layerindex + 1, z), 0)
self.p.dirty = True self.p.dirty = True
wx.CallAfter(self.p.Refresh) wx.CallAfter(self.p.Refresh)
...@@ -247,7 +247,7 @@ class Gviz(wx.Panel): ...@@ -247,7 +247,7 @@ class Gviz(wx.Panel):
if self.layerindex + 1 < len(self.layers): if self.layerindex + 1 < len(self.layers):
self.layerindex += 1 self.layerindex += 1
z = self.get_currentz() z = self.get_currentz()
self.parent.SetStatusText(_("Layer %d - Going Up - Z = %.03f mm") % (self.layerindex + 1, z), 0) wx.CallAfter(self.parent.SetStatusText, _("Layer %d - Going Up - Z = %.03f mm") % (self.layerindex + 1, z), 0)
self.dirty = True self.dirty = True
self.parent.setlayercb(self.layerindex) self.parent.setlayercb(self.layerindex)
wx.CallAfter(self.Refresh) wx.CallAfter(self.Refresh)
...@@ -256,7 +256,7 @@ class Gviz(wx.Panel): ...@@ -256,7 +256,7 @@ class Gviz(wx.Panel):
if self.layerindex > 0: if self.layerindex > 0:
self.layerindex -= 1 self.layerindex -= 1
z = self.get_currentz() z = self.get_currentz()
self.parent.SetStatusText(_("Layer %d - Going Down - Z = %.03f mm") % (self.layerindex + 1, z), 0) wx.CallAfter(self.parent.SetStatusText, _("Layer %d - Going Down - Z = %.03f mm") % (self.layerindex + 1, z), 0)
self.dirty = True self.dirty = True
self.parent.setlayercb(self.layerindex) self.parent.setlayercb(self.layerindex)
wx.CallAfter(self.Refresh) wx.CallAfter(self.Refresh)
......
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