From 15fd82f73ab0c89bba823d89eb042ad5a1fa0e3e Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 10 Aug 2010 08:33:32 -0400 Subject: [PATCH] Allow None values for plot clicks or SI values --- hooke/ui/gui/panel/plot.py | 2 ++ hooke/util/si.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hooke/ui/gui/panel/plot.py b/hooke/ui/gui/panel/plot.py index 66cc64d..602ee65 100644 --- a/hooke/ui/gui/panel/plot.py +++ b/hooke/ui/gui/panel/plot.py @@ -189,6 +189,8 @@ class PlotPanel (Panel, wx.Panel): return d = self._config.get('plot decimals', 2) x,y = (event.xdata, event.ydata) + if None in [x, y]: + return xt = ppSI(value=x, unit=self._x_unit, decimals=d) yt = ppSI(value=y, unit=self._y_unit, decimals=d) point_indexes = [] diff --git a/hooke/util/si.py b/hooke/util/si.py index 48fe4e0..ac3e633 100644 --- a/hooke/util/si.py +++ b/hooke/util/si.py @@ -111,7 +111,7 @@ def ppSI(value, unit='', decimals=None, power=None, pad=False): """ if value == 0: return '0' - if isnan(value): + if value == None or isnan(value): return 'NaN' if power == None: # auto-detect power -- 2.26.2