]> git.gag.com Git - debian/gnuradio/commitdiff
Add a warning about flow control and throttle when the fg is generated.
authorjblum <jblum@221aa14e-8319-0410-a670-987f0aec2ac5>
Wed, 11 Mar 2009 19:07:31 +0000 (19:07 +0000)
committerjblum <jblum@221aa14e-8319-0410-a670-987f0aec2ac5>
Wed, 11 Mar 2009 19:07:31 +0000 (19:07 +0000)
Because who reads the wiki anyway.

git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10581 221aa14e-8319-0410-a670-987f0aec2ac5

grc/src/gui/Messages.py
grc/src/platforms/python/Generator.py

index e8e36f90f81c4edf66d0861f0a808c02f7519d12..e8939402d1db4950229d02ae2bbb0a476c8ac149 100644 (file)
@@ -99,3 +99,7 @@ def send_fail_load_preferences(prefs_file_path):
 
 def send_fail_save_preferences(prefs_file_path):
        send('>>> Error: Cannot save preferences file: "%s"\n'%prefs_file_path)
+
+################# functions for warning        ########################################
+def send_warning(warning):
+       send('>>> Warning: %s\n'%warning)
index 5d3a13872b41b989e03770fcdba5594e9fa552a6..83dd186c397b47dff1c6a51a3938b52b5d955abc 100644 (file)
@@ -26,6 +26,7 @@ from Constants import \
        HIER_BLOCKS_LIB_DIR, PYEXEC, \
        FLOW_GRAPH_TEMPLATE
 from utils import convert_hier
+from ... gui import Messages
 
 class Generator(object):
 
@@ -50,6 +51,12 @@ class Generator(object):
        def get_file_path(self): return self._file_path
 
        def write(self):
+               #do throttle warning
+               all_keys = ' '.join(map(lambda b: b.get_key(), self._flow_graph.get_enabled_blocks()))
+               if ('usrp' not in all_keys) and ('audio' not in all_keys) and ('throttle' not in all_keys):
+                       Messages.send_warning('''\
+This flow graph may not have flow control: no audio or usrp blocks found. \
+Add a Misc->Throttle block to your flow graph to avoid CPU congestion.''')
                #generate
                open(self.get_file_path(), 'w').write(str(self))
                if self._generate_options == 'hb':