summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py
diff options
context:
space:
mode:
authorTom Rondeau <trondeau@vt.edu>2013-07-16 14:55:28 -0700
committerJohnathan Corgan <johnathan@corganlabs.com>2013-07-16 15:03:10 -0700
commitaf206bb5fc1a255b48dbab344a2bba7581535cb0 (patch)
tree199adbce01307e132d2ab30184404ad2eb118a05 /gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py
parentf0198da0bbf6af214b0d629cb77b8539ac42e02a (diff)
controlport: Added probes for byte, short, and int data types
(ctrlport_probe2_x). Had to add some more plumbing to ControlPort to handle different data types to support the new probes. TODO: in 3.8, we will remove ctrlport_probe_c and make a single GRC file for all data types and remove blocks_ctrlport_probe2_c.xml.
Diffstat (limited to 'gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py')
-rw-r--r--gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py b/gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py
index b240dcb8f2..069f3d90ff 100644
--- a/gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py
+++ b/gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py
@@ -24,7 +24,7 @@ from gnuradio import gr
from gnuradio import blocks
from gnuradio import filter
from gnuradio.ctrlport import GNURadio
-import sys, time
+import sys, time, struct
try:
from gnuradio import qtgui
@@ -426,12 +426,17 @@ class GrDataPlotterValueTable:
numItems = self.treeWidget.topLevelItemCount()
# The input knobs variable is a dict of stats to display in the tree.
-
- # Update tree stat values with new values found in knobs.
- # Track found keys and track keys in tree that are not in input knobs.
- for i in range(0, numItems):
- item = self.treeWidget.topLevelItem(i)
-
+ self.treeWidget.clear()
+ for k, v in knobs.iteritems():
+ val = v.value
+ if(type(val) == GNURadio.complex):
+ val = val.re + val.im*1j
+
+ # If it's a byte stream, Python thinks it's a string.
+ # Unpack and convert to floats for plotting.
+ # Ignore the edge list knob if it's being exported
+ elif(type(val) == str and k.find('edge list') == -1):
+ val = struct.unpack(len(val)*'b', val)
# itemKey is the text in the first column of a QTreeWidgetItem
itemKey = str(item.text(0))
if itemKey in knobs.keys():