Fixed bugs / style issues to please Lord Travis Squashed commit of the following: commitf25048a1e1
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Sun Mar 30 02:40:47 2014 -0400 syntax commitcc8b69695a
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Sun Mar 30 02:36:49 2014 -0400 add size check, diff style check commit5d5ea065a4
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Sun Mar 30 02:16:05 2014 -0400 travis fix commitb154c6d997
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Sun Mar 30 02:09:41 2014 -0400 travis, flake colored output commit46921dcd87
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Wed Mar 26 12:37:54 2014 -0400 fix pyside+py3 bugs to satisfy CI commit1d30f3c5c7
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Wed Mar 26 11:13:18 2014 -0400 fix py3 tests commit426578fa4c
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Wed Mar 26 07:39:19 2014 -0400 fix pytest install commit88a13c1a71
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Wed Mar 26 00:29:29 2014 -0400 qt5 updates commit51995488cc
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Wed Mar 26 00:16:04 2014 -0400 correct py.test command for py3 commite2b02fbcbd
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Tue Mar 25 23:50:38 2014 -0400 fix 2nd install test commit4b3e3ee04a
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Tue Mar 25 23:31:31 2014 -0400 syntax error commit250eabdb34
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Tue Mar 25 23:13:42 2014 -0400 look for py.test3 commit9f9bca47c1
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Tue Mar 25 22:54:19 2014 -0400 fix syntax commit0a871c6f36
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Tue Mar 25 22:47:58 2014 -0400 output pip build log commitdbce58d8cd
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Tue Mar 25 22:38:55 2014 -0400 no comments allowed between shall lines commitb79c06121d
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Tue Mar 25 20:56:35 2014 -0400 another pip try commit09f4f5d82a
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Tue Mar 25 13:36:09 2014 -0400 pip correction commit0eedb5c18e
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Tue Mar 25 13:29:00 2014 -0400 correct py version output commitd9fd039be2
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Tue Mar 25 11:55:43 2014 -0400 apt checks commitcf95ccef86
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Tue Mar 25 10:23:10 2014 -0400 alternate pip install method commitbee0bcddfe
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Mon Mar 24 23:51:45 2014 -0400 correct deps install commit963a4211fc
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Mon Mar 24 23:47:30 2014 -0400 fixes commit0c86cd1dc2
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Mon Mar 24 23:31:06 2014 -0400 permission fix commit5d04ef53b8
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Mon Mar 24 23:30:19 2014 -0400 Fix py.test version selection commitb0e6c7cb94
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Mon Mar 24 23:25:34 2014 -0400 try another pyqt5 install method commit422a792866
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Mon Mar 24 23:12:36 2014 -0400 syntax error commit533133905a
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Mon Mar 24 23:04:37 2014 -0400 fixes commit8d65211ba4
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Mon Mar 24 22:40:18 2014 -0400 Add Qt5 test minor fixes commit4484efaefe
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Mon Mar 24 22:31:56 2014 -0400 use correct py.test for python version commit5d2441a29b
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Mon Mar 24 22:24:27 2014 -0400 add setup tests commit9291db64f2
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Mon Mar 24 21:48:43 2014 -0400 fix py3-pyqt install commita7aa675c5a
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Mon Mar 24 21:31:33 2014 -0400 travis tests commite71cd2b23a
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Mon Mar 24 21:17:15 2014 -0400 more corrections commit527df3bca8
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Mon Mar 24 20:56:01 2014 -0400 travis corrections commit87d65cac4a
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Mon Mar 24 20:48:02 2014 -0400 Add flake tests Correct style in a few files to please Lord Travis commit537028f88f
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Mon Mar 24 17:36:24 2014 -0400 minimize pyside package install correct line endings to satisfy Lord Travis commit1e3cc95e37
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Mon Mar 24 17:23:03 2014 -0400 enable pyside, line ending check fix test commitd7df4517f9
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Mon Mar 24 17:12:06 2014 -0400 syntax fix commit1ad77a2155
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Mon Mar 24 17:00:30 2014 -0400 alt. pytest install commit5edcc02072
Author: Luke Campagnola <luke.campagnola@gmail.com> Date: Mon Mar 24 16:52:33 2014 -0400 Added initial travis.yml
65 lines
1.8 KiB
Python
65 lines
1.8 KiB
Python
from OpenGL.GL import *
|
|
from .. GLGraphicsItem import GLGraphicsItem
|
|
from ... import QtGui
|
|
|
|
__all__ = ['GLAxisItem']
|
|
|
|
class GLAxisItem(GLGraphicsItem):
|
|
"""
|
|
**Bases:** :class:`GLGraphicsItem <pyqtgraph.opengl.GLGraphicsItem>`
|
|
|
|
Displays three lines indicating origin and orientation of local coordinate system.
|
|
|
|
"""
|
|
|
|
def __init__(self, size=None, antialias=True, glOptions='translucent'):
|
|
GLGraphicsItem.__init__(self)
|
|
if size is None:
|
|
size = QtGui.QVector3D(1,1,1)
|
|
self.antialias = antialias
|
|
self.setSize(size=size)
|
|
self.setGLOptions(glOptions)
|
|
|
|
def setSize(self, x=None, y=None, z=None, size=None):
|
|
"""
|
|
Set the size of the axes (in its local coordinate system; this does not affect the transform)
|
|
Arguments can be x,y,z or size=QVector3D().
|
|
"""
|
|
if size is not None:
|
|
x = size.x()
|
|
y = size.y()
|
|
z = size.z()
|
|
self.__size = [x,y,z]
|
|
self.update()
|
|
|
|
def size(self):
|
|
return self.__size[:]
|
|
|
|
|
|
def paint(self):
|
|
|
|
#glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
|
|
#glEnable( GL_BLEND )
|
|
#glEnable( GL_ALPHA_TEST )
|
|
self.setupGLState()
|
|
|
|
if self.antialias:
|
|
glEnable(GL_LINE_SMOOTH)
|
|
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST)
|
|
|
|
glBegin( GL_LINES )
|
|
|
|
x,y,z = self.size()
|
|
glColor4f(0, 1, 0, .6) # z is green
|
|
glVertex3f(0, 0, 0)
|
|
glVertex3f(0, 0, z)
|
|
|
|
glColor4f(1, 1, 0, .6) # y is yellow
|
|
glVertex3f(0, 0, 0)
|
|
glVertex3f(0, y, 0)
|
|
|
|
glColor4f(0, 0, 1, .6) # x is blue
|
|
glVertex3f(0, 0, 0)
|
|
glVertex3f(x, 0, 0)
|
|
glEnd()
|