/usr/lib/python2.7/dist-packages/pyqtgraph/opengl/items/GLBoxItem.py is in python-pyqtgraph 0.9.10-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | from OpenGL.GL import *
from .. GLGraphicsItem import GLGraphicsItem
from ...Qt import QtGui
from ... import functions as fn
__all__ = ['GLBoxItem']
class GLBoxItem(GLGraphicsItem):
"""
**Bases:** :class:`GLGraphicsItem <pyqtgraph.opengl.GLGraphicsItem>`
Displays a wire-frame box.
"""
def __init__(self, size=None, color=None, glOptions='translucent'):
GLGraphicsItem.__init__(self)
if size is None:
size = QtGui.QVector3D(1,1,1)
self.setSize(size=size)
if color is None:
color = (255,255,255,80)
self.setColor(color)
self.setGLOptions(glOptions)
def setSize(self, x=None, y=None, z=None, size=None):
"""
Set the size of the box (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 setColor(self, *args):
"""Set the color of the box. Arguments are the same as those accepted by functions.mkColor()"""
self.__color = fn.Color(*args)
def color(self):
return self.__color
def paint(self):
#glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
#glEnable( GL_BLEND )
#glEnable( GL_ALPHA_TEST )
##glAlphaFunc( GL_ALWAYS,0.5 )
#glEnable( GL_POINT_SMOOTH )
#glDisable( GL_DEPTH_TEST )
self.setupGLState()
glBegin( GL_LINES )
glColor4f(*self.color().glColor())
x,y,z = self.size()
glVertex3f(0, 0, 0)
glVertex3f(0, 0, z)
glVertex3f(x, 0, 0)
glVertex3f(x, 0, z)
glVertex3f(0, y, 0)
glVertex3f(0, y, z)
glVertex3f(x, y, 0)
glVertex3f(x, y, z)
glVertex3f(0, 0, 0)
glVertex3f(0, y, 0)
glVertex3f(x, 0, 0)
glVertex3f(x, y, 0)
glVertex3f(0, 0, z)
glVertex3f(0, y, z)
glVertex3f(x, 0, z)
glVertex3f(x, y, z)
glVertex3f(0, 0, 0)
glVertex3f(x, 0, 0)
glVertex3f(0, y, 0)
glVertex3f(x, y, 0)
glVertex3f(0, 0, z)
glVertex3f(x, 0, z)
glVertex3f(0, y, z)
glVertex3f(x, y, z)
glEnd()
|