From a1ce9a995b41d307b96289c2fce34b75749c4a08 Mon Sep 17 00:00:00 2001 From: daid Date: Thu, 22 Mar 2012 15:12:37 +0100 Subject: [PATCH] Disable OpenGL error checking, which makes the 3D preview a lot faster. --- SkeinPyPy/newui/gcodeInterpreter.py | 11 ++++++++--- SkeinPyPy/newui/mainWindow.py | 1 - SkeinPyPy/newui/preview3d.py | 2 ++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/SkeinPyPy/newui/gcodeInterpreter.py b/SkeinPyPy/newui/gcodeInterpreter.py index 64d46675..79c278dc 100644 --- a/SkeinPyPy/newui/gcodeInterpreter.py +++ b/SkeinPyPy/newui/gcodeInterpreter.py @@ -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 diff --git a/SkeinPyPy/newui/mainWindow.py b/SkeinPyPy/newui/mainWindow.py index 69e2f427..9d04138f 100644 --- a/SkeinPyPy/newui/mainWindow.py +++ b/SkeinPyPy/newui/mainWindow.py @@ -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) diff --git a/SkeinPyPy/newui/preview3d.py b/SkeinPyPy/newui/preview3d.py index a888ba7c..7d0c1b1d 100644 --- a/SkeinPyPy/newui/preview3d.py +++ b/SkeinPyPy/newui/preview3d.py @@ -8,6 +8,8 @@ import os from wx import glcanvas import wx try: + import OpenGL + OpenGL.ERROR_CHECKING = False from OpenGL.GLU import * from OpenGL.GL import * hasOpenGLlibs = True -- 2.30.2