From d52c462e5fd3eae7d00505a64a013e811d43234c Mon Sep 17 00:00:00 2001 From: jcorgan Date: Sat, 23 Aug 2008 02:26:15 +0000 Subject: Merged changeset r9285:9377 from jblum/grc into trunk, with distcheck fixes and local modifications. Integrates previously separate GNU Radio Companion into top-level component 'grc'. (Josh Blum) git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9378 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/scripts/Makefile.am | 26 ++++++++++ grc/scripts/grc | 43 +++++++++++++++ grc/scripts/usrp_diagnostics | 121 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 190 insertions(+) create mode 100644 grc/scripts/Makefile.am create mode 100755 grc/scripts/grc create mode 100755 grc/scripts/usrp_diagnostics (limited to 'grc/scripts') diff --git a/grc/scripts/Makefile.am b/grc/scripts/Makefile.am new file mode 100644 index 000000000..be4ae1b8d --- /dev/null +++ b/grc/scripts/Makefile.am @@ -0,0 +1,26 @@ +# +# Copyright 2008 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# 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. +# +# 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. +# + +include $(top_srcdir)/Makefile.common + +EXTRA_DIST = $(bin_SCRIPTS) + +bin_SCRIPTS = grc usrp_diagnostics diff --git a/grc/scripts/grc b/grc/scripts/grc new file mode 100755 index 000000000..44d07a7ee --- /dev/null +++ b/grc/scripts/grc @@ -0,0 +1,43 @@ +#!/usr/bin/env python +""" +Copyright 2008 Free Software Foundation, Inc. +This file is part of GNU Radio + +GNU Radio Companion is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +GNU Radio Companion 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. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +""" +##@package Editor +#Execute the flow graph editor GUI. This file must be called by the python interpreter. +#@author Josh Blum + +import grc +from grc.Constants import VERSION,FLOW_GRAPH_FILE_EXTENSION +from optparse import OptionParser + +if __name__ == "__main__": + usage = 'usage: %%prog [options] [optional_flow_graphs%s]'%FLOW_GRAPH_FILE_EXTENSION + version = """ +GNU Radio Companion %s + +This program is part of GNU Radio +GRC comes with ABSOLUTELY NO WARRANTY. +This is free software, +and you are welcome to redistribute it. +"""%VERSION + parser = OptionParser(usage=usage, version=version) + (options, args) = parser.parse_args() + from grc_gnuradio.Platform import Platform + from grc.ActionHandler import ActionHandler + ActionHandler(args, Platform()) + diff --git a/grc/scripts/usrp_diagnostics b/grc/scripts/usrp_diagnostics new file mode 100755 index 000000000..a7d9d6f5d --- /dev/null +++ b/grc/scripts/usrp_diagnostics @@ -0,0 +1,121 @@ +#!/usr/bin/env python +""" +Copyright 2008 Free Software Foundation, Inc. +This file is part of GNU Radio + +GNU Radio Companion is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +GNU Radio Companion 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. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +""" +##@package Graphics.USRPDiagnostics +#A dialog for querying USRP subdevices. USRP interfacing methods encapsulated here. +#@author Josh Blum + +from gnuradio import usrp +import os + +import pygtk +pygtk.require('2.0') +import gtk + +from grc.gui.Dialogs import TextDisplay + +from grc_gnuradio.Platform import Platform +platform = Platform(block_paths_internal_only=['usrp_diagnostics.xml']) + +from grc.gui.elements.Platform import Platform +platform = Platform(platform) + +flow_graph = platform.get_new_flow_graph() +block = flow_graph.get_new_block('usrp_diagnostics') + +##all params +usrp_number_param = block.get_param('usrp_number') +usrp_type_param = block.get_param('usrp_type') +side_subdev_param = block.get_param('side_subdev') + +class USRPDiagnosticsWindow(gtk.Window): + """ + The main window for USRP Dignostics. + """ + + def delete_event(self, widget, event, data=None): return False + + def destroy(self, widget, data=None): gtk.main_quit() + + def __init__(self): + """ + USRPDiagnosticsWindow contructor. + Create a new gtk Dialog with a close button, USRP input paramaters, and output labels. + """ + gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) + #quit signals + self.connect("delete_event", self.delete_event) + self.connect("destroy", self.destroy) + #set the title + self.set_title('USRP Diagnostics') + #create decorative frame + frame = gtk.Frame() + self.add(frame) + #create vbox for storage + vbox = gtk.VBox() + frame.add(vbox) + vbox.pack_start(usrp_number_param.get_input_object(), False) + vbox.pack_start(usrp_type_param.get_input_object(), False) + vbox.pack_start(side_subdev_param.get_input_object(), False) + self.diagnose_button = gtk.Button('Query') + self.diagnose_button.connect('clicked', self._diagnose_usrp) + vbox.pack_start(self.diagnose_button, False) + #Create a text box for USRP queries + self.query_buffer = TextDisplay() + self.query_buffer.set_text('Press "Query" to retrieve USRP information...') + vbox.pack_start(self.query_buffer) + self.show_all() + + def _diagnose_usrp(self, widget=None): + """Query the USRP device and copy the results into the query text box.""" + type = usrp_type_param.evaluate() + if type == 'rx': #for the rx query, use the source and rx methods + make = usrp.source_c + get_mux = usrp.determine_rx_mux_value + elif type == 'tx': #for the tx query, use the sink and tx methods + make = usrp.sink_c + get_mux = usrp.determine_tx_mux_value + try: + u = make(usrp_number_param.evaluate()) + subdev_spec = eval(side_subdev_param.evaluate()) + subdev = usrp.selected_subdev(u, subdev_spec)#get the subdev + msg = ">>> USRP Query\n" + msg = "%s\nName:\n\t%s\n"%(msg, str(subdev.name())) + msg = "%s\nAutomated Mux:\n\t0x%08x\n"%(msg, 0xFFFFFFFFL & long(get_mux(u, subdev_spec))) #ensure that the value is displayed as: 8 nibbles, unsigned, hex + msg = "%s\nConverter Rate:\n\t%s\n"%(msg, u.converter_rate()) + msg = "%s\nUses Quadrature:\n\t%s\n"%(msg, str(subdev.is_quadrature())) + gain_min, gain_max, gain_step = subdev.gain_range() + msg = "%s\nGain Range (min, max, step size):\n\t%s\n\t%s\n\t%s\n"%(msg, gain_min, gain_max, gain_step) + freq_min, freq_max, freq_step = subdev.freq_range() + msg = "%s\nFreq Range (min, max, step size):\n\t%s\n\t%s\n\t%s\n"%(msg, freq_min, freq_max, freq_step) + self.query_buffer.set_text(msg) + except Exception, e: #display the error message + self.query_buffer.set_text('''\ +>>> Error\n%s + +If the USRP cannot be found, make sure that the USRP is plugged-in and restart this program. \ +If the problem persists, there may be a problem with you gnuradio installation or USB 2.0. +'''%str(e)) + +#enter the mainloop +gtk.gdk.threads_init() +gtk.gdk.threads_enter() +USRPDiagnosticsWindow() +gtk.main() +gtk.gdk.threads_leave() -- cgit From c86f6c23c6883f73d953d64c28ab42cedb77e4d7 Mon Sep 17 00:00:00 2001 From: jblum Date: Sun, 7 Sep 2008 21:38:12 +0000 Subject: Merged r9481:9518 on jblum/grc_reorganize into trunk. Reorganized grc source under gnuradio.grc module. Trunk passes make distcheck. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9525 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/scripts/Makefile.am | 2 +- grc/scripts/grc | 10 +++------- grc/scripts/usrp_diagnostics | 9 +++------ 3 files changed, 7 insertions(+), 14 deletions(-) (limited to 'grc/scripts') diff --git a/grc/scripts/Makefile.am b/grc/scripts/Makefile.am index be4ae1b8d..27a77b18b 100644 --- a/grc/scripts/Makefile.am +++ b/grc/scripts/Makefile.am @@ -19,7 +19,7 @@ # Boston, MA 02110-1301, USA. # -include $(top_srcdir)/Makefile.common +include $(top_srcdir)/grc/Makefile.inc EXTRA_DIST = $(bin_SCRIPTS) diff --git a/grc/scripts/grc b/grc/scripts/grc index 44d07a7ee..93a9a05c0 100755 --- a/grc/scripts/grc +++ b/grc/scripts/grc @@ -17,12 +17,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ -##@package Editor -#Execute the flow graph editor GUI. This file must be called by the python interpreter. -#@author Josh Blum -import grc -from grc.Constants import VERSION,FLOW_GRAPH_FILE_EXTENSION +from gnuradio.grc.platforms.base.Constants import VERSION, FLOW_GRAPH_FILE_EXTENSION from optparse import OptionParser if __name__ == "__main__": @@ -37,7 +33,7 @@ and you are welcome to redistribute it. """%VERSION parser = OptionParser(usage=usage, version=version) (options, args) = parser.parse_args() - from grc_gnuradio.Platform import Platform - from grc.ActionHandler import ActionHandler + from gnuradio.grc.platforms.python.Platform import Platform + from gnuradio.grc.gui.ActionHandler import ActionHandler ActionHandler(args, Platform()) diff --git a/grc/scripts/usrp_diagnostics b/grc/scripts/usrp_diagnostics index a7d9d6f5d..b8e316399 100755 --- a/grc/scripts/usrp_diagnostics +++ b/grc/scripts/usrp_diagnostics @@ -17,9 +17,6 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ -##@package Graphics.USRPDiagnostics -#A dialog for querying USRP subdevices. USRP interfacing methods encapsulated here. -#@author Josh Blum from gnuradio import usrp import os @@ -28,12 +25,12 @@ import pygtk pygtk.require('2.0') import gtk -from grc.gui.Dialogs import TextDisplay +from gnuradio.grc.gui.Dialogs import TextDisplay -from grc_gnuradio.Platform import Platform +from gnuradio.grc.platforms.python.Platform import Platform platform = Platform(block_paths_internal_only=['usrp_diagnostics.xml']) -from grc.gui.elements.Platform import Platform +from gnuradio.grc.platforms.gui.Platform import Platform platform = Platform(platform) flow_graph = platform.get_new_flow_graph() -- cgit From d601eb214a5c5e647134f7a43c5d0fa83c3488a4 Mon Sep 17 00:00:00 2001 From: jblum Date: Wed, 17 Sep 2008 14:34:27 +0000 Subject: replaced EXTRA_DIST with dist_ prefix git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9600 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/scripts/Makefile.am | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'grc/scripts') diff --git a/grc/scripts/Makefile.am b/grc/scripts/Makefile.am index 27a77b18b..d3c08eb70 100644 --- a/grc/scripts/Makefile.am +++ b/grc/scripts/Makefile.am @@ -21,6 +21,4 @@ include $(top_srcdir)/grc/Makefile.inc -EXTRA_DIST = $(bin_SCRIPTS) - -bin_SCRIPTS = grc usrp_diagnostics +dist_bin_SCRIPTS = grc usrp_diagnostics -- cgit From 0174f42a56c3e95008ffc6a9771f2bb2d155f0f5 Mon Sep 17 00:00:00 2001 From: jblum Date: Sun, 28 Sep 2008 03:35:21 +0000 Subject: freedesktop git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9668 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/scripts/grc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'grc/scripts') diff --git a/grc/scripts/grc b/grc/scripts/grc index 93a9a05c0..4073c92f8 100755 --- a/grc/scripts/grc +++ b/grc/scripts/grc @@ -18,7 +18,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ -from gnuradio.grc.platforms.base.Constants import VERSION, FLOW_GRAPH_FILE_EXTENSION +from gnuradio.grc.gui.Constants import FLOW_GRAPH_FILE_EXTENSION +from gnuradio.grc.platforms.base.Constants import VERSION from optparse import OptionParser if __name__ == "__main__": -- cgit From d01692fa60eb6b08b6b7b5369d2a08cee912395f Mon Sep 17 00:00:00 2001 From: jblum Date: Fri, 28 Nov 2008 06:51:21 +0000 Subject: new preferences git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10081 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/scripts/grc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'grc/scripts') diff --git a/grc/scripts/grc b/grc/scripts/grc index 4073c92f8..11f9c60d3 100755 --- a/grc/scripts/grc +++ b/grc/scripts/grc @@ -18,12 +18,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ -from gnuradio.grc.gui.Constants import FLOW_GRAPH_FILE_EXTENSION from gnuradio.grc.platforms.base.Constants import VERSION from optparse import OptionParser if __name__ == "__main__": - usage = 'usage: %%prog [options] [optional_flow_graphs%s]'%FLOW_GRAPH_FILE_EXTENSION + usage = 'usage: %prog [options] [saved flow graphs]' version = """ GNU Radio Companion %s -- cgit From 66811bb61a014b7da27235cdb6219705243533a9 Mon Sep 17 00:00:00 2001 From: jblum Date: Tue, 20 Jan 2009 04:59:13 +0000 Subject: call it probe git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10264 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/scripts/Makefile.am | 2 +- grc/scripts/usrp_diagnostics | 118 ------------------------------------------- grc/scripts/usrp_probe | 117 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 118 insertions(+), 119 deletions(-) delete mode 100755 grc/scripts/usrp_diagnostics create mode 100755 grc/scripts/usrp_probe (limited to 'grc/scripts') diff --git a/grc/scripts/Makefile.am b/grc/scripts/Makefile.am index d3c08eb70..27ffabc53 100644 --- a/grc/scripts/Makefile.am +++ b/grc/scripts/Makefile.am @@ -21,4 +21,4 @@ include $(top_srcdir)/grc/Makefile.inc -dist_bin_SCRIPTS = grc usrp_diagnostics +dist_bin_SCRIPTS = grc usrp_probe diff --git a/grc/scripts/usrp_diagnostics b/grc/scripts/usrp_diagnostics deleted file mode 100755 index b8e316399..000000000 --- a/grc/scripts/usrp_diagnostics +++ /dev/null @@ -1,118 +0,0 @@ -#!/usr/bin/env python -""" -Copyright 2008 Free Software Foundation, Inc. -This file is part of GNU Radio - -GNU Radio Companion is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -GNU Radio Companion 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. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA -""" - -from gnuradio import usrp -import os - -import pygtk -pygtk.require('2.0') -import gtk - -from gnuradio.grc.gui.Dialogs import TextDisplay - -from gnuradio.grc.platforms.python.Platform import Platform -platform = Platform(block_paths_internal_only=['usrp_diagnostics.xml']) - -from gnuradio.grc.platforms.gui.Platform import Platform -platform = Platform(platform) - -flow_graph = platform.get_new_flow_graph() -block = flow_graph.get_new_block('usrp_diagnostics') - -##all params -usrp_number_param = block.get_param('usrp_number') -usrp_type_param = block.get_param('usrp_type') -side_subdev_param = block.get_param('side_subdev') - -class USRPDiagnosticsWindow(gtk.Window): - """ - The main window for USRP Dignostics. - """ - - def delete_event(self, widget, event, data=None): return False - - def destroy(self, widget, data=None): gtk.main_quit() - - def __init__(self): - """ - USRPDiagnosticsWindow contructor. - Create a new gtk Dialog with a close button, USRP input paramaters, and output labels. - """ - gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) - #quit signals - self.connect("delete_event", self.delete_event) - self.connect("destroy", self.destroy) - #set the title - self.set_title('USRP Diagnostics') - #create decorative frame - frame = gtk.Frame() - self.add(frame) - #create vbox for storage - vbox = gtk.VBox() - frame.add(vbox) - vbox.pack_start(usrp_number_param.get_input_object(), False) - vbox.pack_start(usrp_type_param.get_input_object(), False) - vbox.pack_start(side_subdev_param.get_input_object(), False) - self.diagnose_button = gtk.Button('Query') - self.diagnose_button.connect('clicked', self._diagnose_usrp) - vbox.pack_start(self.diagnose_button, False) - #Create a text box for USRP queries - self.query_buffer = TextDisplay() - self.query_buffer.set_text('Press "Query" to retrieve USRP information...') - vbox.pack_start(self.query_buffer) - self.show_all() - - def _diagnose_usrp(self, widget=None): - """Query the USRP device and copy the results into the query text box.""" - type = usrp_type_param.evaluate() - if type == 'rx': #for the rx query, use the source and rx methods - make = usrp.source_c - get_mux = usrp.determine_rx_mux_value - elif type == 'tx': #for the tx query, use the sink and tx methods - make = usrp.sink_c - get_mux = usrp.determine_tx_mux_value - try: - u = make(usrp_number_param.evaluate()) - subdev_spec = eval(side_subdev_param.evaluate()) - subdev = usrp.selected_subdev(u, subdev_spec)#get the subdev - msg = ">>> USRP Query\n" - msg = "%s\nName:\n\t%s\n"%(msg, str(subdev.name())) - msg = "%s\nAutomated Mux:\n\t0x%08x\n"%(msg, 0xFFFFFFFFL & long(get_mux(u, subdev_spec))) #ensure that the value is displayed as: 8 nibbles, unsigned, hex - msg = "%s\nConverter Rate:\n\t%s\n"%(msg, u.converter_rate()) - msg = "%s\nUses Quadrature:\n\t%s\n"%(msg, str(subdev.is_quadrature())) - gain_min, gain_max, gain_step = subdev.gain_range() - msg = "%s\nGain Range (min, max, step size):\n\t%s\n\t%s\n\t%s\n"%(msg, gain_min, gain_max, gain_step) - freq_min, freq_max, freq_step = subdev.freq_range() - msg = "%s\nFreq Range (min, max, step size):\n\t%s\n\t%s\n\t%s\n"%(msg, freq_min, freq_max, freq_step) - self.query_buffer.set_text(msg) - except Exception, e: #display the error message - self.query_buffer.set_text('''\ ->>> Error\n%s - -If the USRP cannot be found, make sure that the USRP is plugged-in and restart this program. \ -If the problem persists, there may be a problem with you gnuradio installation or USB 2.0. -'''%str(e)) - -#enter the mainloop -gtk.gdk.threads_init() -gtk.gdk.threads_enter() -USRPDiagnosticsWindow() -gtk.main() -gtk.gdk.threads_leave() diff --git a/grc/scripts/usrp_probe b/grc/scripts/usrp_probe new file mode 100755 index 000000000..eab57677d --- /dev/null +++ b/grc/scripts/usrp_probe @@ -0,0 +1,117 @@ +#!/usr/bin/env python +""" +Copyright 2008 Free Software Foundation, Inc. +This file is part of GNU Radio + +GNU Radio Companion is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +GNU Radio Companion 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. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +""" + +from gnuradio import usrp +import os + +import pygtk +pygtk.require('2.0') +import gtk + +from gnuradio.grc.gui.Dialogs import TextDisplay + +from gnuradio.grc.platforms.python.Platform import Platform +platform = Platform(block_paths_internal_only=['usrp_probe.xml']) + +from gnuradio.grc.platforms.gui.Platform import Platform +platform = Platform(platform) + +flow_graph = platform.get_new_flow_graph() +block = flow_graph.get_new_block('usrp_probe') + +##all params +usrp_number_param = block.get_param('number') +usrp_dboard_param = block.get_param('dboard') + +class USRPProbeWindow(gtk.Window): + """ + The main window for USRP Dignostics. + """ + + def delete_event(self, widget, event, data=None): return False + + def destroy(self, widget, data=None): gtk.main_quit() + + def __init__(self): + """ + USRPProbeWindow contructor. + Create a new gtk Dialog with a close button, USRP input paramaters, and output labels. + """ + gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) + #quit signals + self.connect("delete_event", self.delete_event) + self.connect("destroy", self.destroy) + #set the title + self.set_title('USRP Probe') + #create decorative frame + frame = gtk.Frame() + self.add(frame) + #create vbox for storage + vbox = gtk.VBox() + frame.add(vbox) + vbox.pack_start(usrp_number_param.get_input_object(), False) + vbox.pack_start(usrp_dboard_param.get_input_object(), False) + self.diagnose_button = gtk.Button('Probe') + self.diagnose_button.connect('clicked', self._probe_usrp) + vbox.pack_start(self.diagnose_button, False) + #Create a text box for USRP queries + self.query_buffer = TextDisplay() + self.query_buffer.set_text('Press "Probe" to retrieve USRP information...') + vbox.pack_start(self.query_buffer) + self.show_all() + + def _probe_usrp(self, widget=None): + """Probe the USRP device and copy the results into the query text box.""" + dboard = usrp_dboard_param.evaluate() + side = {'a': 0, 'b': 1}[dboard[-1]] + if dboard.startswith('rx'): #for the rx query, use the source and rx methods + make = usrp.source_c + get_mux = usrp.determine_rx_mux_value + elif dboard.startswith('tx'): #for the tx query, use the sink and tx methods + make = usrp.sink_c + get_mux = usrp.determine_tx_mux_value + try: + u = make(usrp_number_param.evaluate()) + subdev_spec = (side, 0) + subdev = usrp.selected_subdev(u, subdev_spec) #get the subdev + msg = ">>> USRP Probe\n" + msg = "%s\nName:\n\t%s\n"%(msg, str(subdev.name())) + msg = "%s\nAutomated Mux:\n\t0x%08x\n"%(msg, 0xFFFFFFFFL & long(get_mux(u, subdev_spec))) #ensure that the value is displayed as: 8 nibbles, unsigned, hex + msg = "%s\nConverter Rate:\n\t%s\n"%(msg, u.converter_rate()) + msg = "%s\nUses Quadrature:\n\t%s\n"%(msg, str(subdev.is_quadrature())) + gain_min, gain_max, gain_step = subdev.gain_range() + msg = "%s\nGain Range (min, max, step size):\n\t%s\n\t%s\n\t%s\n"%(msg, gain_min, gain_max, gain_step) + freq_min, freq_max, freq_step = subdev.freq_range() + msg = "%s\nFreq Range (min, max, step size):\n\t%s\n\t%s\n\t%s\n"%(msg, freq_min, freq_max, freq_step) + self.query_buffer.set_text(msg) + except Exception, e: #display the error message + self.query_buffer.set_text('''\ +>>> Error\n%s + +If the USRP cannot be found, make sure that the USRP is plugged-in and restart this program. \ +If the problem persists, there may be a problem with you gnuradio installation or USB 2.0. +'''%str(e)) + +#enter the mainloop +gtk.gdk.threads_init() +gtk.gdk.threads_enter() +USRPProbeWindow() +gtk.main() +gtk.gdk.threads_leave() -- cgit From 88470f93a4d2e9e6d7e5d39dac52115de0e5d1ca Mon Sep 17 00:00:00 2001 From: jblum Date: Tue, 20 Jan 2009 07:14:39 +0000 Subject: set the icon in both executables git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10266 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/scripts/grc | 7 +++++++ grc/scripts/usrp_probe | 16 ++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) (limited to 'grc/scripts') diff --git a/grc/scripts/grc b/grc/scripts/grc index 11f9c60d3..94fb4294c 100755 --- a/grc/scripts/grc +++ b/grc/scripts/grc @@ -18,6 +18,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ +import pygtk +pygtk.require('2.0') +import gtk + from gnuradio.grc.platforms.base.Constants import VERSION from optparse import OptionParser @@ -35,5 +39,8 @@ and you are welcome to redistribute it. (options, args) = parser.parse_args() from gnuradio.grc.platforms.python.Platform import Platform from gnuradio.grc.gui.ActionHandler import ActionHandler + #setup icon using icon theme + try: gtk.window_set_default_icon(gtk.IconTheme().load_icon('gnuradio-grc', 256, 0)) + except: pass ActionHandler(args, Platform()) diff --git a/grc/scripts/usrp_probe b/grc/scripts/usrp_probe index eab57677d..c92603482 100755 --- a/grc/scripts/usrp_probe +++ b/grc/scripts/usrp_probe @@ -109,9 +109,13 @@ If the USRP cannot be found, make sure that the USRP is plugged-in and restart t If the problem persists, there may be a problem with you gnuradio installation or USB 2.0. '''%str(e)) -#enter the mainloop -gtk.gdk.threads_init() -gtk.gdk.threads_enter() -USRPProbeWindow() -gtk.main() -gtk.gdk.threads_leave() +if __name__ == '__main__': + #setup icon using icon theme + try: gtk.window_set_default_icon(gtk.IconTheme().load_icon('gnuradio-grc', 256, 0)) + except: pass + #enter the mainloop + gtk.gdk.threads_init() + gtk.gdk.threads_enter() + USRPProbeWindow() + gtk.main() + gtk.gdk.threads_leave() -- cgit From a6b928438657b86426c6ca04adec2030a865dab2 Mon Sep 17 00:00:00 2001 From: jblum Date: Tue, 20 Jan 2009 22:44:51 +0000 Subject: probe for the usrp2 git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10271 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/scripts/Makefile.am | 2 +- grc/scripts/grc | 2 +- grc/scripts/usrp2_probe | 159 ++++++++++++++++++++++++++++++++++++++++++++++++ grc/scripts/usrp_probe | 13 ++-- 4 files changed, 166 insertions(+), 10 deletions(-) create mode 100755 grc/scripts/usrp2_probe (limited to 'grc/scripts') diff --git a/grc/scripts/Makefile.am b/grc/scripts/Makefile.am index 27ffabc53..35c75d5fe 100644 --- a/grc/scripts/Makefile.am +++ b/grc/scripts/Makefile.am @@ -21,4 +21,4 @@ include $(top_srcdir)/grc/Makefile.inc -dist_bin_SCRIPTS = grc usrp_probe +dist_bin_SCRIPTS = grc usrp2_probe usrp_probe diff --git a/grc/scripts/grc b/grc/scripts/grc index 94fb4294c..e74d98616 100755 --- a/grc/scripts/grc +++ b/grc/scripts/grc @@ -1,6 +1,6 @@ #!/usr/bin/env python """ -Copyright 2008 Free Software Foundation, Inc. +Copyright 2009 Free Software Foundation, Inc. This file is part of GNU Radio GNU Radio Companion is free software; you can redistribute it and/or diff --git a/grc/scripts/usrp2_probe b/grc/scripts/usrp2_probe new file mode 100755 index 000000000..deb2e538d --- /dev/null +++ b/grc/scripts/usrp2_probe @@ -0,0 +1,159 @@ +#!/usr/bin/env python +""" +Copyright 2009 Free Software Foundation, Inc. +This file is part of GNU Radio + +GNU Radio Companion is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +GNU Radio Companion 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. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +""" + +from gnuradio import usrp2 +import subprocess +import os + +import pygtk +pygtk.require('2.0') +import gtk +import gobject + +from gnuradio.grc.gui.Dialogs import TextDisplay + +from gnuradio.grc.platforms.python.Platform import Platform +platform = Platform(block_paths_internal_only=['usrp2_probe.xml']) + +from gnuradio.grc.platforms.gui.Platform import Platform +platform = Platform(platform) + +flow_graph = platform.get_new_flow_graph() +block = flow_graph.get_new_block('usrp2_probe') + +##all params +usrp_interface_param = block.get_param('interface') +usrp_type_param = block.get_param('type') + +class USRP2ProbeWindow(gtk.Window): + """ + The main window for USRP Dignostics. + """ + + def delete_event(self, widget, event, data=None): return False + + def destroy(self, widget, data=None): gtk.main_quit() + + def __init__(self): + """ + USRP2ProbeWindow contructor. + Create a new gtk Dialog with a close button, USRP2 input paramaters, and output labels. + """ + self.usrp2_macs = list() + gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) + #quit signals + self.connect("delete_event", self.delete_event) + self.connect("destroy", self.destroy) + #set the title + self.set_title('USRP2 Probe') + #create decorative frame + frame = gtk.Frame() + self.add(frame) + #create vbox for storage + vbox = gtk.VBox() + frame.add(vbox) + vbox.pack_start(usrp_interface_param.get_input_object(), False) + vbox.pack_start(usrp_type_param.get_input_object(), False) + #make the tree model for holding mac addrs + self.treestore = gtk.TreeStore(gobject.TYPE_STRING) + self.treeview = gtk.TreeView(self.treestore) + self.treeview.set_enable_search(False) #disable pop up search box + self.treeview.add_events(gtk.gdk.BUTTON_PRESS_MASK) + self.treeview.connect('button_press_event', self._handle_selection) + selection = self.treeview.get_selection() + selection.set_mode('single') + selection.connect('changed', self._handle_selection) + renderer = gtk.CellRendererText() + column = gtk.TreeViewColumn('Select a USRP2 MAC Address', renderer, text=0) + self.treeview.append_column(column) + vbox.pack_start(self.treeview, False) + #create probe button + self.probe_button = gtk.Button('Probe') + self.probe_button.connect('clicked', self._probe_usrp2) + vbox.pack_start(self.probe_button, False) + #Create a text box for USRP queries + self.query_buffer = TextDisplay() + self.query_buffer.set_text(block.get_doc()) + vbox.pack_start(self.query_buffer) + self.show_all() + self.treeview.hide() + + def _probe_usrp2(self, widget=None): + """Probe the USRP2 device and copy the results into the query text box.""" + #call find usrps + args = ['find_usrps'] + interface = usrp_interface_param.evaluate() + if interface: args.extend(['-e', interface]) + p = subprocess.Popen(args=args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=False, universal_newlines=True) + msg = p.stdout.read() + #extract mac addrs + self.usrp2_macs = map(lambda l: l.split()[0], filter(lambda l: l.count(':') >= 5, msg.strip().splitlines())) + #set the tree store with the mac addrs + self.treestore.clear() + for usrp2_mac in self.usrp2_macs: + self.treestore.append(None, (usrp2_mac,)) + #set the text with the error message for 0 found, hide the list + #when only 1 usrp2, auto handle selection, hide the list + #for multiple usrp2, show the list + if not self.usrp2_macs: + self.treeview.hide() + self.query_buffer.set_text(msg) + elif len(self.usrp2_macs) == 1: + self.treeview.hide() + self.query_buffer.set_text('') + self._handle_selection() + else: + self.treeview.show() + self.query_buffer.set_text('') + + def _handle_selection(self, *args, **kwargs): + """A selection change or click occured.""" + #get the mac addr + selection = self.treeview.get_selection() + treestore, iter = selection.get_selected() + mac_addr = iter and treestore.get_value(iter, 0) or '' + if not mac_addr and len(self.usrp2_macs) > 1: + return #no empty mac addrs for when multiple found + #make the usrp2 object + make, rate_attr = { + 'rx': (usrp2.source_32fc, 'adc_rate'), + 'tx': (usrp2.sink_32fc, 'dac_rate'), + }[usrp_type_param.evaluate()] + try: + u = make(usrp_interface_param.evaluate(), mac_addr) + msg = ">>> USRP2 Probe\n" + msg = "%s\nMAC Addr:\n\t%s\n"%(msg, u.mac_addr()) + msg = "%s\nName (ID):\n\t%s\n"%(msg, u.daughterboard_id()) + msg = "%s\nConverter Rate:\n\t%s Hz\n"%(msg, getattr(u, rate_attr)()) + gain_min, gain_max, gain_step = u.gain_range() + msg = "%s\nGain Range (min, max, step size):\n\t%s\n\t%s\n\t%s\n"%(msg, gain_min, gain_max, gain_step) + freq_min, freq_max = u.freq_range() + msg = "%s\nFreq Range (min, max):\n\t%s Hz\n\t%s Hz\n"%(msg, freq_min, freq_max) + self.query_buffer.set_text(msg) + except Exception, e: #display the error message + self.query_buffer.set_text('>>> Error\n%s'%str(e)) + +if __name__ == '__main__': + #setup icon using icon theme + try: gtk.window_set_default_icon(gtk.IconTheme().load_icon('gnuradio-grc', 256, 0)) + except: pass + #enter the mainloop + USRP2ProbeWindow() + gtk.main() diff --git a/grc/scripts/usrp_probe b/grc/scripts/usrp_probe index c92603482..bff6e1479 100755 --- a/grc/scripts/usrp_probe +++ b/grc/scripts/usrp_probe @@ -1,6 +1,6 @@ #!/usr/bin/env python """ -Copyright 2008 Free Software Foundation, Inc. +Copyright 2009 Free Software Foundation, Inc. This file is part of GNU Radio GNU Radio Companion is free software; you can redistribute it and/or @@ -68,12 +68,12 @@ class USRPProbeWindow(gtk.Window): frame.add(vbox) vbox.pack_start(usrp_number_param.get_input_object(), False) vbox.pack_start(usrp_dboard_param.get_input_object(), False) - self.diagnose_button = gtk.Button('Probe') - self.diagnose_button.connect('clicked', self._probe_usrp) - vbox.pack_start(self.diagnose_button, False) + self.probe_button = gtk.Button('Probe') + self.probe_button.connect('clicked', self._probe_usrp) + vbox.pack_start(self.probe_button, False) #Create a text box for USRP queries self.query_buffer = TextDisplay() - self.query_buffer.set_text('Press "Probe" to retrieve USRP information...') + self.query_buffer.set_text(block.get_doc()) vbox.pack_start(self.query_buffer) self.show_all() @@ -114,8 +114,5 @@ if __name__ == '__main__': try: gtk.window_set_default_icon(gtk.IconTheme().load_icon('gnuradio-grc', 256, 0)) except: pass #enter the mainloop - gtk.gdk.threads_init() - gtk.gdk.threads_enter() USRPProbeWindow() gtk.main() - gtk.gdk.threads_leave() -- cgit From f64da1cf3acc3d12e3ac38f27cd3f09c3e920e0a Mon Sep 17 00:00:00 2001 From: jblum Date: Wed, 21 Jan 2009 00:38:23 +0000 Subject: sort macs git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10273 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/scripts/usrp2_probe | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'grc/scripts') diff --git a/grc/scripts/usrp2_probe b/grc/scripts/usrp2_probe index deb2e538d..ba47907d3 100755 --- a/grc/scripts/usrp2_probe +++ b/grc/scripts/usrp2_probe @@ -104,11 +104,10 @@ class USRP2ProbeWindow(gtk.Window): p = subprocess.Popen(args=args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=False, universal_newlines=True) msg = p.stdout.read() #extract mac addrs - self.usrp2_macs = map(lambda l: l.split()[0], filter(lambda l: l.count(':') >= 5, msg.strip().splitlines())) + self.usrp2_macs = sorted(map(lambda l: l.split()[0], filter(lambda l: l.count(':') >= 5, msg.strip().splitlines()))) #set the tree store with the mac addrs self.treestore.clear() - for usrp2_mac in self.usrp2_macs: - self.treestore.append(None, (usrp2_mac,)) + for usrp2_mac in self.usrp2_macs: self.treestore.append(None, (usrp2_mac,)) #set the text with the error message for 0 found, hide the list #when only 1 usrp2, auto handle selection, hide the list #for multiple usrp2, show the list -- cgit From f1ee6a7c8ae0a57a119d167b6e767138f6c487d1 Mon Sep 17 00:00:00 2001 From: jblum Date: Wed, 21 Jan 2009 19:05:38 +0000 Subject: usrp2 function names, usrp2 contructor usage git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10277 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/scripts/usrp2_probe | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'grc/scripts') diff --git a/grc/scripts/usrp2_probe b/grc/scripts/usrp2_probe index ba47907d3..baf44a479 100755 --- a/grc/scripts/usrp2_probe +++ b/grc/scripts/usrp2_probe @@ -135,8 +135,11 @@ class USRP2ProbeWindow(gtk.Window): 'rx': (usrp2.source_32fc, 'adc_rate'), 'tx': (usrp2.sink_32fc, 'dac_rate'), }[usrp_type_param.evaluate()] + interface = usrp_interface_param.evaluate() try: - u = make(usrp_interface_param.evaluate(), mac_addr) + if not interface and not mac_addr: u = make() + elif not mac_addr: u = make(interface) + else: u = make(interface, mac_addr) msg = ">>> USRP2 Probe\n" msg = "%s\nMAC Addr:\n\t%s\n"%(msg, u.mac_addr()) msg = "%s\nName (ID):\n\t%s\n"%(msg, u.daughterboard_id()) -- cgit From 09f236be864aaa3b5216eb42676eafb38d47b587 Mon Sep 17 00:00:00 2001 From: jblum Date: Sun, 1 Feb 2009 19:26:56 +0000 Subject: options for hb filter in usrp simple source git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10369 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/scripts/usrp_probe | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'grc/scripts') diff --git a/grc/scripts/usrp_probe b/grc/scripts/usrp_probe index bff6e1479..ac786075c 100755 --- a/grc/scripts/usrp_probe +++ b/grc/scripts/usrp_probe @@ -37,7 +37,7 @@ flow_graph = platform.get_new_flow_graph() block = flow_graph.get_new_block('usrp_probe') ##all params -usrp_number_param = block.get_param('number') +usrp_which_param = block.get_param('which') usrp_dboard_param = block.get_param('dboard') class USRPProbeWindow(gtk.Window): @@ -66,7 +66,7 @@ class USRPProbeWindow(gtk.Window): #create vbox for storage vbox = gtk.VBox() frame.add(vbox) - vbox.pack_start(usrp_number_param.get_input_object(), False) + vbox.pack_start(usrp_which_param.get_input_object(), False) vbox.pack_start(usrp_dboard_param.get_input_object(), False) self.probe_button = gtk.Button('Probe') self.probe_button.connect('clicked', self._probe_usrp) @@ -88,7 +88,7 @@ class USRPProbeWindow(gtk.Window): make = usrp.sink_c get_mux = usrp.determine_tx_mux_value try: - u = make(usrp_number_param.evaluate()) + u = make(which=usrp_which_param.evaluate()) subdev_spec = (side, 0) subdev = usrp.selected_subdev(u, subdev_spec) #get the subdev msg = ">>> USRP Probe\n" -- cgit From 9030fb71746966a9ef6eb6ae2dc0aebdc6016987 Mon Sep 17 00:00:00 2001 From: jblum Date: Tue, 17 Feb 2009 23:03:39 +0000 Subject: usrp methods for computing the mux for dual subdevices git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10457 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/scripts/usrp_probe | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'grc/scripts') diff --git a/grc/scripts/usrp_probe b/grc/scripts/usrp_probe index ac786075c..3d7b6f0cb 100755 --- a/grc/scripts/usrp_probe +++ b/grc/scripts/usrp_probe @@ -81,19 +81,14 @@ class USRPProbeWindow(gtk.Window): """Probe the USRP device and copy the results into the query text box.""" dboard = usrp_dboard_param.evaluate() side = {'a': 0, 'b': 1}[dboard[-1]] - if dboard.startswith('rx'): #for the rx query, use the source and rx methods - make = usrp.source_c - get_mux = usrp.determine_rx_mux_value - elif dboard.startswith('tx'): #for the tx query, use the sink and tx methods - make = usrp.sink_c - get_mux = usrp.determine_tx_mux_value + if dboard.startswith('rx'): make = usrp.source_c + elif dboard.startswith('tx'): make = usrp.sink_c try: u = make(which=usrp_which_param.evaluate()) subdev_spec = (side, 0) subdev = usrp.selected_subdev(u, subdev_spec) #get the subdev msg = ">>> USRP Probe\n" msg = "%s\nName:\n\t%s\n"%(msg, str(subdev.name())) - msg = "%s\nAutomated Mux:\n\t0x%08x\n"%(msg, 0xFFFFFFFFL & long(get_mux(u, subdev_spec))) #ensure that the value is displayed as: 8 nibbles, unsigned, hex msg = "%s\nConverter Rate:\n\t%s\n"%(msg, u.converter_rate()) msg = "%s\nUses Quadrature:\n\t%s\n"%(msg, str(subdev.is_quadrature())) gain_min, gain_max, gain_step = subdev.gain_range() -- cgit From a3ba8cf268816af51c4bb39ea7ecd7e85ea0807b Mon Sep 17 00:00:00 2001 From: jblum Date: Fri, 1 May 2009 20:28:04 +0000 Subject: Merged grc developer branch r10679:10938 Misc fixes and internal changes. Added help menu for usage tips. Added drag and drop for blocks. Removed callback controls, adopted forms. Any type can have enumerated options. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10941 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/scripts/grc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'grc/scripts') diff --git a/grc/scripts/grc b/grc/scripts/grc index e74d98616..70c7ad1ad 100755 --- a/grc/scripts/grc +++ b/grc/scripts/grc @@ -22,6 +22,14 @@ import pygtk pygtk.require('2.0') import gtk +try: import gnuradio +except ImportError, e: + d = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_CLOSE, message_format=""" +Cannot find module gnuradio. Is your PYTHONPATH set correctly?""") + d.set_title(e.message) + d.run() + exit(-1) + from gnuradio.grc.platforms.base.Constants import VERSION from optparse import OptionParser -- cgit From 2b9514d93968c722683063badeec6e261b887914 Mon Sep 17 00:00:00 2001 From: jblum Date: Sat, 23 May 2009 23:36:08 +0000 Subject: removed .message usage which causes deprecation warning in python 2.6 git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11111 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/scripts/grc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'grc/scripts') diff --git a/grc/scripts/grc b/grc/scripts/grc index 70c7ad1ad..efbcfd295 100755 --- a/grc/scripts/grc +++ b/grc/scripts/grc @@ -26,7 +26,7 @@ try: import gnuradio except ImportError, e: d = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_CLOSE, message_format=""" Cannot find module gnuradio. Is your PYTHONPATH set correctly?""") - d.set_title(e.message) + d.set_title(str(e)) d.run() exit(-1) -- cgit From e3cd8f7d59aad0ffd51c417b2623ab02588fdb08 Mon Sep 17 00:00:00 2001 From: jblum Date: Tue, 26 May 2009 19:44:59 +0000 Subject: a more general error for detecting python path and ld path problems git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11130 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/scripts/grc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'grc/scripts') diff --git a/grc/scripts/grc b/grc/scripts/grc index efbcfd295..d0b8099f1 100755 --- a/grc/scripts/grc +++ b/grc/scripts/grc @@ -22,10 +22,10 @@ import pygtk pygtk.require('2.0') import gtk -try: import gnuradio +try: from gnuradio import gr except ImportError, e: d = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_CLOSE, message_format=""" -Cannot find module gnuradio. Is your PYTHONPATH set correctly?""") +Cannot import gnuradio. Are your PYTHONPATH and LD_LIBRARY_PATH set correctly?""") d.set_title(str(e)) d.run() exit(-1) -- cgit From 693cf2facf18c95db1559b035b09137f0fc191e6 Mon Sep 17 00:00:00 2001 From: jblum Date: Fri, 29 May 2009 06:43:35 +0000 Subject: Did a little work with path handling. Additional blocks paths can be specified with environment variable GRC_BLOCKS_PATH git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11163 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/scripts/grc | 7 ++++++- grc/scripts/usrp2_probe | 2 +- grc/scripts/usrp_probe | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) (limited to 'grc/scripts') diff --git a/grc/scripts/grc b/grc/scripts/grc index d0b8099f1..a2e3bc28a 100755 --- a/grc/scripts/grc +++ b/grc/scripts/grc @@ -18,6 +18,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ +import os + import pygtk pygtk.require('2.0') import gtk @@ -50,5 +52,8 @@ and you are welcome to redistribute it. #setup icon using icon theme try: gtk.window_set_default_icon(gtk.IconTheme().load_icon('gnuradio-grc', 256, 0)) except: pass - ActionHandler(args, Platform()) + #extract extra block paths from environment variable, separated by semicolon + try: extra_blocks = os.environ['GRC_BLOCKS_PATH'].split(';') + except: extra_blocks = list() + ActionHandler(args, Platform(extra_blocks=extra_blocks)) diff --git a/grc/scripts/usrp2_probe b/grc/scripts/usrp2_probe index baf44a479..fac2427de 100755 --- a/grc/scripts/usrp2_probe +++ b/grc/scripts/usrp2_probe @@ -30,7 +30,7 @@ import gobject from gnuradio.grc.gui.Dialogs import TextDisplay from gnuradio.grc.platforms.python.Platform import Platform -platform = Platform(block_paths_internal_only=['usrp2_probe.xml']) +platform = Platform(critical_only=True) from gnuradio.grc.platforms.gui.Platform import Platform platform = Platform(platform) diff --git a/grc/scripts/usrp_probe b/grc/scripts/usrp_probe index 3d7b6f0cb..3eb3de58e 100755 --- a/grc/scripts/usrp_probe +++ b/grc/scripts/usrp_probe @@ -28,7 +28,7 @@ import gtk from gnuradio.grc.gui.Dialogs import TextDisplay from gnuradio.grc.platforms.python.Platform import Platform -platform = Platform(block_paths_internal_only=['usrp_probe.xml']) +platform = Platform(critical_only=True) from gnuradio.grc.platforms.gui.Platform import Platform platform = Platform(platform) -- cgit From 9988664127b367fa8fee4409f8460673d6f265e1 Mon Sep 17 00:00:00 2001 From: jblum Date: Tue, 23 Jun 2009 20:38:18 +0000 Subject: Merging r11186:11273 from grc branch. Fixes, features, and reorganization for grc. Minor fixes and features for wxgui forms. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11274 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/scripts/grc | 11 +++-------- grc/scripts/usrp2_probe | 6 +++--- grc/scripts/usrp_probe | 6 +++--- 3 files changed, 9 insertions(+), 14 deletions(-) (limited to 'grc/scripts') diff --git a/grc/scripts/grc b/grc/scripts/grc index a2e3bc28a..8a6cc0af4 100755 --- a/grc/scripts/grc +++ b/grc/scripts/grc @@ -18,8 +18,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ -import os - import pygtk pygtk.require('2.0') import gtk @@ -32,7 +30,7 @@ Cannot import gnuradio. Are your PYTHONPATH and LD_LIBRARY_PATH set correctly?"" d.run() exit(-1) -from gnuradio.grc.platforms.base.Constants import VERSION +from gnuradio.grc import VERSION from optparse import OptionParser if __name__ == "__main__": @@ -47,13 +45,10 @@ and you are welcome to redistribute it. """%VERSION parser = OptionParser(usage=usage, version=version) (options, args) = parser.parse_args() - from gnuradio.grc.platforms.python.Platform import Platform + from gnuradio.grc.python.Platform import Platform from gnuradio.grc.gui.ActionHandler import ActionHandler #setup icon using icon theme try: gtk.window_set_default_icon(gtk.IconTheme().load_icon('gnuradio-grc', 256, 0)) except: pass - #extract extra block paths from environment variable, separated by semicolon - try: extra_blocks = os.environ['GRC_BLOCKS_PATH'].split(';') - except: extra_blocks = list() - ActionHandler(args, Platform(extra_blocks=extra_blocks)) + ActionHandler(args, Platform()) diff --git a/grc/scripts/usrp2_probe b/grc/scripts/usrp2_probe index fac2427de..00d4366dd 100755 --- a/grc/scripts/usrp2_probe +++ b/grc/scripts/usrp2_probe @@ -29,10 +29,10 @@ import gobject from gnuradio.grc.gui.Dialogs import TextDisplay -from gnuradio.grc.platforms.python.Platform import Platform -platform = Platform(critical_only=True) +from gnuradio.grc.python.Platform import Platform +platform = Platform() -from gnuradio.grc.platforms.gui.Platform import Platform +from gnuradio.grc.gui.Platform import Platform platform = Platform(platform) flow_graph = platform.get_new_flow_graph() diff --git a/grc/scripts/usrp_probe b/grc/scripts/usrp_probe index 3eb3de58e..6565612c1 100755 --- a/grc/scripts/usrp_probe +++ b/grc/scripts/usrp_probe @@ -27,10 +27,10 @@ import gtk from gnuradio.grc.gui.Dialogs import TextDisplay -from gnuradio.grc.platforms.python.Platform import Platform -platform = Platform(critical_only=True) +from gnuradio.grc.python.Platform import Platform +platform = Platform() -from gnuradio.grc.platforms.gui.Platform import Platform +from gnuradio.grc.gui.Platform import Platform platform = Platform(platform) flow_graph = platform.get_new_flow_graph() -- cgit From c51227a80b5e03e2d18f02f8693de97610fe8f00 Mon Sep 17 00:00:00 2001 From: jblum Date: Sat, 11 Jul 2009 22:10:25 +0000 Subject: make use of gr.version() git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11420 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/scripts/grc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'grc/scripts') diff --git a/grc/scripts/grc b/grc/scripts/grc index 8a6cc0af4..a4115c39f 100755 --- a/grc/scripts/grc +++ b/grc/scripts/grc @@ -30,7 +30,7 @@ Cannot import gnuradio. Are your PYTHONPATH and LD_LIBRARY_PATH set correctly?"" d.run() exit(-1) -from gnuradio.grc import VERSION +from gnuradio import gr from optparse import OptionParser if __name__ == "__main__": @@ -42,7 +42,7 @@ This program is part of GNU Radio GRC comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it. -"""%VERSION +"""%gr.version() parser = OptionParser(usage=usage, version=version) (options, args) = parser.parse_args() from gnuradio.grc.python.Platform import Platform -- cgit From 253018c6cdb114f5662a2d7ba8ed748c6e68e3a7 Mon Sep 17 00:00:00 2001 From: git Date: Fri, 14 Aug 2009 18:10:11 +0000 Subject: Added git ignore files auto created from svn:ignore properties. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11592 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/scripts/.gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 grc/scripts/.gitignore (limited to 'grc/scripts') diff --git a/grc/scripts/.gitignore b/grc/scripts/.gitignore new file mode 100644 index 000000000..b336cc7ce --- /dev/null +++ b/grc/scripts/.gitignore @@ -0,0 +1,2 @@ +/Makefile +/Makefile.in -- cgit From 6b1d8817a7fc6dd99a770cb11fac7ca48a3c81b0 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 6 Sep 2009 01:58:25 -0700 Subject: Fixed the usrp and usrp2 probe scripts to work with the new gui param api. Also fixed the scripts to work since they were broken by previous changes. Get input in param class now pases a param instance (self) into the object. --- grc/scripts/usrp2_probe | 13 ++++++++----- grc/scripts/usrp_probe | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) (limited to 'grc/scripts') diff --git a/grc/scripts/usrp2_probe b/grc/scripts/usrp2_probe index 00d4366dd..689d41ecb 100755 --- a/grc/scripts/usrp2_probe +++ b/grc/scripts/usrp2_probe @@ -32,9 +32,6 @@ from gnuradio.grc.gui.Dialogs import TextDisplay from gnuradio.grc.python.Platform import Platform platform = Platform() -from gnuradio.grc.gui.Platform import Platform -platform = Platform(platform) - flow_graph = platform.get_new_flow_graph() block = flow_graph.get_new_block('usrp2_probe') @@ -42,6 +39,12 @@ block = flow_graph.get_new_block('usrp2_probe') usrp_interface_param = block.get_param('interface') usrp_type_param = block.get_param('type') +def get_input(param): + param.validate() + input = param.get_input() + input.update() + return input + class USRP2ProbeWindow(gtk.Window): """ The main window for USRP Dignostics. @@ -69,8 +72,8 @@ class USRP2ProbeWindow(gtk.Window): #create vbox for storage vbox = gtk.VBox() frame.add(vbox) - vbox.pack_start(usrp_interface_param.get_input_object(), False) - vbox.pack_start(usrp_type_param.get_input_object(), False) + vbox.pack_start(get_input(usrp_interface_param), False) + vbox.pack_start(get_input(usrp_type_param), False) #make the tree model for holding mac addrs self.treestore = gtk.TreeStore(gobject.TYPE_STRING) self.treeview = gtk.TreeView(self.treestore) diff --git a/grc/scripts/usrp_probe b/grc/scripts/usrp_probe index 6565612c1..985d481ce 100755 --- a/grc/scripts/usrp_probe +++ b/grc/scripts/usrp_probe @@ -30,9 +30,6 @@ from gnuradio.grc.gui.Dialogs import TextDisplay from gnuradio.grc.python.Platform import Platform platform = Platform() -from gnuradio.grc.gui.Platform import Platform -platform = Platform(platform) - flow_graph = platform.get_new_flow_graph() block = flow_graph.get_new_block('usrp_probe') @@ -40,6 +37,12 @@ block = flow_graph.get_new_block('usrp_probe') usrp_which_param = block.get_param('which') usrp_dboard_param = block.get_param('dboard') +def get_input(param): + param.validate() + input = param.get_input() + input.update() + return input + class USRPProbeWindow(gtk.Window): """ The main window for USRP Dignostics. @@ -66,8 +69,8 @@ class USRPProbeWindow(gtk.Window): #create vbox for storage vbox = gtk.VBox() frame.add(vbox) - vbox.pack_start(usrp_which_param.get_input_object(), False) - vbox.pack_start(usrp_dboard_param.get_input_object(), False) + vbox.pack_start(get_input(usrp_which_param), False) + vbox.pack_start(get_input(usrp_dboard_param), False) self.probe_button = gtk.Button('Probe') self.probe_button.connect('clicked', self._probe_usrp) vbox.pack_start(self.probe_button, False) -- cgit From b8f69ad7ba49aa85239f6de611ddfd040344f66b Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 8 Sep 2009 23:04:38 -0700 Subject: use show signal to perform initial gui update --- grc/scripts/usrp2_probe | 1 - grc/scripts/usrp_probe | 1 - 2 files changed, 2 deletions(-) (limited to 'grc/scripts') diff --git a/grc/scripts/usrp2_probe b/grc/scripts/usrp2_probe index 689d41ecb..38c8f655c 100755 --- a/grc/scripts/usrp2_probe +++ b/grc/scripts/usrp2_probe @@ -42,7 +42,6 @@ usrp_type_param = block.get_param('type') def get_input(param): param.validate() input = param.get_input() - input.update() return input class USRP2ProbeWindow(gtk.Window): diff --git a/grc/scripts/usrp_probe b/grc/scripts/usrp_probe index 985d481ce..d2e92e753 100755 --- a/grc/scripts/usrp_probe +++ b/grc/scripts/usrp_probe @@ -40,7 +40,6 @@ usrp_dboard_param = block.get_param('dboard') def get_input(param): param.validate() input = param.get_input() - input.update() return input class USRPProbeWindow(gtk.Window): -- cgit From 175c074ba74143d5af530e5cc4bd50335f64b1d5 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 28 Oct 2009 14:33:52 -0700 Subject: Created a grc_blockdir in makefile.common. Switched the grc src prefix in grc makefiles. Removed grc/Makefile.inc as it was no longer neededed. --- grc/scripts/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'grc/scripts') diff --git a/grc/scripts/Makefile.am b/grc/scripts/Makefile.am index 35c75d5fe..e24f88800 100644 --- a/grc/scripts/Makefile.am +++ b/grc/scripts/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2008 Free Software Foundation, Inc. +# Copyright 2008, 2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -19,6 +19,6 @@ # Boston, MA 02110-1301, USA. # -include $(top_srcdir)/grc/Makefile.inc +include $(top_srcdir)/Makefile.common dist_bin_SCRIPTS = grc usrp2_probe usrp_probe -- cgit From 8944000061cbfb995e56b74ab03034ec3541caac Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Tue, 18 May 2010 13:53:39 -0700 Subject: grc: rename execution binary from 'grc' to 'gnuradio-companion' This change resolves a conflict with the Generic Colorizer application which also uses the binary name 'grc'. Interested users can add an alias to their shell environment to run gnuradio-companion when grc is invoked. --- grc/scripts/Makefile.am | 4 ++-- grc/scripts/gnuradio-companion | 54 ++++++++++++++++++++++++++++++++++++++++++ grc/scripts/grc | 54 ------------------------------------------ 3 files changed, 56 insertions(+), 56 deletions(-) create mode 100755 grc/scripts/gnuradio-companion delete mode 100755 grc/scripts/grc (limited to 'grc/scripts') diff --git a/grc/scripts/Makefile.am b/grc/scripts/Makefile.am index e24f88800..9019ec5cc 100644 --- a/grc/scripts/Makefile.am +++ b/grc/scripts/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2008, 2009 Free Software Foundation, Inc. +# Copyright 2008, 2009, 2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,4 +21,4 @@ include $(top_srcdir)/Makefile.common -dist_bin_SCRIPTS = grc usrp2_probe usrp_probe +dist_bin_SCRIPTS = gnuradio-companion usrp2_probe usrp_probe diff --git a/grc/scripts/gnuradio-companion b/grc/scripts/gnuradio-companion new file mode 100755 index 000000000..a4115c39f --- /dev/null +++ b/grc/scripts/gnuradio-companion @@ -0,0 +1,54 @@ +#!/usr/bin/env python +""" +Copyright 2009 Free Software Foundation, Inc. +This file is part of GNU Radio + +GNU Radio Companion is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +GNU Radio Companion 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. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +""" + +import pygtk +pygtk.require('2.0') +import gtk + +try: from gnuradio import gr +except ImportError, e: + d = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_CLOSE, message_format=""" +Cannot import gnuradio. Are your PYTHONPATH and LD_LIBRARY_PATH set correctly?""") + d.set_title(str(e)) + d.run() + exit(-1) + +from gnuradio import gr +from optparse import OptionParser + +if __name__ == "__main__": + usage = 'usage: %prog [options] [saved flow graphs]' + version = """ +GNU Radio Companion %s + +This program is part of GNU Radio +GRC comes with ABSOLUTELY NO WARRANTY. +This is free software, +and you are welcome to redistribute it. +"""%gr.version() + parser = OptionParser(usage=usage, version=version) + (options, args) = parser.parse_args() + from gnuradio.grc.python.Platform import Platform + from gnuradio.grc.gui.ActionHandler import ActionHandler + #setup icon using icon theme + try: gtk.window_set_default_icon(gtk.IconTheme().load_icon('gnuradio-grc', 256, 0)) + except: pass + ActionHandler(args, Platform()) + diff --git a/grc/scripts/grc b/grc/scripts/grc deleted file mode 100755 index a4115c39f..000000000 --- a/grc/scripts/grc +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env python -""" -Copyright 2009 Free Software Foundation, Inc. -This file is part of GNU Radio - -GNU Radio Companion is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -GNU Radio Companion 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. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA -""" - -import pygtk -pygtk.require('2.0') -import gtk - -try: from gnuradio import gr -except ImportError, e: - d = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_CLOSE, message_format=""" -Cannot import gnuradio. Are your PYTHONPATH and LD_LIBRARY_PATH set correctly?""") - d.set_title(str(e)) - d.run() - exit(-1) - -from gnuradio import gr -from optparse import OptionParser - -if __name__ == "__main__": - usage = 'usage: %prog [options] [saved flow graphs]' - version = """ -GNU Radio Companion %s - -This program is part of GNU Radio -GRC comes with ABSOLUTELY NO WARRANTY. -This is free software, -and you are welcome to redistribute it. -"""%gr.version() - parser = OptionParser(usage=usage, version=version) - (options, args) = parser.parse_args() - from gnuradio.grc.python.Platform import Platform - from gnuradio.grc.gui.ActionHandler import ActionHandler - #setup icon using icon theme - try: gtk.window_set_default_icon(gtk.IconTheme().load_icon('gnuradio-grc', 256, 0)) - except: pass - ActionHandler(args, Platform()) - -- cgit From 07bd878bc30f7ab54afc1e2f0055419388c3c992 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 13 Mar 2011 17:33:33 -0700 Subject: grc: moved all usrp1 and usrp2 stuff out of grc and into gr-usrp*/grc Moved grc xml files, python wrappers (USRP1 only), probe apps + freedesktop files. When the gr-usrp and gr-usrp2 directories are removed, grc will not have to change. Minor change: the freedesktop files are always installed now. This does not mean that they are installed properly with xdg, it just means that the runtime can have access to the icons. --- grc/scripts/Makefile.am | 4 +- grc/scripts/usrp2_probe | 163 ------------------------------------------------ grc/scripts/usrp_probe | 115 ---------------------------------- 3 files changed, 2 insertions(+), 280 deletions(-) delete mode 100755 grc/scripts/usrp2_probe delete mode 100755 grc/scripts/usrp_probe (limited to 'grc/scripts') diff --git a/grc/scripts/Makefile.am b/grc/scripts/Makefile.am index 9019ec5cc..84e2759dc 100644 --- a/grc/scripts/Makefile.am +++ b/grc/scripts/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2008, 2009, 2010 Free Software Foundation, Inc. +# Copyright 2008-2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,4 +21,4 @@ include $(top_srcdir)/Makefile.common -dist_bin_SCRIPTS = gnuradio-companion usrp2_probe usrp_probe +dist_bin_SCRIPTS = gnuradio-companion diff --git a/grc/scripts/usrp2_probe b/grc/scripts/usrp2_probe deleted file mode 100755 index 38c8f655c..000000000 --- a/grc/scripts/usrp2_probe +++ /dev/null @@ -1,163 +0,0 @@ -#!/usr/bin/env python -""" -Copyright 2009 Free Software Foundation, Inc. -This file is part of GNU Radio - -GNU Radio Companion is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -GNU Radio Companion 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. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA -""" - -from gnuradio import usrp2 -import subprocess -import os - -import pygtk -pygtk.require('2.0') -import gtk -import gobject - -from gnuradio.grc.gui.Dialogs import TextDisplay - -from gnuradio.grc.python.Platform import Platform -platform = Platform() - -flow_graph = platform.get_new_flow_graph() -block = flow_graph.get_new_block('usrp2_probe') - -##all params -usrp_interface_param = block.get_param('interface') -usrp_type_param = block.get_param('type') - -def get_input(param): - param.validate() - input = param.get_input() - return input - -class USRP2ProbeWindow(gtk.Window): - """ - The main window for USRP Dignostics. - """ - - def delete_event(self, widget, event, data=None): return False - - def destroy(self, widget, data=None): gtk.main_quit() - - def __init__(self): - """ - USRP2ProbeWindow contructor. - Create a new gtk Dialog with a close button, USRP2 input paramaters, and output labels. - """ - self.usrp2_macs = list() - gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) - #quit signals - self.connect("delete_event", self.delete_event) - self.connect("destroy", self.destroy) - #set the title - self.set_title('USRP2 Probe') - #create decorative frame - frame = gtk.Frame() - self.add(frame) - #create vbox for storage - vbox = gtk.VBox() - frame.add(vbox) - vbox.pack_start(get_input(usrp_interface_param), False) - vbox.pack_start(get_input(usrp_type_param), False) - #make the tree model for holding mac addrs - self.treestore = gtk.TreeStore(gobject.TYPE_STRING) - self.treeview = gtk.TreeView(self.treestore) - self.treeview.set_enable_search(False) #disable pop up search box - self.treeview.add_events(gtk.gdk.BUTTON_PRESS_MASK) - self.treeview.connect('button_press_event', self._handle_selection) - selection = self.treeview.get_selection() - selection.set_mode('single') - selection.connect('changed', self._handle_selection) - renderer = gtk.CellRendererText() - column = gtk.TreeViewColumn('Select a USRP2 MAC Address', renderer, text=0) - self.treeview.append_column(column) - vbox.pack_start(self.treeview, False) - #create probe button - self.probe_button = gtk.Button('Probe') - self.probe_button.connect('clicked', self._probe_usrp2) - vbox.pack_start(self.probe_button, False) - #Create a text box for USRP queries - self.query_buffer = TextDisplay() - self.query_buffer.set_text(block.get_doc()) - vbox.pack_start(self.query_buffer) - self.show_all() - self.treeview.hide() - - def _probe_usrp2(self, widget=None): - """Probe the USRP2 device and copy the results into the query text box.""" - #call find usrps - args = ['find_usrps'] - interface = usrp_interface_param.evaluate() - if interface: args.extend(['-e', interface]) - p = subprocess.Popen(args=args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=False, universal_newlines=True) - msg = p.stdout.read() - #extract mac addrs - self.usrp2_macs = sorted(map(lambda l: l.split()[0], filter(lambda l: l.count(':') >= 5, msg.strip().splitlines()))) - #set the tree store with the mac addrs - self.treestore.clear() - for usrp2_mac in self.usrp2_macs: self.treestore.append(None, (usrp2_mac,)) - #set the text with the error message for 0 found, hide the list - #when only 1 usrp2, auto handle selection, hide the list - #for multiple usrp2, show the list - if not self.usrp2_macs: - self.treeview.hide() - self.query_buffer.set_text(msg) - elif len(self.usrp2_macs) == 1: - self.treeview.hide() - self.query_buffer.set_text('') - self._handle_selection() - else: - self.treeview.show() - self.query_buffer.set_text('') - - def _handle_selection(self, *args, **kwargs): - """A selection change or click occured.""" - #get the mac addr - selection = self.treeview.get_selection() - treestore, iter = selection.get_selected() - mac_addr = iter and treestore.get_value(iter, 0) or '' - if not mac_addr and len(self.usrp2_macs) > 1: - return #no empty mac addrs for when multiple found - #make the usrp2 object - make, rate_attr = { - 'rx': (usrp2.source_32fc, 'adc_rate'), - 'tx': (usrp2.sink_32fc, 'dac_rate'), - }[usrp_type_param.evaluate()] - interface = usrp_interface_param.evaluate() - try: - if not interface and not mac_addr: u = make() - elif not mac_addr: u = make(interface) - else: u = make(interface, mac_addr) - msg = ">>> USRP2 Probe\n" - msg = "%s\nMAC Addr:\n\t%s\n"%(msg, u.mac_addr()) - msg = "%s\nName (ID):\n\t%s\n"%(msg, u.daughterboard_id()) - msg = "%s\nConverter Rate:\n\t%s Hz\n"%(msg, getattr(u, rate_attr)()) - gain_min, gain_max, gain_step = u.gain_range() - msg = "%s\nGain Range (min, max, step size):\n\t%s\n\t%s\n\t%s\n"%(msg, gain_min, gain_max, gain_step) - freq_min, freq_max = u.freq_range() - msg = "%s\nFreq Range (min, max):\n\t%s Hz\n\t%s Hz\n"%(msg, freq_min, freq_max) - self.query_buffer.set_text(msg) - except Exception, e: #display the error message - self.query_buffer.set_text('>>> Error\n%s'%str(e)) - -if __name__ == '__main__': - #setup icon using icon theme - try: gtk.window_set_default_icon(gtk.IconTheme().load_icon('gnuradio-grc', 256, 0)) - except: pass - #enter the mainloop - USRP2ProbeWindow() - gtk.main() diff --git a/grc/scripts/usrp_probe b/grc/scripts/usrp_probe deleted file mode 100755 index d2e92e753..000000000 --- a/grc/scripts/usrp_probe +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/env python -""" -Copyright 2009 Free Software Foundation, Inc. -This file is part of GNU Radio - -GNU Radio Companion is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -GNU Radio Companion 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. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA -""" - -from gnuradio import usrp -import os - -import pygtk -pygtk.require('2.0') -import gtk - -from gnuradio.grc.gui.Dialogs import TextDisplay - -from gnuradio.grc.python.Platform import Platform -platform = Platform() - -flow_graph = platform.get_new_flow_graph() -block = flow_graph.get_new_block('usrp_probe') - -##all params -usrp_which_param = block.get_param('which') -usrp_dboard_param = block.get_param('dboard') - -def get_input(param): - param.validate() - input = param.get_input() - return input - -class USRPProbeWindow(gtk.Window): - """ - The main window for USRP Dignostics. - """ - - def delete_event(self, widget, event, data=None): return False - - def destroy(self, widget, data=None): gtk.main_quit() - - def __init__(self): - """ - USRPProbeWindow contructor. - Create a new gtk Dialog with a close button, USRP input paramaters, and output labels. - """ - gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) - #quit signals - self.connect("delete_event", self.delete_event) - self.connect("destroy", self.destroy) - #set the title - self.set_title('USRP Probe') - #create decorative frame - frame = gtk.Frame() - self.add(frame) - #create vbox for storage - vbox = gtk.VBox() - frame.add(vbox) - vbox.pack_start(get_input(usrp_which_param), False) - vbox.pack_start(get_input(usrp_dboard_param), False) - self.probe_button = gtk.Button('Probe') - self.probe_button.connect('clicked', self._probe_usrp) - vbox.pack_start(self.probe_button, False) - #Create a text box for USRP queries - self.query_buffer = TextDisplay() - self.query_buffer.set_text(block.get_doc()) - vbox.pack_start(self.query_buffer) - self.show_all() - - def _probe_usrp(self, widget=None): - """Probe the USRP device and copy the results into the query text box.""" - dboard = usrp_dboard_param.evaluate() - side = {'a': 0, 'b': 1}[dboard[-1]] - if dboard.startswith('rx'): make = usrp.source_c - elif dboard.startswith('tx'): make = usrp.sink_c - try: - u = make(which=usrp_which_param.evaluate()) - subdev_spec = (side, 0) - subdev = usrp.selected_subdev(u, subdev_spec) #get the subdev - msg = ">>> USRP Probe\n" - msg = "%s\nName:\n\t%s\n"%(msg, str(subdev.name())) - msg = "%s\nConverter Rate:\n\t%s\n"%(msg, u.converter_rate()) - msg = "%s\nUses Quadrature:\n\t%s\n"%(msg, str(subdev.is_quadrature())) - gain_min, gain_max, gain_step = subdev.gain_range() - msg = "%s\nGain Range (min, max, step size):\n\t%s\n\t%s\n\t%s\n"%(msg, gain_min, gain_max, gain_step) - freq_min, freq_max, freq_step = subdev.freq_range() - msg = "%s\nFreq Range (min, max, step size):\n\t%s\n\t%s\n\t%s\n"%(msg, freq_min, freq_max, freq_step) - self.query_buffer.set_text(msg) - except Exception, e: #display the error message - self.query_buffer.set_text('''\ ->>> Error\n%s - -If the USRP cannot be found, make sure that the USRP is plugged-in and restart this program. \ -If the problem persists, there may be a problem with you gnuradio installation or USB 2.0. -'''%str(e)) - -if __name__ == '__main__': - #setup icon using icon theme - try: gtk.window_set_default_icon(gtk.IconTheme().load_icon('gnuradio-grc', 256, 0)) - except: pass - #enter the mainloop - USRPProbeWindow() - gtk.main() -- cgit From accb9f2fe8fd8f6a1e114adac5b15304b0e0012d Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 20 Jul 2011 19:04:32 -0700 Subject: gr: squashed cmakelists.txt into one commit --- grc/scripts/CMakeLists.txt | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 grc/scripts/CMakeLists.txt (limited to 'grc/scripts') diff --git a/grc/scripts/CMakeLists.txt b/grc/scripts/CMakeLists.txt new file mode 100644 index 000000000..b8d5330f6 --- /dev/null +++ b/grc/scripts/CMakeLists.txt @@ -0,0 +1,25 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# 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. +# +# 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. + +######################################################################## +GR_PYTHON_INSTALL( + PROGRAMS gnuradio-companion + DESTINATION ${GR_RUNTIME_DIR} + COMPONENT "grc" +) -- cgit From 00420d32081d8252bb37142b2be19a8a7c4dc4c4 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Thu, 8 Dec 2011 13:48:48 -0800 Subject: Removed autotools, gr-waveform, some cleanup Nick Foster owes Nick Corgan a six-pack of beer! --- grc/scripts/.gitignore | 2 -- grc/scripts/Makefile.am | 24 ------------------------ 2 files changed, 26 deletions(-) delete mode 100644 grc/scripts/.gitignore delete mode 100644 grc/scripts/Makefile.am (limited to 'grc/scripts') diff --git a/grc/scripts/.gitignore b/grc/scripts/.gitignore deleted file mode 100644 index b336cc7ce..000000000 --- a/grc/scripts/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/Makefile -/Makefile.in diff --git a/grc/scripts/Makefile.am b/grc/scripts/Makefile.am deleted file mode 100644 index 84e2759dc..000000000 --- a/grc/scripts/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright 2008-2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# 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. -# -# 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. -# - -include $(top_srcdir)/Makefile.common - -dist_bin_SCRIPTS = gnuradio-companion -- cgit From 63ffe1ade4b582fc76a09139231dbf942c6ec85a Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 2 Feb 2012 13:30:34 -0800 Subject: grc: better error for import gr fail --- grc/scripts/gnuradio-companion | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'grc/scripts') diff --git a/grc/scripts/gnuradio-companion b/grc/scripts/gnuradio-companion index a4115c39f..e76322b4d 100755 --- a/grc/scripts/gnuradio-companion +++ b/grc/scripts/gnuradio-companion @@ -1,6 +1,6 @@ #!/usr/bin/env python """ -Copyright 2009 Free Software Foundation, Inc. +Copyright 2009-2012 Free Software Foundation, Inc. This file is part of GNU Radio GNU Radio Companion is free software; you can redistribute it and/or @@ -25,7 +25,16 @@ import gtk try: from gnuradio import gr except ImportError, e: d = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_CLOSE, message_format=""" -Cannot import gnuradio. Are your PYTHONPATH and LD_LIBRARY_PATH set correctly?""") +Cannot import gnuradio. + +Is the python path environment variable set correctly? + All OS: PYTHONPATH + +Is the library path environment variable set correctly? + Linux: LD_LIBRARY_PATH + Windows: PATH + MacOSX: DYLD_LIBRARY_PATH +""") d.set_title(str(e)) d.run() exit(-1) -- cgit From f919f9dcbb54a08e6e26d6c229ce92fb784fa1b2 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Fri, 13 Apr 2012 18:36:53 -0400 Subject: Removed whitespace and added dtools/bin/remove-whitespace as a tool to do this in the future. The sed script was provided by Moritz Fischer. --- grc/scripts/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'grc/scripts') diff --git a/grc/scripts/CMakeLists.txt b/grc/scripts/CMakeLists.txt index b8d5330f6..e90589230 100644 --- a/grc/scripts/CMakeLists.txt +++ b/grc/scripts/CMakeLists.txt @@ -1,17 +1,17 @@ # Copyright 2011 Free Software Foundation, Inc. -# +# # This file is part of GNU Radio -# +# # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. -# +# # 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. -# +# # 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, -- cgit From cf2a4f174bb49a6c9e839217369b1e22741a10da Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Tue, 15 Jan 2013 14:30:39 +0100 Subject: grc: Fixed Bug #485 by gracefully exiting when user sets GR_DONT_LOAD_PREFS=1 GRC_BLOCKS_PATH= --- grc/scripts/gnuradio-companion | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'grc/scripts') diff --git a/grc/scripts/gnuradio-companion b/grc/scripts/gnuradio-companion index e76322b4d..dabca3028 100755 --- a/grc/scripts/gnuradio-companion +++ b/grc/scripts/gnuradio-companion @@ -39,10 +39,19 @@ Is the library path environment variable set correctly? d.run() exit(-1) -from gnuradio import gr from optparse import OptionParser +import os if __name__ == "__main__": + if ('GR_DONT_LOAD_PREFS' in os.environ.keys() and + (not 'GRC_BLOCKS_PATH' in os.environ.keys() or len(os.environ['GRC_BLOCKS_PATH']) == 0)): + d = gtk.MessageDialog( + type=gtk.MESSAGE_ERROR, + buttons=gtk.BUTTONS_CLOSE, + message_format="""Can't find block definitions. Use config.conf or GRC_BLOCKS_PATH. """) + d.set_title("No block definitions available.") + d.run() + exit(-1) usage = 'usage: %prog [options] [saved flow graphs]' version = """ GNU Radio Companion %s -- cgit