chiark / gitweb /
Update on the 3D window, now with nice icons. Also added some more error logging...
authordaid303 <daid303@gmail.com>
Wed, 6 Mar 2013 14:13:50 +0000 (15:13 +0100)
committerdaid303 <daid303@gmail.com>
Wed, 6 Mar 2013 14:13:50 +0000 (15:13 +0100)
Cura/gui/preview3d.py
Cura/gui/util/opengl.py
Cura/gui/util/openglGui.py
Cura/resources/images/glButtons.png
Cura/slice/__main__.py
Cura/util/gcodeInterpreter.py

index b468884a9114965de36d1e2c331c5f518759a1e1..abf3274c0bd80f9c094aad5bf210ca86be454087 100644 (file)
@@ -80,33 +80,33 @@ class previewPanel(wx.Panel):
                self.checkReloadFileTimer.Start(1000)
 
                group = []
-               self.rotateToolButton = openglGui.glRadioButton(self.glCanvas, 1, 'Rotate', (0,-1), group, self.OnToolSelect)
-               self.scaleToolButton  = openglGui.glRadioButton(self.glCanvas, 2, 'Scale', (1,-1), group, self.OnToolSelect)
-               self.mirrorToolButton  = openglGui.glRadioButton(self.glCanvas, 12, 'Mirror', (2,-1), group, self.OnToolSelect)
+               self.rotateToolButton = openglGui.glRadioButton(self.glCanvas, 8, 'Rotate', (0,-1), group, self.OnToolSelect)
+               self.scaleToolButton  = openglGui.glRadioButton(self.glCanvas, 9, 'Scale', (1,-1), group, self.OnToolSelect)
+               self.mirrorToolButton  = openglGui.glRadioButton(self.glCanvas, 10, 'Mirror', (2,-1), group, self.OnToolSelect)
 
-               self.resetRotationButton = openglGui.glButton(self.glCanvas, 4, 'Reset rotation', (0,-2), self.OnRotateReset)
-               self.layFlatButton       = openglGui.glButton(self.glCanvas, 5, 'Lay flat', (0,-3), self.OnLayFlat)
+               self.resetRotationButton = openglGui.glButton(self.glCanvas, 12, 'Reset rotation', (0,-2), self.OnRotateReset)
+               self.layFlatButton       = openglGui.glButton(self.glCanvas, 16, 'Lay flat', (0,-3), self.OnLayFlat)
 
-               self.resetScaleButton    = openglGui.glButton(self.glCanvas, 8, 'Scale reset', (1,-2), self.OnScaleReset)
-               self.scaleMaxButton      = openglGui.glButton(self.glCanvas, 9, 'Scale to machine size', (1,-3), self.OnScaleMax)
+               self.resetScaleButton    = openglGui.glButton(self.glCanvas, 13, 'Scale reset', (1,-2), self.OnScaleReset)
+               self.scaleMaxButton      = openglGui.glButton(self.glCanvas, 17, 'Scale to machine size', (1,-3), self.OnScaleMax)
 
-               self.mirrorXButton       = openglGui.glButton(self.glCanvas, 12, 'Mirror X', (2,-2), lambda : self.OnMirror(0))
-               self.mirrorYButton       = openglGui.glButton(self.glCanvas, 13, 'Mirror Y', (2,-3), lambda : self.OnMirror(1))
-               self.mirrorZButton       = openglGui.glButton(self.glCanvas, 14, 'Mirror Z', (2,-4), lambda : self.OnMirror(2))
+               self.mirrorXButton       = openglGui.glButton(self.glCanvas, 14, 'Mirror X', (2,-2), lambda : self.OnMirror(0))
+               self.mirrorYButton       = openglGui.glButton(self.glCanvas, 18, 'Mirror Y', (2,-3), lambda : self.OnMirror(1))
+               self.mirrorZButton       = openglGui.glButton(self.glCanvas, 22, 'Mirror Z', (2,-4), lambda : self.OnMirror(2))
 
-               self.openFileButton      = openglGui.glButton(self.glCanvas, 3, 'Load model', (0,0), lambda : self.GetParent().GetParent().GetParent()._showModelLoadDialog(1))
-               self.sliceButton         = openglGui.glButton(self.glCanvas, 6, 'Prepare model', (1,0), lambda : self.GetParent().GetParent().GetParent().OnSlice(None))
-               self.printButton         = openglGui.glButton(self.glCanvas, 7, 'Print model', (2,0), lambda : self.GetParent().GetParent().GetParent().OnPrint(None))
+               self.openFileButton      = openglGui.glButton(self.glCanvas, 4, 'Load model', (0,0), lambda : self.GetParent().GetParent().GetParent()._showModelLoadDialog(1))
+               self.sliceButton         = openglGui.glButton(self.glCanvas, 5, 'Prepare model', (1,0), lambda : self.GetParent().GetParent().GetParent().OnSlice(None))
+               self.printButton         = openglGui.glButton(self.glCanvas, 6, 'Print model', (2,0), lambda : self.GetParent().GetParent().GetParent().OnPrint(None))
 
                extruderCount = int(profile.getPreference('extruder_amount'))
                if extruderCount > 1:
-                       openglGui.glButton(self.glCanvas, 3, 'Load dual model', (0,1), lambda : self.GetParent().GetParent().GetParent()._showModelLoadDialog(2))
+                       openglGui.glButton(self.glCanvas, 4, 'Load dual model', (0,1), lambda : self.GetParent().GetParent().GetParent()._showModelLoadDialog(2))
                if extruderCount > 2:
-                       openglGui.glButton(self.glCanvas, 3, 'Load triple model', (0,2), lambda : self.GetParent().GetParent().GetParent()._showModelLoadDialog(3))
+                       openglGui.glButton(self.glCanvas, 4, 'Load triple model', (0,2), lambda : self.GetParent().GetParent().GetParent()._showModelLoadDialog(3))
                if extruderCount > 3:
-                       openglGui.glButton(self.glCanvas, 3, 'Load quad model', (0,3), lambda : self.GetParent().GetParent().GetParent()._showModelLoadDialog(4))
+                       openglGui.glButton(self.glCanvas, 4, 'Load quad model', (0,3), lambda : self.GetParent().GetParent().GetParent()._showModelLoadDialog(4))
 
-               self.scaleForm = openglGui.glFrame(self.glCanvas, (2, -3))
+               self.scaleForm = openglGui.glFrame(self.glCanvas, (2, -2))
                openglGui.glGuiLayoutGrid(self.scaleForm)
                openglGui.glLabel(self.scaleForm, 'Scale X', (0,0))
                self.scaleXctrl = openglGui.glNumberCtrl(self.scaleForm, '1.0', (1,0), lambda value: self.OnScaleEntry(value, 0))
@@ -123,21 +123,16 @@ class previewPanel(wx.Panel):
                openglGui.glLabel(self.scaleForm, 'Uniform scale', (0,8))
                self.scaleUniform = openglGui.glCheckbox(self.scaleForm, True, (1,8), None)
 
-               self.viewSelection = openglGui.glComboButton(self.glCanvas, 'View mode', [0,1,2,3,4], ['3D Model', 'Transparent', 'X-Ray', 'Overhang', 'Layers'], (-1,0), self.OnViewChange)
+               self.viewSelection = openglGui.glComboButton(self.glCanvas, 'View mode', [7,11,15,19,23], ['3D Model', 'Transparent', 'X-Ray', 'Overhang', 'Layers'], (-1,0), self.OnViewChange)
                self.layerSelect = openglGui.glSlider(self.glCanvas, 0, 0, 100, (-1,-2), self.OnLayerNrChange)
 
                self.OnViewChange()
                self.OnToolSelect()
-               self.returnToModelViewAndUpdateModel()
+               self.updateModelTransform()
 
                self.matrix = numpy.matrix(numpy.array(profile.getObjectMatrix(), numpy.float64).reshape((3,3,)))
 
-       def returnToModelViewAndUpdateModel(self):
-               if self.glCanvas.viewMode == 'GCode' or self.glCanvas.viewMode == 'Mixed':
-                       self.setViewMode('Normal')
-               self.updateModelTransform()
-
-       def OnToolSelect(self, resetView = True):
+       def OnToolSelect(self):
                if self.rotateToolButton.getSelected():
                        self.tool = previewTools.toolRotate(self.glCanvas)
                elif self.scaleToolButton.getSelected():
@@ -154,8 +149,7 @@ class previewPanel(wx.Panel):
                self.mirrorXButton.setHidden(not self.mirrorToolButton.getSelected())
                self.mirrorYButton.setHidden(not self.mirrorToolButton.getSelected())
                self.mirrorZButton.setHidden(not self.mirrorToolButton.getSelected())
-               if resetView:
-                       self.returnToModelViewAndUpdateModel()
+               self.updateModelTransform()
 
        def OnScaleEntry(self, value, axis):
                try:
@@ -479,7 +473,6 @@ class previewPanel(wx.Panel):
                self.rotateToolButton.setSelected(False)
                self.scaleToolButton.setSelected(False)
                self.mirrorToolButton.setSelected(False)
-               self.OnToolSelect(False)
                self.glCanvas.Refresh()
        
        def updateModelTransform(self, f=0):
@@ -859,7 +852,9 @@ class PreviewGLCanvas(openglGui.glGuiPanel):
        def drawModel(self, displayList):
                vMin = self.parent.objectsMinV
                vMax = self.parent.objectsMaxV
-               offset = - vMin - (vMax - vMin) / 2
+               if vMin is None:
+                       return
+               offset = - vMin - (vMax - vMin) / 2
 
                matrix = opengl.convert3x3MatrixTo4x4(self.parent.matrix)
 
index b01eb2cf0245b3da044b736571687404084d5b20..dd80b8ae56d373924401c4570d5822fdf92841d8 100644 (file)
@@ -214,6 +214,32 @@ def glDrawStringRight(s):
        for c in s:
                glutBitmapCharacter(OpenGL.GLUT.GLUT_BITMAP_HELVETICA_18, ord(c))
 
+def glDrawTexturedQuad(x, y, w, h, texID, mirror = 0):
+       tx = float(texID % 4) / 4
+       ty = float(int(texID / 4)) / 8
+       tsx = 0.25
+       tsy = 0.125
+       if mirror & 1:
+               tx += tsx
+               tsx = -tsx
+       if mirror & 2:
+               ty += tsy
+               tsy = -tsy
+       glPushMatrix()
+       glTranslatef(x, y, 0)
+       glEnable(GL_TEXTURE_2D)
+       glBegin(GL_QUADS)
+       glTexCoord2f(tx+tsx, ty)
+       glVertex2f(w, 0)
+       glTexCoord2f(tx, ty)
+       glVertex2f(0, 0)
+       glTexCoord2f(tx, ty+tsy)
+       glVertex2f(0, h)
+       glTexCoord2f(tx+tsx, ty+tsy)
+       glVertex2f(w, h)
+       glEnd()
+       glPopMatrix()
+
 def unproject(winx, winy, winz, modelMatrix, projMatrix, viewport):
        npModelMatrix = numpy.matrix(numpy.array(modelMatrix, numpy.float64).reshape((4,4)))
        npProjMatrix = numpy.matrix(numpy.array(projMatrix, numpy.float64).reshape((4,4)))
index 408c026e644d3fbfeac45ce58cc16d9bd9d45ec8..4af5418d7c54fe86a68699c108e3e2ea208fe0ba 100644 (file)
@@ -2,7 +2,9 @@ from __future__ import absolute_import
 from __future__ import division
 
 import wx
-import math
+import traceback
+import sys
+import os
 
 from wx import glcanvas
 import OpenGL
@@ -105,6 +107,7 @@ class glGuiPanel(glcanvas.GLCanvas):
                self._focus = None
                self._container = None
                self._container = glGuiContainer(self, (0,0))
+               self._shownError = False
 
                self._context = glcanvas.GLContext(self)
                self._glButtonsTexture = None
@@ -166,11 +169,22 @@ class glGuiPanel(glcanvas.GLCanvas):
                        self._container.updateLayout()
 
                dc = wx.PaintDC(self)
-               self.SetCurrent(self._context)
-               self.OnPaint(e)
-               self._drawGui()
-               glFlush()
-               self.SwapBuffers()
+               try:
+                       self.SetCurrent(self._context)
+                       self.OnPaint(e)
+                       self._drawGui()
+                       glFlush()
+                       self.SwapBuffers()
+               except:
+                       errStr = 'An error has occurred during the 3D view drawing.'
+                       tb = traceback.extract_tb(sys.exc_info()[2])
+                       errStr += "\n%s: '%s'" % (str(sys.exc_info()[0].__name__), str(sys.exc_info()[1]))
+                       for n in xrange(len(tb)-1, -1, -1):
+                               locationInfo = tb[n]
+                               errStr += "\n @ %s:%s:%d" % (os.path.basename(locationInfo[0]), locationInfo[2], locationInfo[1])
+                       if not self._shownError:
+                               wx.CallAfter(wx.MessageBox, errStr, '3D window error', wx.OK | wx.ICON_EXCLAMATION)
+                               self._shownError = True
 
        def _drawGui(self):
                if self._glButtonsTexture is None:
@@ -262,6 +276,7 @@ class glGuiLayoutGrid(object):
                self._parent = parent
                self._parent._layout = self
                self._size = 0,0
+               self._alignBottom = True
 
        def update(self):
                borderSize = self._parent._base._buttonSize * 0.2
@@ -281,6 +296,10 @@ class glGuiLayoutGrid(object):
                                heights[y] = h
                        else:
                                heights[y] = max(heights[y], h)
+               self._size = sum(widths.values()) + borderSize * 2, sum(heights.values()) + borderSize * 2
+               if self._alignBottom:
+                       y0 -= self._size[1] - self._parent.getSize()[3]
+                       self._parent.setSize(x0 - borderSize, y0 - borderSize, self._size[0], self._size[1])
                for ctrl in self._parent._glGuiControlList:
                        x, y = ctrl._pos
                        x1 = x0
@@ -294,7 +313,6 @@ class glGuiLayoutGrid(object):
                                        heights[n] = 3
                                y1 += heights[n]
                        ctrl.setSize(x1, y1, widths[x], heights[y])
-               self._size = sum(widths.values()) + borderSize * 2, sum(heights.values()) + borderSize * 2
 
        def getLayoutSize(self):
                return self._size
@@ -339,34 +357,23 @@ class glButton(glGuiControl):
                bs = self._base._buttonSize
                pos = self._getPixelPos()
 
-               glPushMatrix()
-               glTranslatef(pos[0], pos[1], 0)
                glBindTexture(GL_TEXTURE_2D, self._base._glButtonsTexture)
-               glEnable(GL_TEXTURE_2D)
                scale = 0.8
                if self._selected:
                        scale = 1.0
                elif self._focus:
                        scale = 0.9
-               glScalef(bs * scale, bs * scale, bs * scale)
                if self._disabled:
                        glColor4ub(128,128,128,128)
                else:
                        glColor4ub(255,255,255,255)
-               glBegin(GL_QUADS)
-               glTexCoord2f(cx+0.25, cy)
-               glVertex2f( 0.5,-0.5)
-               glTexCoord2f(cx, cy)
-               glVertex2f(-0.5,-0.5)
-               glTexCoord2f(cx, cy+0.25)
-               glVertex2f(-0.5, 0.5)
-               glTexCoord2f(cx+0.25, cy+0.25)
-               glVertex2f( 0.5, 0.5)
-               glEnd()
+               opengl.glDrawTexturedQuad(pos[0]-bs*scale/2, pos[1]-bs*scale/2, bs*scale, bs*scale, self._imageID)
+               glPushMatrix()
+               glTranslatef(pos[0], pos[1], 0)
                glDisable(GL_TEXTURE_2D)
                if self._focus:
                        glColor4ub(0,0,0,255)
-                       glTranslatef(0, -0.55, 0)
+                       glTranslatef(0, -0.55*bs, 0)
                        opengl.glDrawStringCenter(self._tooltip)
                glPopMatrix()
 
@@ -420,42 +427,31 @@ class glComboButton(glButton):
                self._selection = 0
 
        def _onComboOpenSelect(self):
-               self._base._focus = self
+               if self.hasFocus():
+                       self._base._focus = None
+               else:
+                       self._base._focus = self
 
        def draw(self):
                if self._hidden:
                        return
                self._selected = self.hasFocus()
                super(glComboButton, self).draw()
-               if not self._selected:
-                       return
 
                bs = self._base._buttonSize / 2
                pos = self._getPixelPos()
 
+               if not self._selected:
+                       return
+
                glPushMatrix()
                glTranslatef(pos[0]+bs*0.5, pos[1] + bs*0.5, 0)
                glBindTexture(GL_TEXTURE_2D, self._base._glButtonsTexture)
                glScalef(bs, bs, bs)
                for n in xrange(0, len(self._imageIDs)):
-                       cx = (self._imageIDs[n] % 4) / 4
-                       cy = int(self._imageIDs[n] / 4) / 4
-                       glEnable(GL_TEXTURE_2D)
                        glTranslatef(0, 1, 0)
-                       if self._disabled:
-                               glColor4ub(128,128,128,128)
-                       else:
-                               glColor4ub(255,255,255,255)
-                       glBegin(GL_QUADS)
-                       glTexCoord2f(cx+0.25, cy)
-                       glVertex2f( 0.5,-0.5)
-                       glTexCoord2f(cx, cy)
-                       glVertex2f(-0.5,-0.5)
-                       glTexCoord2f(cx, cy+0.25)
-                       glVertex2f(-0.5, 0.5)
-                       glTexCoord2f(cx+0.25, cy+0.25)
-                       glVertex2f( 0.5, 0.5)
-                       glEnd()
+                       glColor3ub(255,255,255)
+                       opengl.glDrawTexturedQuad(-0.5,-0.5,1,1, self._imageIDs[n])
                        glDisable(GL_TEXTURE_2D)
 
                        glPushMatrix()
@@ -518,19 +514,110 @@ class glFrame(glGuiContainer):
 
                glPushMatrix()
                glTranslatef(pos[0], pos[1], 0)
-               glDisable(GL_TEXTURE_2D)
+               glBindTexture(GL_TEXTURE_2D, self._base._glButtonsTexture)
+               glEnable(GL_TEXTURE_2D)
 
                size = self._layout.getLayoutSize()
-               glColor4ub(60,60,60,255)
+               glColor4ub(255,255,255,255)
                glBegin(GL_QUADS)
-               glTexCoord2f(1, 0)
-               glVertex2f( size[0], 0)
+               bs /= 2
+               tc = 1 / 4 / 2
+
+#              glTexCoord2f(1, 0)
+#              glVertex2f( size[0], 0)
+#              glTexCoord2f(0, 0)
+#              glVertex2f( 0, 0)
+#              glTexCoord2f(0, 1)
+#              glVertex2f( 0, size[1])
+#              glTexCoord2f(1, 1)
+#              glVertex2f( size[0], size[1])
+               #TopLeft
+               glTexCoord2f(tc, 0)
+               glVertex2f( bs, 0)
                glTexCoord2f(0, 0)
                glVertex2f( 0, 0)
-               glTexCoord2f(0, 1)
+               glTexCoord2f(0, tc/2)
+               glVertex2f( 0, bs)
+               glTexCoord2f(tc, tc/2)
+               glVertex2f( bs, bs)
+               #TopRight
+               glTexCoord2f(tc+tc, 0)
+               glVertex2f( size[0], 0)
+               glTexCoord2f(tc, 0)
+               glVertex2f( size[0] - bs, 0)
+               glTexCoord2f(tc, tc/2)
+               glVertex2f( size[0] - bs, bs)
+               glTexCoord2f(tc+tc, tc/2)
+               glVertex2f( size[0], bs)
+               #BottomLeft
+               glTexCoord2f(tc, tc/2)
+               glVertex2f( bs, size[1] - bs)
+               glTexCoord2f(0, tc/2)
+               glVertex2f( 0, size[1] - bs)
+               glTexCoord2f(0, tc/2+tc/2)
                glVertex2f( 0, size[1])
-               glTexCoord2f(1, 1)
+               glTexCoord2f(tc, tc/2+tc/2)
+               glVertex2f( bs, size[1])
+               #BottomRight
+               glTexCoord2f(tc+tc, tc/2)
+               glVertex2f( size[0], size[1] - bs)
+               glTexCoord2f(tc, tc/2)
+               glVertex2f( size[0] - bs, size[1] - bs)
+               glTexCoord2f(tc, tc/2+tc/2)
+               glVertex2f( size[0] - bs, size[1])
+               glTexCoord2f(tc+tc, tc/2+tc/2)
                glVertex2f( size[0], size[1])
+
+               #Center
+               glTexCoord2f(tc, tc/2)
+               glVertex2f( size[0]-bs, bs)
+               glTexCoord2f(tc, tc/2)
+               glVertex2f( bs, bs)
+               glTexCoord2f(tc, tc/2)
+               glVertex2f( bs, size[1]-bs)
+               glTexCoord2f(tc, tc/2)
+               glVertex2f( size[0]-bs, size[1]-bs)
+
+               #Right
+               glTexCoord2f(tc+tc, tc/2)
+               glVertex2f( size[0], bs)
+               glTexCoord2f(tc, tc/2)
+               glVertex2f( size[0]-bs, bs)
+               glTexCoord2f(tc, tc/2)
+               glVertex2f( size[0]-bs, size[1]-bs)
+               glTexCoord2f(tc+tc, tc/2)
+               glVertex2f( size[0], size[1]-bs)
+
+               #Left
+               glTexCoord2f(tc, tc/2)
+               glVertex2f( bs, bs)
+               glTexCoord2f(0, tc/2)
+               glVertex2f( 0, bs)
+               glTexCoord2f(0, tc/2)
+               glVertex2f( 0, size[1]-bs)
+               glTexCoord2f(tc, tc/2)
+               glVertex2f( bs, size[1]-bs)
+
+               #Top
+               glTexCoord2f(tc, 0)
+               glVertex2f( size[0]-bs, 0)
+               glTexCoord2f(tc, 0)
+               glVertex2f( bs, 0)
+               glTexCoord2f(tc, tc/2)
+               glVertex2f( bs, bs)
+               glTexCoord2f(tc, tc/2)
+               glVertex2f( size[0]-bs, bs)
+
+               #Bottom
+               glTexCoord2f(tc, tc/2)
+               glVertex2f( size[0]-bs, size[1]-bs)
+               glTexCoord2f(tc, tc/2)
+               glVertex2f( bs, size[1]-bs)
+               glTexCoord2f(tc, tc/2+tc/2)
+               glVertex2f( bs, size[1])
+               glTexCoord2f(tc, tc/2+tc/2)
+               glVertex2f( size[0]-bs, size[1])
+
                glEnd()
                glDisable(GL_TEXTURE_2D)
                glPopMatrix()
@@ -577,20 +664,20 @@ class glLabel(glGuiControl):
                glPushMatrix()
                glTranslatef(x, y, 0)
 
-               glColor4ub(255,255,255,128)
-               glBegin(GL_QUADS)
-               glTexCoord2f(1, 0)
-               glVertex2f( w, 0)
-               glTexCoord2f(0, 0)
-               glVertex2f( 0, 0)
-               glTexCoord2f(0, 1)
-               glVertex2f( 0, h)
-               glTexCoord2f(1, 1)
-               glVertex2f( w, h)
-               glEnd()
+#              glColor4ub(255,255,255,128)
+#              glBegin(GL_QUADS)
+#              glTexCoord2f(1, 0)
+#              glVertex2f( w, 0)
+#              glTexCoord2f(0, 0)
+#              glVertex2f( 0, 0)
+#              glTexCoord2f(0, 1)
+#              glVertex2f( 0, h)
+#              glTexCoord2f(1, 1)
+#              glVertex2f( w, h)
+#              glEnd()
 
                glTranslate(5, h - 5, 0)
-               glColor4ub(0,0,0,255)
+               glColor4ub(255,255,255,255)
                opengl.glDrawStringLeft(self._label)
                glPopMatrix()
 
@@ -641,9 +728,9 @@ class glNumberCtrl(glGuiControl):
                glTexCoord2f(0, 0)
                glVertex2f( 0, 0)
                glTexCoord2f(0, 1)
-               glVertex2f( 0, h)
+               glVertex2f( 0, h-1)
                glTexCoord2f(1, 1)
-               glVertex2f( w, h)
+               glVertex2f( w, h-1)
                glEnd()
 
                glTranslate(5, h - 5, 0)
@@ -747,20 +834,11 @@ class glCheckbox(glGuiControl):
                glPushMatrix()
                glTranslatef(x, y, 0)
 
+               glColor3ub(255,255,255)
                if self._value:
-                       glColor4ub(0,255,0,255)
+                       opengl.glDrawTexturedQuad(w/2-h/2,0, h, h, 28)
                else:
-                       glColor4ub(255,0,0,255)
-               glBegin(GL_QUADS)
-               glTexCoord2f(1, 0)
-               glVertex2f( w, 0)
-               glTexCoord2f(0, 0)
-               glVertex2f( 0, 0)
-               glTexCoord2f(0, 1)
-               glVertex2f( 0, h)
-               glTexCoord2f(1, 1)
-               glVertex2f( w, h)
-               glEnd()
+                       opengl.glDrawTexturedQuad(w/2-h/2,0, h, h, 29)
 
                glPopMatrix()
 
index 444b8762125a1cc55336859ba788376897f2ac51..3b3f8afe0cfeae3c0e3550c07bca77212a042dd8 100644 (file)
Binary files a/Cura/resources/images/glButtons.png and b/Cura/resources/images/glButtons.png differ
index 66f20db12e9bcab3556cbf4e8274a0224bc959cc..9f4e585825359be223223e1049fc04c0cc8a945d 100644 (file)
@@ -59,6 +59,8 @@ def main():
                        zString = zString[0:zString.find(' ')]
                        clearZ = max(clearZ, float(zString) + 10)
                        profile.setTempOverride('clear_z', clearZ)
+                       print position
+                       print profile.getAlterationFileContents('nextobject.gcode')
                        resultFile.write(profile.getAlterationFileContents('nextobject.gcode').replace('?filename?', ' '.join(filenames).encode('ascii', 'replace')))
 
                output = []
index 6c815d3b459000020840ee7e4282e63eb17311cc..901595c74f657acef0e06d702e3d4e82a4a23a0a 100644 (file)
@@ -248,6 +248,8 @@ class gcode(object):
                                                pass
                                        elif M == 113:  #Extruder PWM (these should not be in the final GCode, but they are)
                                                pass
+                                       elif M == 117:  #LCD message
+                                               pass
                                        elif M == 140:  #Set bed temperature
                                                pass
                                        elif M == 190:  #Set bed temperature & wait
@@ -281,7 +283,7 @@ class gcode(object):
                if code not in self.regMatch:
                        self.regMatch[code] = re.compile(code + '([^\s]+)')
                m = self.regMatch[code].search(line)
-               if m == None:
+               if m is None:
                        return None
                try:
                        return float(m.group(1))