diff options
Diffstat (limited to 'grc/src')
-rw-r--r-- | grc/src/gui/Messages.py | 4 | ||||
-rw-r--r-- | grc/src/platforms/python/Generator.py | 7 |
2 files changed, 11 insertions, 0 deletions
diff --git a/grc/src/gui/Messages.py b/grc/src/gui/Messages.py index e8e36f90f..e8939402d 100644 --- a/grc/src/gui/Messages.py +++ b/grc/src/gui/Messages.py @@ -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) diff --git a/grc/src/platforms/python/Generator.py b/grc/src/platforms/python/Generator.py index 5d3a13872..83dd186c3 100644 --- a/grc/src/platforms/python/Generator.py +++ b/grc/src/platforms/python/Generator.py @@ -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': |