Catch OverflowError from Point.length()

This commit is contained in:
Luke Campagnola 2013-11-25 01:16:21 -05:00
parent cff168b9f0
commit 4486272737
3 changed files with 24 additions and 6 deletions

View File

@ -162,8 +162,14 @@ class PlotCurveItem(GraphicsObject):
if pxPad > 0: if pxPad > 0:
# determine length of pixel in local x, y directions # determine length of pixel in local x, y directions
px, py = self.pixelVectors() px, py = self.pixelVectors()
px = 0 if px is None else px.length() try:
py = 0 if py is None else py.length() px = 0 if px is None else px.length()
except OverflowError:
px = 0
try:
py = 0 if py is None else py.length()
except OverflowError:
py = 0
# return bounds expanded by pixel size # return bounds expanded by pixel size
px *= pxPad px *= pxPad

View File

@ -664,7 +664,10 @@ class ROI(GraphicsObject):
if not self.rotateAllowed: if not self.rotateAllowed:
return return
## If the handle is directly over its center point, we can't compute an angle. ## If the handle is directly over its center point, we can't compute an angle.
if lp1.length() == 0 or lp0.length() == 0: try:
if lp1.length() == 0 or lp0.length() == 0:
return
except OverflowError:
return return
## determine new rotation angle, constrained if necessary ## determine new rotation angle, constrained if necessary
@ -704,7 +707,10 @@ class ROI(GraphicsObject):
else: else:
scaleAxis = 0 scaleAxis = 0
if lp1.length() == 0 or lp0.length() == 0: try:
if lp1.length() == 0 or lp0.length() == 0:
return
except OverflowError:
return return
ang = newState['angle'] - lp0.angle(lp1) ang = newState['angle'] - lp0.angle(lp1)

View File

@ -652,8 +652,14 @@ class ScatterPlotItem(GraphicsObject):
if pxPad > 0: if pxPad > 0:
# determine length of pixel in local x, y directions # determine length of pixel in local x, y directions
px, py = self.pixelVectors() px, py = self.pixelVectors()
px = 0 if px is None else px.length() try:
py = 0 if py is None else py.length() px = 0 if px is None else px.length()
except OverflowError:
px = 0
try:
py = 0 if py is None else py.length()
except OverflowError:
py = 0
# return bounds expanded by pixel size # return bounds expanded by pixel size
px *= pxPad px *= pxPad