chiark / gitweb /
Change how the engine is interfaced from the python code. Put the GCode viewer in...
[cura.git] / Cura / gui / util / previewTools.py
index 0b4a3d3a63e6282b3b2f57c0e273cecd203e735b..372d9cf2ff039bc3a3f6d16d4812ba043257665a 100644 (file)
@@ -1,11 +1,12 @@
 from __future__ import absolute_import
+__copyright__ = "Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License"
 
 import math
 import wx
 import numpy
 
 import OpenGL
-OpenGL.ERROR_CHECKING = False
+#OpenGL.ERROR_CHECKING = False
 from OpenGL.GLU import *
 from OpenGL.GL import *
 
@@ -149,6 +150,7 @@ class toolRotate(object):
                        else:
                                self.dragPlane = 'YZ'
                                self.dragStartAngle = math.atan2(cursorX0[2], cursorX0[1]) * 180 / math.pi
+                       self.dragEndAngle = self.dragStartAngle
                        return True
                return False
 
@@ -207,7 +209,7 @@ class toolRotate(object):
                                glEnd()
                                glTranslatef(1.1,0,0)
                                glColor4ub(0,0,0,255)
-                               opengl.glDrawStringCenter("%d" % (abs(self.dragEndAngle - self.dragStartAngle)))
+                               opengl.glDrawStringCenter("%d" % (abs(self.dragEndAngle - self.dragStartAngle) + 0.5))
                                glColor4ub(255,64,64,255)
                                glPopMatrix()
                else:
@@ -315,7 +317,7 @@ class toolScale(object):
                return t
 
        def _nodeSize(self):
-               return float(self.parent.zoom) / float(self.parent.GetSize().GetWidth()) * 6.0
+               return float(self.parent._zoom) / float(self.parent.GetSize().GetWidth()) * 6.0
 
        def OnMouseMove(self, p0, p1):
                self.node = self._traceNodes(p0, p1)
@@ -398,11 +400,11 @@ class toolScale(object):
                        radius *= self.scale
                glPushMatrix()
                glTranslate(0,0,size[2]/2 + 5)
-               glRotate(-self.parent.yaw, 0,0,1)
-               if self.parent.pitch < 80:
+               glRotate(-self.parent._yaw, 0,0,1)
+               if self.parent._pitch < 80:
                        glTranslate(0, radius + 5,0)
-               elif self.parent.pitch < 100:
-                       glTranslate(0, (radius + 5) * (90 - self.parent.pitch) / 10,0)
+               elif self.parent._pitch < 100:
+                       glTranslate(0, (radius + 5) * (90 - self.parent._pitch) / 10,0)
                else:
                        glTranslate(0,-(radius + 5),0)
                if self.parent.tempMatrix is not None:
@@ -415,10 +417,10 @@ class toolScale(object):
                glColor3ub(128,0,0)
                glVertex3f(0, 0, 0)
                glVertex3f(sx, 0, 0)
-               glColor3ub(128,128,0)
+               glColor3ub(0,128,0)
                glVertex3f(0, 0, 0)
                glVertex3f(0, sy, 0)
-               glColor3ub(0,128,0)
+               glColor3ub(0,0,128)
                glVertex3f(0, 0, 0)
                glVertex3f(0, 0, sz)
                glEnd()
@@ -445,9 +447,9 @@ class toolScale(object):
                        opengl.glDrawStringCenter("%0.2f" % (scaleX))
                glPopMatrix()
                if self.node == 3:
-                       glColor3ub(255,255,0)
+                       glColor3ub(64,255,64)
                else:
-                       glColor3ub(128,128,0)
+                       glColor3ub(0,128,0)
                glPushMatrix()
                glTranslatef(0,sy,0)
                opengl.DrawBox([-s,-s,-s], [s,s,s])
@@ -456,9 +458,9 @@ class toolScale(object):
                        opengl.glDrawStringCenter("%0.2f" % (scaleY))
                glPopMatrix()
                if self.node == 4:
-                       glColor3ub(64,255,64)
+                       glColor3ub(64,64,255)
                else:
-                       glColor3ub(0,128,0)
+                       glColor3ub(0,0,128)
                glPushMatrix()
                glTranslatef(0,0,sz)
                opengl.DrawBox([-s,-s,-s], [s,s,s])