chiark / gitweb /
Disable OpenGL error checking, which makes the 3D preview a lot faster.
authordaid <daid303@gmail.com>
Thu, 22 Mar 2012 14:12:37 +0000 (15:12 +0100)
committerdaid <daid303@gmail.com>
Thu, 22 Mar 2012 14:12:37 +0000 (15:12 +0100)
SkeinPyPy/newui/gcodeInterpreter.py
SkeinPyPy/newui/mainWindow.py
SkeinPyPy/newui/preview3d.py

index 64d46675da8bfcc82dd130cfa4106c40694c567f..79c278dcc9d94ea365429fec277675ddb40dfe4f 100644 (file)
@@ -8,8 +8,9 @@ from newui import util3d
 
 class gcode():
        def __init__(self, filename):
-               print os.stat(filename).st_size
-               f = open(filename, 'r')
+               fileSize = os.stat(filename).st_size
+               filePos = 0
+               gcodeFile = open(filename, 'r')
                pos = util3d.Vector3()
                posOffset = util3d.Vector3()
                currentE = 0.0
@@ -25,7 +26,10 @@ class gcode():
                startCodeDone = False
                currentPath = {'type': 'move', 'pathType': pathType, 'list': [pos.copy()], 'layerNr': layerNr}
                currentPath['list'][-1].e = totalExtrusion
-               for line in f:
+               for line in gcodeFile:
+                       if filePos != gcodeFile.tell():
+                               filePos = gcodeFile.tell()
+                               #print float(filePos) / float(fileSize)
                        if line.startswith(';TYPE:'):
                                pathType = line[6:].strip()
                                if pathType != "CUSTOM":
@@ -144,6 +148,7 @@ class gcode():
                                                pass
                                        else:
                                                print "Unknown M code:" + str(M)
+               gcodeFile.close()
                self.layerCount = layerNr
                self.pathList = pathList
                self.extrusionAmount = maxExtrusion
index 69e2f427f785762faa39e3b7f8e18efaec2af4c2..9d04138f250c694a239f897c92a8086b23de60f6 100644 (file)
@@ -187,7 +187,6 @@ class mainWindow(configBase.configWindowBase):
                self.SetMinSize(self.GetSize())
                self.Centre()
                self.Show(True)
-               print self.GetSize()
        
        def OnLoadProfile(self, e):
                dlg=wx.FileDialog(self, "Select profile file to load", self.lastPath, style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST)
index a888ba7c932e9f0ff536d49ec9a6bb37df60aef0..7d0c1b1dba5f594bfbfc1e8cf00cecb7844e48fd 100644 (file)
@@ -8,6 +8,8 @@ import os
 from wx import glcanvas\r
 import wx\r
 try:\r
+       import OpenGL\r
+       OpenGL.ERROR_CHECKING = False\r
        from OpenGL.GLU import *\r
        from OpenGL.GL import *\r
        hasOpenGLlibs = True\r