Commit 2213dea9 authored by Luke Campagnola's avatar Luke Campagnola
Browse files

Bugfixes

- AxisItem.setScale(1) works properly to disable auto-value-scaling
- OpenGL fixes (stack overflow when drawing items, improper call to glPopAttrib)
parent 662b319d
......@@ -205,16 +205,14 @@ class AxisItem(GraphicsWidget):
def setScale(self, scale=None):
"""
Set the value scaling for this axis.
The scaling value 1) multiplies the values displayed along the axis
and 2) changes the way units are displayed in the label.
Set the value scaling for this axis. Values on the axis are multiplied
by this scale factor before being displayed as text. By default,
this scaling value is automatically determined based on the visible range
and the axis units are updated to reflect the chosen scale factor.
For example: If the axis spans values from -0.1 to 0.1 and has units set
to 'V' then a scale of 1000 would cause the axis to display values -100 to 100
and the units would appear as 'mV'
If scale is None, then it will be determined automatically based on the current
range displayed by the axis.
"""
if scale is None:
#if self.drawLabel: ## If there is a label, then we are free to rescale the values
......@@ -228,8 +226,10 @@ class AxisItem(GraphicsWidget):
self.setLabel(unitPrefix=prefix)
else:
scale = 1.0
else:
self.setLabel(unitPrefix='')
self.autoScale = False
if scale != self.scale:
self.scale = scale
self.setLabel()
......
......@@ -116,16 +116,18 @@ class GLViewWidget(QtOpenGL.QGLWidget):
print(msg)
finally:
glPopAttrib(GL_ALL_ATTRIB_BITS)
glPopAttrib()
else:
glMatrixMode(GL_MODELVIEW)
glPushMatrix()
tr = i.transform()
a = np.array(tr.copyDataTo()).reshape((4,4))
glMultMatrixf(a.transpose())
self.drawItemTree(i)
glMatrixMode(GL_MODELVIEW)
glPopMatrix()
try:
tr = i.transform()
a = np.array(tr.copyDataTo()).reshape((4,4))
glMultMatrixf(a.transpose())
self.drawItemTree(i)
finally:
glMatrixMode(GL_MODELVIEW)
glPopMatrix()
def cameraPosition(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment