diff options
Diffstat (limited to 'grc')
-rw-r--r-- | grc/blocks/block_tree.xml | 1 | ||||
-rw-r--r-- | grc/blocks/gr_random_pdu.xml | 35 | ||||
-rw-r--r-- | grc/blocks/gr_throttle.xml | 1 | ||||
-rw-r--r-- | grc/gui/MainWindow.py | 3 | ||||
-rwxr-xr-x | grc/scripts/gnuradio-companion | 11 |
5 files changed, 50 insertions, 1 deletions
diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml index 183883959..dcd6c5448 100644 --- a/grc/blocks/block_tree.xml +++ b/grc/blocks/block_tree.xml @@ -45,6 +45,7 @@ <block>gr_tagged_stream_to_pdu</block> <block>gr_tuntap_pdu</block> <block>gr_socket_pdu</block> + <block>gr_random_pdu</block> </cat> <cat> <name>Operators</name> diff --git a/grc/blocks/gr_random_pdu.xml b/grc/blocks/gr_random_pdu.xml new file mode 100644 index 000000000..ed5a79a92 --- /dev/null +++ b/grc/blocks/gr_random_pdu.xml @@ -0,0 +1,35 @@ +<?xml version="1.0"?> +<!-- +################################################### +## Random PDU +################################################### + --> +<block> + <name>Random PDU Generator</name> + <key>gr_random_pdu</key> + <import>from gnuradio import gr</import> + <import>from gruel import pmt</import> + <make>gr.random_pdu($minsize, $maxsize)</make> + <param> + <name>Min Bytes</name> + <key>minsize</key> + <value>50</value> + <type>int</type> + </param> + <param> + <name>Max Bytes</name> + <key>maxsize</key> + <value>2000</value> + <type>int</type> + </param> + <sink> + <name>generate</name> + <type>message</type> + <optional>1</optional> + </sink> + <source> + <name>pdus</name> + <type>message</type> + <optional>1</optional> + </source> +</block> diff --git a/grc/blocks/gr_throttle.xml b/grc/blocks/gr_throttle.xml index dc825f167..e3a5a2ba1 100644 --- a/grc/blocks/gr_throttle.xml +++ b/grc/blocks/gr_throttle.xml @@ -10,6 +10,7 @@ <throttle>1</throttle> <import>from gnuradio import gr</import> <make>gr.throttle($type.size*$vlen, $samples_per_second)</make> + <callback>set_sample_rate($samples_per_second)</callback> <param> <name>Type</name> <key>type</key> diff --git a/grc/gui/MainWindow.py b/grc/gui/MainWindow.py index 37a100c94..1dc02dabb 100644 --- a/grc/gui/MainWindow.py +++ b/grc/gui/MainWindow.py @@ -180,6 +180,9 @@ class MainWindow(gtk.Window): if file_path: Messages.send_end_load() except Exception, e: #return on failure Messages.send_fail_load(e) + if isinstance(e, KeyError) and str(e) == "'options'": + # This error is unrecoverable, so crash gracefully + exit(-1) return #add this page to the notebook self.notebook.append_page(page, page.get_tab()) 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 |