Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Benjamin Jakimow
EO Time Series Viewer
Commits
fd6cc955
Commit
fd6cc955
authored
Mar 16, 2014
by
Luke Campagnola
Browse files
Fixed GLGridItem.setSize, added setSpacing
parent
5f7e4dc6
Changes
2
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
fd6cc955
...
...
@@ -76,6 +76,7 @@ pyqtgraph-0.9.9 [unreleased]
- Allow images with NaN in ImageView
- MeshData can generate edges from face-indexed vertexes
- Fixed multiprocess deadlocks on windows
- Fixed GLGridItem.setSize
pyqtgraph-0.9.8 2013-11-24
...
...
pyqtgraph/opengl/items/GLGridItem.py
View file @
fd6cc955
import
numpy
as
np
from
OpenGL.GL
import
*
from
..
GLGraphicsItem
import
GLGraphicsItem
from
...
import
QtGui
...
...
@@ -16,8 +18,9 @@ class GLGridItem(GLGraphicsItem):
self
.
setGLOptions
(
glOptions
)
self
.
antialias
=
antialias
if
size
is
None
:
size
=
QtGui
.
QVector3D
(
1
,
1
,
1
)
size
=
QtGui
.
QVector3D
(
20
,
20
,
1
)
self
.
setSize
(
size
=
size
)
self
.
setSpacing
(
1
,
1
,
1
)
def
setSize
(
self
,
x
=
None
,
y
=
None
,
z
=
None
,
size
=
None
):
"""
...
...
@@ -33,8 +36,22 @@ class GLGridItem(GLGraphicsItem):
def
size
(
self
):
return
self
.
__size
[:]
def
setSpacing
(
self
,
x
=
None
,
y
=
None
,
z
=
None
,
spacing
=
None
):
"""
Set the spacing between grid lines.
Arguments can be x,y,z or spacing=QVector3D().
"""
if
spacing
is
not
None
:
x
=
spacing
.
x
()
y
=
spacing
.
y
()
z
=
spacing
.
z
()
self
.
__spacing
=
[
x
,
y
,
z
]
self
.
update
()
def
spacing
(
self
):
return
self
.
__spacing
[:]
def
paint
(
self
):
self
.
setupGLState
()
...
...
@@ -47,12 +64,15 @@ class GLGridItem(GLGraphicsItem):
glBegin
(
GL_LINES
)
x
,
y
,
z
=
self
.
size
()
xs
,
ys
,
zs
=
self
.
spacing
()
xvals
=
np
.
arange
(
-
x
/
2.
,
x
/
2.
+
xs
*
0.001
,
xs
)
yvals
=
np
.
arange
(
-
y
/
2.
,
y
/
2.
+
ys
*
0.001
,
ys
)
glColor4f
(
1
,
1
,
1
,
.
3
)
for
x
in
range
(
-
10
,
11
)
:
glVertex3f
(
x
,
-
10
,
0
)
glVertex3f
(
x
,
10
,
0
)
for
y
in
range
(
-
10
,
11
)
:
glVertex3f
(
-
10
,
y
,
0
)
glVertex3f
(
10
,
y
,
0
)
for
x
in
xvals
:
glVertex3f
(
x
,
yvals
[
0
]
,
0
)
glVertex3f
(
x
,
yvals
[
-
1
]
,
0
)
for
y
in
yvals
:
glVertex3f
(
xvals
[
0
]
,
y
,
0
)
glVertex3f
(
xvals
[
-
1
]
,
y
,
0
)
glEnd
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment