Commit 54cf403d authored by Guillaume Seguin's avatar Guillaume Seguin

Merge branch 'master' of github.com:kliment/Printrun

parents d5a45f42 f9d7f331
...@@ -101,8 +101,7 @@ class GvizWindow(GvizBaseFrame): ...@@ -101,8 +101,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.layers[self.p.layerindex] z = self.p.get_currentz()
z = 0. if z is None else z
self.SetStatusText(_("Layer %d - Going Up - Z = %.03f mm") % (self.p.layerindex + 1, z), 0) self.SetStatusText(_("Layer %d - Going Up - Z = %.03f mm") % (self.p.layerindex + 1, z), 0)
self.p.dirty = 1 self.p.dirty = 1
wx.CallAfter(self.p.Refresh) wx.CallAfter(self.p.Refresh)
...@@ -229,10 +228,16 @@ class Gviz(wx.Panel): ...@@ -229,10 +228,16 @@ class Gviz(wx.Panel):
self.dirty = 1 self.dirty = 1
wx.CallAfter(self.Refresh) wx.CallAfter(self.Refresh)
def get_currentz(self):
z = self.layers[self.layerindex]
z = 0. if z is None else z
return z
def layerup(self): def layerup(self):
if self.layerindex + 1 < len(self.layers): if self.layerindex + 1 < len(self.layers):
self.layerindex += 1 self.layerindex += 1
self.parent.SetStatusText(_("Layer %d - Going Up - Z = %.03f mm") % (self.layerindex + 1, self.layers[self.layerindex]), 0) z = self.get_currentz()
self.parent.SetStatusText(_("Layer %d - Going Up - Z = %.03f mm") % (self.layerindex + 1, z), 0)
self.dirty = 1 self.dirty = 1
self.parent.setlayercb(self.layerindex) self.parent.setlayercb(self.layerindex)
wx.CallAfter(self.Refresh) wx.CallAfter(self.Refresh)
...@@ -240,7 +245,8 @@ class Gviz(wx.Panel): ...@@ -240,7 +245,8 @@ class Gviz(wx.Panel):
def layerdown(self): def layerdown(self):
if self.layerindex > 0: if self.layerindex > 0:
self.layerindex -= 1 self.layerindex -= 1
self.parent.SetStatusText(_("Layer %d - Going Down - Z = %.03f mm") % (self.layerindex + 1, self.layers[self.layerindex]), 0) z = self.get_currentz()
self.parent.SetStatusText(_("Layer %d - Going Down - Z = %.03f mm") % (self.layerindex + 1, z), 0)
self.dirty = 1 self.dirty = 1
self.parent.setlayercb(self.layerindex) self.parent.setlayercb(self.layerindex)
wx.CallAfter(self.Refresh) wx.CallAfter(self.Refresh)
......
...@@ -581,9 +581,17 @@ class printcore(): ...@@ -581,9 +581,17 @@ class printcore():
except: pass except: pass
try: try:
self.printer.write(str(command + "\n")) self.printer.write(str(command + "\n"))
if self.printer_tcp: self.printer.flush() if self.printer_tcp:
try:
self.printer.flush()
except socket.timeout:
pass
self.writefailures = 0 self.writefailures = 0
except socket.error as e: except socket.error as e:
if e.errno is None:
self.logError(_(u"Can't write to printer (disconnected ?):") +
"\n" + traceback.format_exc())
else:
self.logError(_(u"Can't write to printer (disconnected?) (Socket error {0}): {1}").format(e.errno, decode_utf8(e.strerror))) self.logError(_(u"Can't write to printer (disconnected?) (Socket error {0}): {1}").format(e.errno, decode_utf8(e.strerror)))
self.writefailures += 1 self.writefailures += 1
except SerialException as e: except SerialException as e:
......
...@@ -572,7 +572,7 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -572,7 +572,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
m = wx.Menu() m = wx.Menu()
self.Bind(wx.EVT_MENU, self.about, self.Bind(wx.EVT_MENU, self.about,
m.Append(-1, _("&About Printrun"), _("Show about dialog"))) m.Append(-1, _("&About Printrun"), _("Show about dialog")))
self.menustrip.Append(m, _("&?")) self.menustrip.Append(m, _("&Help"))
def about(self, event): def about(self, event):
......
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