self.fileMenu.AppendSeparator()
i = self.fileMenu.Append(-1, _("Print...\tCTRL+P"))
- self.Bind(wx.EVT_MENU, lambda e: self.scene.showPrintWindow(), i)
+ self.Bind(wx.EVT_MENU, lambda e: self.scene.OnPrintButton(1), i)
i = self.fileMenu.Append(-1, _("Save GCode..."))
self.Bind(wx.EVT_MENU, lambda e: self.scene.showSaveGCode(), i)
i = self.fileMenu.Append(-1, _("Show slice engine log..."))
connection.window = printWindow2.printWindow(connection)
connection.window.Show()
connection.window.Raise()
- #TODO: Fix for _engine.getResult
- if not connection.loadFile(self._gcodeFilename):
+ if not connection.loadGCodeData(StringIO.StringIO(self._engine.getResult().getGCode())):
if connection.isPrinting():
self.notification.message("Cannot start print, because other print still running.")
else:
self.checkThread.start()
#Load the file into memory for printing.
- def loadFile(self, filename):
+ def loadGCodeData(self, dataStream):
if self._printing:
return False
self._fileBlocks = []
self._lineCount = 0
block = []
blockSize = 0
- f = open(filename, "r")
- for line in f:
+ for line in dataStream:
#Strip out comments, we do not need to send comments
if ';' in line:
line = line[:line.index(';')]
blockSize += len(line) + 1
block.append(line)
self._fileBlocks.append('\n'.join(block) + '\n')
- f.close()
self._doCallback()
return True
self.printThread.daemon = True
self.printThread.start()
- #Load the file into memory for printing.
- def loadFile(self, filename):
+ #Load the data into memory for printing, returns True on success
+ def loadGCodeData(self, dataStream):
if self._printing:
return False
self._lineCount = 0
- f = open(filename, "r")
- for line in f:
+ for line in dataStream:
#Strip out comments, we do not need to send comments
if ';' in line:
line = line[:line.index(';')]
def getName(self):
return self._name
- #Load the file into memory for printing, returns True on success
- def loadFile(self, filename):
+ #Load the data into memory for printing, returns True on success
+ def loadGCodeData(self, dataStream):
return False
#Start printing the previously loaded file