diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2008-12-16 19:26:17 -0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2008-12-28 12:08:17 -0200 |
commit | b6904a5ce63b4f7e9b7820cee983d1bb46cc01e4 (patch) | |
tree | 9ad89ae44daab75de51599349b5df104d31dd78c | |
parent | adf27d50f2c22db30203096380ce0f821a9f98f5 (diff) | |
download | tuna-b6904a5ce63b4f7e9b7820cee983d1bb46cc01e4.tar.gz |
oscilloscope: Ignore invalid samples, emitting just a warning
Reported-by: Maurizio Galli <maurizio.galli@inwind.it>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rwxr-xr-x | tuna/oscilloscope.py | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/tuna/oscilloscope.py b/tuna/oscilloscope.py index 6c1519e..ac9c515 100755 --- a/tuna/oscilloscope.py +++ b/tuna/oscilloscope.py @@ -280,24 +280,28 @@ class oscilloscope(gtk.Window): self.hist.refresh() def get_samples(self, fd, condition): - sample = self.get_sample() - prev_min, prev_avg, prev_max = self.min, self.avg, self.max - - self.add_sample(sample) - - if self.refreshing_screen: - if self.min != prev_min: - self.min_label.set_text("%-6.3f" % self.min) - if self.avg != prev_avg: - self.avg_label.set_text("%-6.3f" % self.avg) - if self.max != prev_max: - self.max_label.set_text("%-6.3f" % self.max) - - self.refresh() - - if self.snapshot_samples == self.scope.nr_samples: - self.snapshot() - gtk.main_quit() + try: + sample = self.get_sample() + prev_min, prev_avg, prev_max = self.min, self.avg, self.max + + self.add_sample(sample) + + if self.refreshing_screen: + if self.min != prev_min: + self.min_label.set_text("%-6.3f" % self.min) + if self.avg != prev_avg: + self.avg_label.set_text("%-6.3f" % self.avg) + if self.max != prev_max: + self.max_label.set_text("%-6.3f" % self.max) + + self.refresh() + + if self.snapshot_samples == self.scope.nr_samples: + self.snapshot() + gtk.main_quit() + except: + print "invalid sample, check the input format" + pass return self.getting_samples def run(self, fd): |