示例#1
0
	def updateTimesMidLayer(self, elapsed, lpct, timeLeftOct):
		if elapsed is None:
			self.totalElapsed.SetLabel("??")
		else:
			self.totalElapsed.SetLabel(formatElapsed(elapsed))

		if timeLeftOct is None:
			self.totalRemainOct.SetLabel("??")
		else:
			self.totalRemainOct.SetLabel(formatElapsed(timeLeftOct))

		if lpct is None or self.clt is None:
			self.totalPrevLayers.SetLabel("??")
			self.totalRemainCalc.SetLabel("??")
			self.totalDifference.SetLabel("??")
			self.currentPosition.SetLabel("")
		else:
			self.currentPosition.SetLabel(self.positionString(lpct))
			calcElapsed = self.prevLayers + lpct*self.clt
			self.totalPrevLayers.SetLabel(formatElapsed(calcElapsed))
			self.totalRemainCalc.SetLabel(formatElapsed(self.afterLayers + (1-lpct)*self.clt))
			if elapsed is None:
				self.totalDifference.SetLabel("??")
			else:
				diff = elapsed - calcElapsed
				if diff < 0:
					text = " (ahead)"
				elif diff > 0:
					text = " (behind)"
				else:
					text = ""
				self.totalDifference.SetLabel(formatElapsed(elapsed-calcElapsed) + text)
示例#2
0
	def formatLayerInfo(self, l, lx):
		sHt = "Height: {:.2f}  Layer: {:d} / {:d}".format(l.getHeight(), lx+1, self.layerCount)
		
		sTm = "  Print time: {:s}{:s}".format(formatElapsed(l.getLayerTime()), self.sTotalTime)
		o = l.getOffsets()
		if self.printPosition < o[0]:
			lyrs = self.gcode.getLayersBetweenOffsets(self.printPosition, o[0])
			untilTime = 0.0
			for ly in lyrs:
				untilTime += ly.getLayerTime()
			sTm += " ({:s} until)".format(formatElapsed(untilTime))

		sFi = "  Filament: "
		lf = l.getFilament()
		for i in range(self.nExtr):
			if i > 0:
				sFi += " / "
				
			if self.nExtr > 1:
				if i > 0:
					sFi += " - "
				sFi += "{:d}: ".format(i)
			sFi += "{:.2f}mm ({:.2f}cm3) / {:.2f}mm".format(lf[i][0], lf[i][1], self.filament[i][0])
			
		return sHt, sTm, sFi
示例#3
0
	def updateTimesNewLayer(self, layerx, elapsed, prevLayers, currentLayer, afterLayers, timeLeftOct):
		self.layerx = layerx
		if elapsed is None:
			self.totalElapsed.SetLabel("??")
		else:
			self.totalElapsed.SetLabel(formatElapsed(elapsed))
			
		self.totalPrevLayers.SetLabel(formatElapsed(prevLayers))

		if currentLayer is None:
			self.totalCurrentLayer.SetLabel("NA")
			self.clt = None
		else:
			self.totalCurrentLayer.SetLabel(formatElapsed(currentLayer))
			self.clt = currentLayer

		if timeLeftOct is None:		
			self.totalRemainOct.SetLabel("??")
		else:
			self.totalRemainOct.SetLabel(formatElapsed(timeLeftOct))
		
		self.totalRemainCalc.SetLabel(formatElapsed(afterLayers))
		self.afterLayers = afterLayers

		self.totalPrevLayers.SetLabel(formatElapsed(prevLayers))
		self.prevLayers = prevLayers

		self.currentPosition.SetLabel(self.positionString(0))
示例#4
0
	def updateTimesNewObject(self, fn, totOct, totCalc):
		if totOct is not None:
			self.updateTimesEstimated(totOct)

		self.setTitleText(fn)

		self.totalPTCalc.SetLabel(formatElapsed(totCalc))
		self.totalDifference.SetLabel("??")
		self.totalCurrentLayer.SetLabel("??")
		self.totalRemainOct.SetLabel("??")
		self.totalRemainCalc.SetLabel("??")
		self.currentPosition.SetLabel("")
		self.layerx = 0
示例#5
0
	def reloadGCode(self, gcode, filenm):
		self.filenm = filenm
		self.SetTitle(self.formatTitle(self.pname, filenm))
		self.gcode = gcode
		if self.gcode:
			self.sTotalTime = " / " + formatElapsed(self.gcode.getPrintTime())
			self.filament = self.gcode.getFilament()
		else:
			self.sTotalTime = ""
			self.filament = 0.0

		self.setSliderRange()

		# send new gcode to gcf
		self.printPosition = 0
		self.gcf.loadGCode(gcode)
		self.showLayerInfo()
示例#6
0
	def __init__(self, parent, server, gcode, filenm, pname, settings, images, cbexit):
		wx.Frame.__init__(self, None, wx.ID_ANY, self.formatTitle(pname, filenm))
		self.SetBackgroundColour("white")
		self.Bind(wx.EVT_CLOSE, self.onClose)

		self.parent = parent
		self.server = server
		self.gcode = gcode
		self.filenm = filenm
		self.pname = pname
		self.settings = settings
		self.images = images
		self.exitDlg = cbexit
		self.nExtr = self.parent.nExtr
		self.layerCount = 0
		if self.gcode:
			self.sTotalTime = " / " + formatElapsed(self.gcode.getPrintTime())
			self.filament = self.gcode.getFilament()
		else:
			self.sTotalTime = ""
			self.filament = [[0.0, 0.0]]

		self.printPosition = 0
		self.followPrint = True

		self.lx = 0

		lbFont = wx.Font(10, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD)

		self.gcf = GcFrame(self, self.pname, self.gcode, self.settings)
		self.stHeight = wx.StaticText(self, wx.ID_ANY, "")
		self.stHeight.SetFont(lbFont)
		self.stTime = wx.StaticText(self, wx.ID_ANY, "")
		self.stTime.SetFont(lbFont)
		self.stFilament = wx.StaticText(self, wx.ID_ANY, "")
		self.stFilament.SetFont(lbFont)
		self.slLayer = wx.Slider(self, wx.ID_ANY, 1, 1, 10, style=wx.SL_VERTICAL+wx.SL_LABELS+wx.SL_INVERSE)
		self.Bind(wx.EVT_SLIDER, self.onSlLayer, self.slLayer)
		self.bUp =  wx.BitmapButton(self, wx.ID_ANY, self.images.pngUp, size=BTNDIM, style=wx.NO_BORDER)
		self.bUp.SetBackgroundColour("white")
		self.Bind(wx.EVT_BUTTON, self.onBUp, self.bUp)
		self.bDown =  wx.BitmapButton(self, wx.ID_ANY, self.images.pngDown, size=BTNDIM, style=wx.NO_BORDER)
		self.bDown.SetBackgroundColour("white")
		self.Bind(wx.EVT_BUTTON, self.onBDown, self.bDown)

		self.setSliderRange()

		self.cbSync = wx.CheckBox(self, wx.ID_ANY, "Sync with print")
		self.cbSync.SetValue(True)
		self.Bind(wx.EVT_CHECKBOX, self.onCbSync, self.cbSync)
		self.cbPrintedOnly = wx.CheckBox(self, wx.ID_ANY, "Only show printed")
		self.cbPrintedOnly.SetValue(self.settings.getSetting("showprintedonly", self.pname, "False"))
		self.Bind(wx.EVT_CHECKBOX, self.onCbShowPrintedOnly, self.cbPrintedOnly)
		self.cbShowPrev = wx.CheckBox(self, wx.ID_ANY, "Show previous layer")
		self.cbShowPrev.SetValue(self.settings.getSetting("showprevious", self.pname, "False"))
		self.Bind(wx.EVT_CHECKBOX, self.onCbShowPrev, self.cbShowPrev)
		self.cbShowMoves = wx.CheckBox(self, wx.ID_ANY, "Show moves")
		self.cbShowMoves.SetValue(self.settings.getSetting("showmoves", self.pname, "False"))
		self.Bind(wx.EVT_CHECKBOX, self.onCbShowMoves, self.cbShowMoves)
		self.cbShowRetr = wx.CheckBox(self, wx.ID_ANY, "Show retractions")
		self.cbShowRetr.SetValue(self.settings.getSetting("showretractions", self.pname, "False"))
		self.Bind(wx.EVT_CHECKBOX, self.onCbShowRetr, self.cbShowRetr)
		self.cbShowRevRetr = wx.CheckBox(self, wx.ID_ANY, "Show reverse retractions")
		self.cbShowRevRetr.SetValue(self.settings.getSetting("showrevretractions", self.pname, "False"))
		self.Bind(wx.EVT_CHECKBOX, self.onCbShowRevRetr, self.cbShowRevRetr)

		sznavgc = wx.BoxSizer(wx.VERTICAL)
		sznavgc.Add(self.bUp, 0, wx.LEFT, 12 if os.name == 'posix' else 25)
		sznavgc.Add(self.slLayer, 1, wx.GROW)
		sznavgc.Add(self.bDown, 0, wx.LEFT, 12 if os.name == 'posix' else 25)

		szgcf = wx.BoxSizer(wx.VERTICAL)
		szgcf.Add(self.gcf)
		szgcf.AddSpacer(5)
		szgcf.Add(self.stHeight, 0, wx.ALIGN_CENTER)
		szgcf.AddSpacer(5)
		szgcf.Add(self.stTime, 0, wx.ALIGN_CENTER)
		szgcf.AddSpacer(5)
		szgcf.Add(self.stFilament, 0, wx.ALIGN_CENTER)

		szgc = wx.BoxSizer(wx.HORIZONTAL)
		szgc.AddSpacer(15)
		szgc.Add(szgcf)
		if os.name == 'posix':
			szgc.AddSpacer(10)
		szgc.Add(sznavgc, 1, wx.GROW)
		szgc.AddSpacer(15)

		szopt1 = wx.BoxSizer(wx.VERTICAL)
		szopt1.Add(self.cbSync, 1, wx.EXPAND)
		szopt1.Add(self.cbPrintedOnly, 1, wx.EXPAND)

		szopt2 = wx.BoxSizer(wx.VERTICAL)
		szopt2.Add(self.cbShowPrev, 1, wx.EXPAND)
		szopt2.Add(self.cbShowMoves, 1, wx.EXPAND)

		szopt3 = wx.BoxSizer(wx.VERTICAL)
		szopt3.Add(self.cbShowRetr, 1, wx.EXPAND)
		szopt3.Add(self.cbShowRevRetr, 1, wx.EXPAND)

		szoptions = wx.BoxSizer(wx.HORIZONTAL)
		szoptions.AddSpacer(20)
		szoptions.Add(szopt1, 1, wx.EXPAND)
		szoptions.AddSpacer(5)
		szoptions.Add(szopt2, 1, wx.EXPAND)
		szoptions.AddSpacer(5)
		szoptions.Add(szopt3, 1, wx.EXPAND)
		szoptions.AddSpacer(10)

		sz = wx.BoxSizer(wx.VERTICAL)
		sz.AddSpacer(10)
		sz.Add(szgc)
		sz.AddSpacer(5)
		sz.Add(szoptions)
		sz.AddSpacer(10)

		self.showLayerInfo()

		self.SetSizer(sz)
		self.Fit()
		self.Layout()
示例#7
0
	def updateTimesEstimated(self, totOct):
		if totOct is None:
			self.totalPTOct.SetLabel("??")
		else:
			self.totalPTOct.SetLabel(formatElapsed(totOct))