Commit 9181adba authored by Guillaume Seguin's avatar Guillaume Seguin

Fix potential thread race in online() callback, possibly fixing #168

parent 00c69a8a
...@@ -366,19 +366,22 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -366,19 +366,22 @@ class PronterWindow(MainWindow, pronsole.pronsole):
def online(self): def online(self):
print _("Printer is now online.") print _("Printer is now online.")
wx.CallAfter(self.online_gui)
def online_gui(self):
self.connectbtn.SetLabel(_("Disconnect")) self.connectbtn.SetLabel(_("Disconnect"))
self.connectbtn.SetToolTip(wx.ToolTip("Disconnect from the printer")) self.connectbtn.SetToolTip(wx.ToolTip("Disconnect from the printer"))
self.connectbtn.Bind(wx.EVT_BUTTON, self.disconnect) self.connectbtn.Bind(wx.EVT_BUTTON, self.disconnect)
for i in self.printerControls: for i in self.printerControls:
wx.CallAfter(i.Enable) i.Enable()
# Enable XYButtons and ZButtons # Enable XYButtons and ZButtons
wx.CallAfter(self.xyb.enable) self.xyb.enable()
wx.CallAfter(self.zb.enable) self.zb.enable()
if self.filename: if self.filename:
wx.CallAfter(self.printbtn.Enable) self.printbtn.Enable()
def layer_change_cb(self, newlayer): def layer_change_cb(self, newlayer):
if self.compute_eta: if self.compute_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