chiark / gitweb /
Fix doodle3D and Dummy printer connections for new in-memory engine interface.
authordaid <daid303@gmail.com>
Thu, 30 Jan 2014 07:38:14 +0000 (08:38 +0100)
committerdaid <daid303@gmail.com>
Thu, 30 Jan 2014 07:38:14 +0000 (08:38 +0100)
Cura/gui/mainWindow.py
Cura/gui/sceneView.py
Cura/util/printerConnection/doodle3dConnect.py
Cura/util/printerConnection/dummyConnection.py
Cura/util/printerConnection/printerConnectionBase.py

index b78fe37d46fe1bf60e00b11d7504e0da1349db37..8bc54b62414c6eae8051f8dcd48c4e3493bdb11c 100644 (file)
@@ -60,7 +60,7 @@ class mainWindow(wx.Frame):
 
                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..."))
index 337a18835306c54f4c2ba590ac2cbcabc99519b5..d37a0c06a7a84dc906f56830c9cd3fb4ba7f01b9 100644 (file)
@@ -267,8 +267,7 @@ class SceneView(openglGui.glGuiPanel):
                        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:
index 25b428513a8e580844638a6b693b066f37338167..918ee7a03b1ec006e4ac9765ccb31627d744be84 100644 (file)
@@ -122,15 +122,14 @@ class doodle3dConnect(printerConnectionBase.printerConnectionBase):
                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(';')]
@@ -148,7 +147,6 @@ class doodle3dConnect(printerConnectionBase.printerConnectionBase):
                        blockSize += len(line) + 1
                        block.append(line)
                self._fileBlocks.append('\n'.join(block) + '\n')
-               f.close()
                self._doCallback()
                return True
 
index 4d8dee0f113601404ae6609cec0a4e78f3dbfdf0..98c7f94b97751b4f86241c3e40def8d9813851ff 100644 (file)
@@ -29,13 +29,12 @@ class dummyConnection(printerConnectionBase.printerConnectionBase):
                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(';')]
index 41594fef2e9ac871a2c5201109f57d59c3e3743c..ab556a5feaf3928574642915747aa3f4fb61f143 100644 (file)
@@ -39,8 +39,8 @@ class printerConnectionBase(object):
        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