diff options
author | Tom Rondeau | 2009-09-16 10:03:29 -0400 |
---|---|---|
committer | Tom Rondeau | 2009-09-16 10:03:29 -0400 |
commit | 70b35690d96a1af9799ddf43ab9bd69abca448a1 (patch) | |
tree | b08b262f81ed5520013011b736e8c933978a7820 | |
parent | e4c161f16aecd82f3cfc0a8aff4e1d16afaa2791 (diff) | |
download | gnuradio-70b35690d96a1af9799ddf43ab9bd69abca448a1.tar.gz gnuradio-70b35690d96a1af9799ddf43ab9bd69abca448a1.tar.bz2 gnuradio-70b35690d96a1af9799ddf43ab9bd69abca448a1.zip |
Handling a few exceptions when no file is loaded.
-rwxr-xr-x | gr-utils/src/python/gr_plot_qt.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/gr-utils/src/python/gr_plot_qt.py b/gr-utils/src/python/gr_plot_qt.py index 267737fd0..581dc6d33 100755 --- a/gr-utils/src/python/gr_plot_qt.py +++ b/gr-utils/src/python/gr_plot_qt.py @@ -64,9 +64,12 @@ class SpectrogramData(Qwt.QwtRasterData): return Qwt.QwtDoubleInterval(self.sp.min(), self.sp.max()) def value(self, x, y): - f = int(self.freq.searchsorted(x)) - t = int(self.time.searchsorted(y)) - return self.sp[f][t-1] + try: + f = int(self.freq.searchsorted(x)) + t = int(self.time.searchsorted(y)) + return self.sp[f][t-1] + except AttributeError: # if no file loaded yet + return 0 class gr_plot_qt(QtGui.QMainWindow): @@ -451,7 +454,11 @@ class gr_plot_qt(QtGui.QMainWindow): # If there's a non-digit character, reset box else: - self.set_file_pos_box(self.cur_start, self.cur_stop) + try: + self.set_file_pos_box(self.cur_start, self.cur_stop) + except AttributeError: + pass + def file_time_changed(self): tstart = self.gui.fileTimeStartLineEdit.text().toDouble() |