isPrinting = connection.isPrinting() or connection.isPaused()
if self._progressBar is not None:
if isPrinting:
- self._progressBar.SetValue(connection.getPrintProgress() * 1000)
+ (current, total, z) = connection.getPrintProgress()
+ progress = 0.0
+ if total > 0:
+ progress = float(current) / float(total)
+ self._progressBar.SetValue(progress * 1000)
else:
self._progressBar.SetValue(0)
info = connection.getStatusString()
self._updateButtonStates()
onGoingPrint = connection.isPrinting() or connection.isPaused()
if onGoingPrint:
- self.progress.SetValue(connection.getPrintProgress() * 1000)
+ (current, total, z) = connection.getPrintProgress()
+ progress = 0.0
+ if total > 0:
+ progress = float(current) / float(total)
+ self.progress.SetValue(progress * 1000)
else:
self.progress.SetValue(0)
info = connection.getStatusString()
self.temperatureBedField = TemperatureField(self.panel, self._setBedTemperature)
self.temperatureGraph = TemperatureGraph(self.panel)
self.temperatureGraph.SetMinSize((250, 100))
+ self.printStatus = wx.StaticText(parent=self.panel, id=-1, label="");
self.progress = wx.Gauge(self.panel, -1, range=1000)
f = wx.Font(8, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False)
self.sizer.Add(self.temperatureBedField, pos=(5, 2))
self.sizer.Add(self._termLog, pos=(0, 3), span=(5, 3), flag=wx.EXPAND|wx.RIGHT, border=5)
self.sizer.Add(self._termInput, pos=(5, 3), span=(1, 3), flag=wx.EXPAND|wx.RIGHT, border=5)
- self.sizer.Add(self.progress, pos=(6, 0), span=(1, 6), flag=wx.EXPAND|wx.BOTTOM)
+ self.sizer.Add(self.printStatus, pos=(6, 0), span=(1, 6), flag=wx.EXPAND|wx.BOTTOM|wx.TOP, border=5)
+ self.sizer.Add(self.progress, pos=(7, 0), span=(1, 6), flag=wx.EXPAND|wx.BOTTOM)
self.Bind(wx.EVT_SIZE, self.OnSize)
self.Bind(wx.EVT_CLOSE, self.OnClose)
self._updateButtonStates()
isPrinting = connection.isPrinting() or connection.isPaused()
if isPrinting:
- self.progress.SetValue(connection.getPrintProgress() * 1000)
+ (current, total, z) = connection.getPrintProgress()
+ progress = 0.0
+ if total > 0:
+ progress = float(current) / float(total)
+ self.progress.SetValue(progress * 1000)
+ self.printStatus.SetLabel(_("Printing %.2f%% | Line %d of %d lines | Z: %.3f mm") % (progress * 100, current, total, z))
else:
self.progress.SetValue(0)
info = connection.getStatusString()
self._commState = None
self._commStateString = None
self._gcodeData = []
+ self._printProgress = 0
+ self._ZPosition = 0
#Load the data into memory for printing, returns True on success
def loadGCodeData(self, dataStream):
self._process.stdin.write('G:%s\n' % (line))
self._process.stdin.write('START\n')
self._printProgress = 0
+ self._ZPosition = 0
def coolDown(self):
cooldown_toolhead = "M104 S0"
def pause(self, value):
if not (self.isPrinting() or self.isPaused()) or self._process is None:
return
- self._process.stdin.write('PAUSE\n' if value else "RESUME\n")
+ if value:
+ self._process.stdin.write("PAUSE\n")
+ else:
+ self._process.stdin.write("RESUME\n")
#Amount of progression of the current print file. 0.0 to 1.0
def getPrintProgress(self):
- if len(self._gcodeData) < 1:
- return 0.0
- return float(self._printProgress) / float(len(self._gcodeData))
+ return (self._printProgress, len(self._gcodeData), self._ZPosition)
# Return if the printer with this connection type is available
def isAvailable(self):
elif line[0] == 'progress':
self._printProgress = int(line[1])
self._doCallback()
+ elif line[0] == 'changeZ':
+ self._ZPosition = float(line[1])
+ self._doCallback()
else:
print line
line = self._process.stdout.readline()