summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/python
diff options
context:
space:
mode:
authorTom Rondeau <tom@trondeau.com>2015-02-22 11:57:01 -0500
committerTom Rondeau <tom@trondeau.com>2015-04-02 15:38:56 -0700
commit490fe7fb527f629f6ba8fb804f33a51822e3b8ae (patch)
treeae50be2134d7fb3c2294ebedd17f248c63d2f865 /gnuradio-runtime/python
parentf2e8dd82b5436a344dadc0faeb1f3aaec18e0e09 (diff)
controlport: cleanup and switching over to new Python common interface.
Diffstat (limited to 'gnuradio-runtime/python')
-rw-r--r--gnuradio-runtime/python/gnuradio/ctrlport/CMakeLists.txt26
-rw-r--r--gnuradio-runtime/python/gnuradio/ctrlport/GNURadioControlPortClient.py58
-rw-r--r--gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py6
-rw-r--r--[-rwxr-xr-x]gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx132
4 files changed, 123 insertions, 99 deletions
diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/CMakeLists.txt b/gnuradio-runtime/python/gnuradio/ctrlport/CMakeLists.txt
index 69a61076dc..225f3b004e 100644
--- a/gnuradio-runtime/python/gnuradio/ctrlport/CMakeLists.txt
+++ b/gnuradio-runtime/python/gnuradio/ctrlport/CMakeLists.txt
@@ -20,16 +20,6 @@
########################################################################
include(GrPython)
-if(THRIFT_FOUND)
-
-EXECUTE_PROCESS(
- COMMAND ${THRIFT_BIN} --gen py -out ${CMAKE_CURRENT_BINARY_DIR}/ ${CMAKE_SOURCE_DIR}/gnuradio-runtime/lib/controlport/thrift/gnuradio.thrift
- OUTPUT_VARIABLE THRIFT_PY_OUTPUT
- ERROR_VARIABLE THRIFT_PY_ERROR
- )
-
-endif(THRIFT_FOUND)
-
install(
FILES
${CMAKE_CURRENT_SOURCE_DIR}/icon.png
@@ -37,12 +27,13 @@ install(
COMPONENT "runtime_python"
)
+
GR_PYTHON_INSTALL(
FILES
${CMAKE_CURRENT_SOURCE_DIR}/__init__.py
${CMAKE_CURRENT_SOURCE_DIR}/GrDataPlotter.py
${CMAKE_CURRENT_SOURCE_DIR}/monitor.py
- ${CMAKE_CURRENT_SOURCE_DIR}/ThriftRadioClient.py
+ ${CMAKE_CURRENT_SOURCE_DIR}/GNURadioControlPortClient.py
DESTINATION ${GR_PYTHON_DIR}/gnuradio/ctrlport/
COMPONENT "runtime_python"
)
@@ -50,14 +41,23 @@ GR_PYTHON_INSTALL(
GR_PYTHON_INSTALL(
FILES
${CMAKE_CURRENT_SOURCE_DIR}/gr-perf-monitorx
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr-ctrlport-monitor
DESTINATION ${GR_RUNTIME_DIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
COMPONENT "runtime_python"
)
-# Install the files compiled from gnuradio.thrift
+if(THRIFT_FOUND)
+
+EXECUTE_PROCESS(
+ COMMAND ${THRIFT_BIN} --gen py -out ${CMAKE_CURRENT_BINARY_DIR}/ ${CMAKE_SOURCE_DIR}/gnuradio-runtime/lib/controlport/thrift/gnuradio.thrift
+ OUTPUT_VARIABLE THRIFT_PY_OUTPUT
+ ERROR_VARIABLE THRIFT_PY_ERROR
+ )
+
GR_PYTHON_INSTALL(
FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/ThriftRadioClient.py
${CMAKE_CURRENT_BINARY_DIR}/GNURadio/__init__.py
${CMAKE_CURRENT_BINARY_DIR}/GNURadio/constants.py
${CMAKE_CURRENT_BINARY_DIR}/GNURadio/ControlPort.py
@@ -68,3 +68,5 @@ GR_PYTHON_INSTALL(
DESTINATION ${GR_PYTHON_DIR}/gnuradio/ctrlport/GNURadio
COMPONENT "runtime_python"
)
+
+endif(THRIFT_FOUND)
diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/GNURadioControlPortClient.py b/gnuradio-runtime/python/gnuradio/ctrlport/GNURadioControlPortClient.py
index 3cf5186594..b9d0e40972 100644
--- a/gnuradio-runtime/python/gnuradio/ctrlport/GNURadioControlPortClient.py
+++ b/gnuradio-runtime/python/gnuradio/ctrlport/GNURadioControlPortClient.py
@@ -128,6 +128,8 @@ Args:
host: hostname of the connection
"""
+from gnuradio.ctrlport.GNURadio.ttypes import BaseTypes
+
class RPCConnectionThrift(RPCConnection):
def __init__(self, host=None, port=None):
if port is None: port = 9090
@@ -148,29 +150,51 @@ class RPCConnectionThrift(RPCConnection):
result = {}
for key, knob in self.thriftclient.radio.getKnobs(*args).iteritems():
- if knob.type == 0: result[key] = Knob(key, knob.value.a_bool)
- elif knob.type == 1: result[key] = Knob(key, knob.value.a_byte)
- elif knob.type == 2: result[key] = Knob(key, knob.value.a_short)
- elif knob.type == 3: result[key] = Knob(key, knob.value.a_int)
- elif knob.type == 4: result[key] = Knob(key, knob.value.a_long)
- elif knob.type == 5: result[key] = Knob(key, knob.value.a_double)
- elif knob.type == 6: result[key] = Knob(key, knob.value.a_string)
- elif knob.type == 7: result[key] = Knob(key, knob.value.a_complex)
- elif knob.type == 8: result[key] = Knob(key, knob.value.a_f32vector)
- elif knob.type == 9: result[key] = Knob(key, knob.value.a_f64vector)
- elif knob.type == 10: result[key] = Knob(key, knob.value.a_s64vector)
- elif knob.type == 11: result[key] = Knob(key, knob.value.a_s32vector)
- elif knob.type == 12: result[key] = Knob(key, knob.value.a_s16vector)
- elif knob.type == 13: result[key] = Knob(key, knob.value.a_s8vector)
- elif knob.type == 14: result[key] = Knob(key, knob.value.a_s32vector)
- elif knob.type == 15: result[key] = Knob(key, knob.value.byte)
+ if knob.type == BaseTypes.BOOL: result[key] = Knob(key, knob.value.a_bool)
+ elif knob.type == BaseTypes.BYTE: result[key] = Knob(key, knob.value.a_byte)
+ elif knob.type == BaseTypes.SHORT: result[key] = Knob(key, knob.value.a_short)
+ elif knob.type == BaseTypes.INT: result[key] = Knob(key, knob.value.a_int)
+ elif knob.type == BaseTypes.LONG: result[key] = Knob(key, knob.value.a_long)
+ elif knob.type == BaseTypes.DOUBLE: result[key] = Knob(key, knob.value.a_double)
+ elif knob.type == BaseTypes.STRING: result[key] = Knob(key, knob.value.a_string)
+ elif knob.type == BaseTypes.COMPLEX: result[key] = Knob(key, knob.value.a_complex)
+ elif knob.type == BaseTypes.F32VECTOR: result[key] = Knob(key, knob.value.a_f32vector)
+ elif knob.type == BaseTypes.F64VECTOR: result[key] = Knob(key, knob.value.a_f64vector)
+ elif knob.type == BaseTypes.S64VECTOR: result[key] = Knob(key, knob.value.a_s64vector)
+ elif knob.type == BaseTypes.S32VECTOR: result[key] = Knob(key, knob.value.a_s32vector)
+ elif knob.type == BaseTypes.S16VECTOR: result[key] = Knob(key, knob.value.a_s16vector)
+ elif knob.type == BaseTypes.S8VECTOR: result[key] = Knob(key, knob.value.a_s8vector)
+ elif knob.type == BaseTypes.C32VECTOR: result[key] = Knob(key, knob.value.a_c32vector)
else:
raise exceptions.ValueError
return result
def getRe(self,*args):
- return self.thriftclient.radio.getRe(*args)
+ class Knob():
+ def __init__(self, key, value):
+ (self.key, self.value) = (key, value)
+
+ result = {}
+ for key, knob in self.thriftclient.radio.getRe(*args).iteritems():
+ if knob.type == BaseTypes.BOOL: result[key] = Knob(key, knob.value.a_bool)
+ elif knob.type == BaseTypes.BYTE: result[key] = Knob(key, knob.value.a_byte)
+ elif knob.type == BaseTypes.SHORT: result[key] = Knob(key, knob.value.a_short)
+ elif knob.type == BaseTypes.INT: result[key] = Knob(key, knob.value.a_int)
+ elif knob.type == BaseTypes.LONG: result[key] = Knob(key, knob.value.a_long)
+ elif knob.type == BaseTypes.DOUBLE: result[key] = Knob(key, knob.value.a_double)
+ elif knob.type == BaseTypes.STRING: result[key] = Knob(key, knob.value.a_string)
+ elif knob.type == BaseTypes.COMPLEX: result[key] = Knob(key, knob.value.a_complex)
+ elif knob.type == BaseTypes.F32VECTOR: result[key] = Knob(key, knob.value.a_f32vector)
+ elif knob.type == BaseTypes.F64VECTOR: result[key] = Knob(key, knob.value.a_f64vector)
+ elif knob.type == BaseTypes.S64VECTOR: result[key] = Knob(key, knob.value.a_s64vector)
+ elif knob.type == BaseTypes.S32VECTOR: result[key] = Knob(key, knob.value.a_s32vector)
+ elif knob.type == BaseTypes.S16VECTOR: result[key] = Knob(key, knob.value.a_s16vector)
+ elif knob.type == BaseTypes.S8VECTOR: result[key] = Knob(key, knob.value.a_s8vector)
+ elif knob.type == BaseTypes.C32VECTOR: result[key] = Knob(key, knob.value.a_c32vector)
+ else:
+ raise exceptions.ValueError
+ return result
def setKnobs(self,*args):
self.thriftclient.radio.setKnobs(*args)
diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py b/gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py
index 661705d613..243cc822f7 100644
--- a/gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py
+++ b/gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py
@@ -442,7 +442,8 @@ class GrDataPlotterValueTable:
units = str(knobprops[itemKey].units)
descr = str(knobprops[itemKey].description)
- if(type(v) == GNURadio.complex):
+ # TODO: FIX COMPLEX
+ if False: #if(type(v) == GNURadio.complex):
v = v.re + v.im*1j
# If it's a byte stream, Python thinks it's a string.
# Unpack and convert to floats for plotting.
@@ -468,7 +469,8 @@ class GrDataPlotterValueTable:
for k in knobs.keys():
if k not in foundKeys:
v = knobs[k].value
- if(type(v) == GNURadio.complex):
+ # TODO: Fix Handle of Complex
+ if False: #if(type(v) == GNURadio.complex):
v = v.re + v.im*1j
# If it's a byte stream, Python thinks it's a string.
# Unpack and convert to floats for plotting.
diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx b/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx
index 038d24fd93..c39df034ea 100755..100644
--- a/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx
+++ b/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx
@@ -21,7 +21,7 @@
#
import random,math,operator
-import networkx as nx;
+import networkx as nx
import matplotlib
matplotlib.use("Qt4Agg");
import matplotlib.pyplot as plt
@@ -39,19 +39,19 @@ import itertools
from gnuradio.ctrlport.GrDataPlotter import *
#from gnuradio.ctrlport import GNURadio
-from gnuradio.ctrlport.ThriftRadioClient import ThriftRadioClient
+
class MAINWindow(QtGui.QMainWindow):
def minimumSizeHint(self):
return QtGui.QSize(800,600)
- def __init__(self, radio, port, interface):
+ def __init__(self, radioclient):
super(MAINWindow, self).__init__()
+ self.radioclient = radioclient
self.conns = []
self.plots = []
self.knobprops = []
- self.interface = interface
self.mdiArea = QtGui.QMdiArea()
self.mdiArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
@@ -71,7 +71,8 @@ class MAINWindow(QtGui.QMainWindow):
self.setWindowTitle("GNU Radio Performance Monitor")
self.setUnifiedTitleAndToolBarOnMac(True)
- self.newCon(radio, port)
+ self.newCon(radioclient)
+
icon = QtGui.QIcon(ctrlport.__path__[0] + "/icon.png" )
self.setWindowIcon(icon)
@@ -83,16 +84,10 @@ class MAINWindow(QtGui.QMainWindow):
child.show();
self.mdiArea.currentSubWindow().showMaximized()
-
- def newCon(self, radio=None, port=None):
- child = MForm(radio, port, len(self.conns), self)
- if(child.radio is not None):
- child.setWindowTitle(str(child.radio))
-# horizbar = QtGui.QScrollArea()
-# horizbar.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
-# horizbar.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
-# horizbar.setWidget(child)
-# self.mdiArea.addSubWindow(horizbar)
+ def newCon(self, csomeBool):
+ child = MForm(self.radioclient, len(self.conns), self, prompt= not csomeBool)
+ if(child.radioclient is not None):
+ child.setWindowTitle(str(child.radioclient))
self.mdiArea.addSubWindow(child)
self.mdiArea.currentSubWindow().showMaximized()
@@ -226,7 +221,7 @@ GNU Radio is free software; you can redistribute it and/or modify it under the t
GNU Radio is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n
You should have received a copy of the GNU General Public License along with GNU Radio; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Boston, MA 02110-1301, USA.'''
- QtGui.QMessageBox.about(None, "gr-ctrlport-monitor", about_info)
+ QtGui.QMessageBox.about(None, "gr-perf-monitorx", about_info)
class ConInfoDialog(QtGui.QDialog):
@@ -263,7 +258,7 @@ class DataTable(QtGui.QWidget):
def update(self):
print "update"
- def __init__(self, radio, G):
+ def __init__(self, radioclient, G):
QtGui.QWidget.__init__( self)
self.layout = QtGui.QVBoxLayout(self);
@@ -271,7 +266,7 @@ class DataTable(QtGui.QWidget):
self.layout.addLayout(self.hlayout);
self.G = G;
- self.radio = radio;
+ self.radioclient = radioclient;
self._keymap = None
@@ -346,8 +341,8 @@ class DataTable(QtGui.QWidget):
self._sort = state > 0
class DataTableBuffers(DataTable):
- def __init__(self, radio, G):
- DataTable.__init__(self,radio,G)
+ def __init__(self, radioclient, G):
+ DataTable.__init__(self,radioclient,G)
self.perfTable.setHorizontalHeaderLabels( ["Block Name", "Percent Buffer Full"] );
def update(self):
@@ -357,7 +352,7 @@ class DataTableBuffers(DataTable):
kl = map(lambda x: "%s::%soutput %% full" % \
(x, self._statistics_table[self._statistic]),
nodes);
- buf_knobs = self.radio.getKnobs(kl)
+ buf_knobs = self.radioclient.getKnobs(kl)
# strip values out of ctrlport response
buffer_fullness = dict(zip(
@@ -366,7 +361,7 @@ class DataTableBuffers(DataTable):
blockport_fullness = {}
for blk in buffer_fullness:
- bdata = buffer_fullness[blk].a_f32vector
+ bdata = buffer_fullness[blk]
for port in range(0,len(bdata)):
blockport_fullness["%s:%d"%(blk,port)] = bdata[port];
@@ -396,8 +391,8 @@ class DataTableBuffers(DataTable):
self.canvas.show();
class DataTableRuntimes(DataTable):
- def __init__(self, radio, G):
- DataTable.__init__(self,radio,G)
+ def __init__(self, radioclient, G):
+ DataTable.__init__(self,radioclient,G)
#self.perfTable.setRowCount(len( self.G.nodes() ))
def update(self):
@@ -407,15 +402,15 @@ class DataTableRuntimes(DataTable):
kl = map(lambda x: "%s::%swork time" % \
(x, self._statistics_table[self._statistic]),
nodes);
- wrk_knobs = self.radio.getKnobs(kl)
+ wrk_knobs = self.radioclient.getKnobs(kl)
# strip values out of ctrlport response
- total_work = sum(map(lambda x: x.value.a_double, wrk_knobs.values()))
+ total_work = sum(map(lambda x: x.value, wrk_knobs.values()))
if(total_work == 0):
total_work = 1
work_times = dict(zip(
map(lambda x: x.split("::")[0], wrk_knobs.keys()),
- map(lambda x: x.value.a_double/total_work, wrk_knobs.values())))
+ map(lambda x: x.value/total_work, wrk_knobs.values())))
# update table view
self.table_update(work_times)
@@ -452,11 +447,11 @@ class MForm(QtGui.QWidget):
self.prevent_clock_change = True;
kl1 = None;
if(self.clockKey == None):
- kl1 = self.radio.getRe([".*perfcounter_clock"])
+ kl1 = self.radioclient.getRe([".*perfcounter_clock"])
else:
- kl1 = self.radio.getKnobs([self.clockKey])
+ kl1 = self.radioclient.getKnobs([self.clockKey])
self.clockKey = kl1.keys()[0]
- self.currClock = kl1[self.clockKey].value.a_long
+ self.currClock = kl1[self.clockKey].value
self.clockSelIdx = self.clocks.values().index(self.currClock)
self.clockSel.setCurrentIndex(self.clockSelIdx)
self.prevent_clock_change = False
@@ -472,29 +467,29 @@ class MForm(QtGui.QWidget):
nodes_stream);
st = time.time()
- buf_knobs = self.radio.getKnobs(kl)
+ buf_knobs = self.radioclient.getKnobs(kl)
td1 = time.time() - st;
# strip values out of ctrlport response
buf_vals = dict(zip(
map(lambda x: x.split("::")[0], buf_knobs.keys()),
- map(lambda x: x.value, buf_knobs.values())))
+ map(lambda x: x, buf_knobs.values())))
# get work time for all blocks
kl = map(lambda x: "%s::%swork time" % \
(x, self._statistics_table[self._statistic]),
nodes_stream);
st = time.time()
- wrk_knobs = self.radio.getKnobs(kl)
+ wrk_knobs = self.radioclient.getKnobs(kl)
td2 = time.time() - st;
# strip values out of ctrlport response
- total_work = sum(map(lambda x: x.value.a_double, wrk_knobs.values()))
+ total_work = sum(map(lambda x: x.value, wrk_knobs.values()))
if(total_work == 0):
total_work = 1
work_times = dict(zip(
map(lambda x: x.split("::")[0], wrk_knobs.keys()),
- map(lambda x: x.value.a_double/total_work, wrk_knobs.values())))
+ map(lambda x: x.value/total_work, wrk_knobs.values())))
work_times_padded = dict(zip(
self.G.nodes(),
[0.1]*len(self.G.nodes())))
@@ -508,8 +503,7 @@ class MForm(QtGui.QWidget):
# get the right output buffer/port weight for each edge
sourceport = e[2]["sourceport"];
if(e[2]["type"] == "stream"):
- #newweight = buf_vals[n][sourceport]
- newweight = buf_vals[n].a_f32vector[0]
+ newweight = buf_vals[n].value[sourceport]
e[2]["weight"] = newweight;
for n in nodes_msg:
@@ -534,7 +528,7 @@ class MForm(QtGui.QWidget):
(latency*1000))
except Exception, e:
- sys.stderr.write("ctrlport-monitor: radio.getKnobs threw exception ({0}).\n".format(e))
+ sys.stderr.write("gr-perf-monitorx: radio.getKnobs threw exception ({0}).\n".format(e))
if(type(self.parent) is MAINWindow):
# Find window of connection
remove = []
@@ -553,10 +547,10 @@ class MForm(QtGui.QWidget):
return
def rtt(self):
- self.parent.newSubWindow( DataTableRuntimes(self.radio, self.G_stream), "Runtime Table" );
+ self.parent.newSubWindow( DataTableRuntimes(self.radioclient, self.G_stream), "Runtime Table" );
def bpt(self):
- self.parent.newSubWindow( DataTableBuffers(self.radio, self.G_stream), "Buffers Table" );
+ self.parent.newSubWindow( DataTableBuffers(self.radioclient, self.G_stream), "Buffers Table" );
def resetPCs(self):
knob = GNURadio.ttypes.KnobBase()
@@ -564,7 +558,7 @@ class MForm(QtGui.QWidget):
km = {}
for b in self.blocks_list:
km[b + "::reset_perf_counters"] = knob
- k = self.radio.setKnobs(km)
+ k = self.radioclient.setKnobs(km)
def toggleFlowgraph(self):
if self.pauseFGAct.isChecked():
@@ -578,14 +572,14 @@ class MForm(QtGui.QWidget):
km = {}
km[self.top_block + "::lock"] = knob
km[self.top_block + "::stop"] = knob
- k = self.radio.setKnobs(km)
+ k = self.radioclient.setKnobs(km)
def unpauseFlowgraph(self):
knob = GNURadio.ttypes.KnobBase()
knob.a_bool = False
km = {}
km[self.top_block + "::unlock"] = knob
- k = self.radio.setKnobs(km)
+ k = self.radioclient.setKnobs(km)
def stat_changed(self, index):
self._statistic = str(self.stattype.currentText())
@@ -596,27 +590,34 @@ class MForm(QtGui.QWidget):
idx = self.clockSel.currentIndex();
clk = self.clocks.values()[idx]
# print "UPDATE CLOCK!!! %d -> %d"%(idx,clk);
- k = self.radio.getKnobs([self.clockKey]);
+ k = self.radioclient.getKnobs([self.clockKey]);
k[self.clockKey].value = clk;
km = {};
km[self.clockKey] = k[self.clockKey];
- self.radio.setKnobs(km);
+ self.radioclient.setKnobs(km);
- def __init__(self, radio=None, port=None, uid=0, parent=None):
+ def __init__(self, radioclient, uid=0, parent=None, prompt = False):
super(MForm, self).__init__()
-
- if(radio == None or port == None):
+ self.radioclient = radioclient
+# print("before radioclient.getHost()", radioclient.getHost(), radioclient.getPort(), "prompt", prompt)
+ if(prompt or radioclient.getHost() is None or radioclient.getPort() is None):
+# print("before ConInfoDialog")
askinfo = ConInfoDialog(self);
if askinfo.exec_():
host = str(askinfo.host.text());
port = str(askinfo.port.text());
- radio = parent.interface.getRadio(host, port)
+# print("before radioclient.newConnection host: %s port: %s"%(host,port))
+ newradio = self.radioclient.newConnection(host, port)
+ if newradio is None:
+ print("Error making a %s connection to %s:%s from %s" % (radioclient.getName(), host, port, radioclient))
+ else:
+ self.radioclient = newradio
+
else:
- self.radio = None
+ self.radioclient = None
return
-
self.uid = uid
self.parent = parent
@@ -677,7 +678,7 @@ class MForm(QtGui.QWidget):
# self.setLayout(self.layout);
- self.radio = radio.radio
+ self.radio = radioclient
self.knobprops = self.radio.properties([])
self.parent.knobprops.append(self.knobprops)
@@ -720,8 +721,8 @@ class MForm(QtGui.QWidget):
sys.exit(1)
self.blocks_list = tmplist
- edges = edgelist.a_string.split("\n")[0:-1]
- msgedges = msgedgelist.a_string.split("\n")[0:-1]
+ edges = edgelist.split("\n")[0:-1]
+ msgedges = msgedgelist.split("\n")[0:-1]
edgepairs_stream = [];
edgepairs_msg = [];
@@ -819,7 +820,7 @@ class MForm(QtGui.QWidget):
index = self.table.treeWidget.selectedIndexes()
item = self.table.treeWidget.itemFromIndex(index[0])
itemname = str(item.text(0))
- self.parent.propertiesMenu(itemname, self.radio, self.uid)
+ self.parent.propertiesMenu(itemname, self.radioclient, self.uid)
def updateGraph(self):
@@ -844,18 +845,13 @@ class MForm(QtGui.QWidget):
self.canvas.draw();
self.canvas.show();
-#class MyClient(ThriftRadioClient):
-# def __init__(self):
-# ThriftRadioClient.__init__(self, MAINWindow)
-#
-#sys.exit(MyClient().main(sys.argv))
-app = QtGui.QApplication(sys.argv)
+class MyApp(object):
+ def __init__(self, args):
+ from gnuradio.ctrlport.GNURadioControlPortClient import GNURadioControlPortClient
+ GNURadioControlPortClient(args, 'thrift', self.run, QtGui.QApplication(sys.argv).exec_)
+
+ def run(self, client):
+ MAINWindow(client).show()
-host = "127.0.0.1"
-port = 9090
-iface = "lo"
-radio = ThriftRadioClient(host, port)
-mainwin = MAINWindow(radio, port, iface)
-mainwin.show()
-app.exec_()
+MyApp(sys.argv)