summaryrefslogtreecommitdiff
path: root/grc/python
diff options
context:
space:
mode:
Diffstat (limited to 'grc/python')
-rw-r--r--grc/python/Block.py3
-rw-r--r--grc/python/CMakeLists.txt45
-rw-r--r--grc/python/Generator.py4
-rw-r--r--grc/python/block.dtd3
-rw-r--r--grc/python/extract_docs.py4
5 files changed, 55 insertions, 4 deletions
diff --git a/grc/python/Block.py b/grc/python/Block.py
index 4baf36dc6..967a27ce9 100644
--- a/grc/python/Block.py
+++ b/grc/python/Block.py
@@ -46,6 +46,7 @@ class Block(_Block, _GUIBlock):
self._var_make = n.find('var_make')
self._checks = n.findall('check')
self._callbacks = n.findall('callback')
+ self._throttle = n.find('throttle') or ''
#build the block
_Block.__init__(
self,
@@ -54,6 +55,8 @@ class Block(_Block, _GUIBlock):
)
_GUIBlock.__init__(self)
+ def throttle(self): return bool(self._throttle)
+
def validate(self):
"""
Validate this block.
diff --git a/grc/python/CMakeLists.txt b/grc/python/CMakeLists.txt
new file mode 100644
index 000000000..2075d126d
--- /dev/null
+++ b/grc/python/CMakeLists.txt
@@ -0,0 +1,45 @@
+# 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(FILES
+ convert_hier.py
+ expr_utils.py
+ extract_category.py
+ extract_docs.py
+ Block.py
+ Connection.py
+ Constants.py
+ FlowGraph.py
+ Generator.py
+ Param.py
+ Platform.py
+ Port.py
+ __init__.py
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/python
+ COMPONENT "grc"
+)
+
+install(FILES
+ block.dtd
+ default_flow_graph.grc
+ flow_graph.tmpl
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/python
+ COMPONENT "grc"
+)
diff --git a/grc/python/Generator.py b/grc/python/Generator.py
index 2a2dfdd49..2a6fe51d5 100644
--- a/grc/python/Generator.py
+++ b/grc/python/Generator.py
@@ -57,8 +57,8 @@ class Generator(object):
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 ('uhd' not in all_keys) and ('audio' not in all_keys) and ('throttle' not in all_keys) and self._generate_options != 'hb':
+ throttled = any(map(lambda b: b.throttle(), self._flow_graph.get_enabled_blocks()))
+ if not throttled and self._generate_options != 'hb':
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.''')
diff --git a/grc/python/block.dtd b/grc/python/block.dtd
index 7c6c39811..41a744d07 100644
--- a/grc/python/block.dtd
+++ b/grc/python/block.dtd
@@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Top level element.
A block contains a name, ...parameters list, and list of IO ports.
-->
-<!ELEMENT block (name, key, category?, import*, var_make?, make, callback*, param*, check*, sink*, source*, doc?)>
+<!ELEMENT block (name, key, category?, throttle?, import*, var_make?, make, callback*, param*, check*, sink*, source*, doc?)>
<!--
Sub level elements.
-->
@@ -53,3 +53,4 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
<!ELEMENT value (#PCDATA)>
<!ELEMENT callback (#PCDATA)>
<!ELEMENT optional (#PCDATA)>
+<!ELEMENT throttle (#PCDATA)>
diff --git a/grc/python/extract_docs.py b/grc/python/extract_docs.py
index aa85397f9..fe157a221 100644
--- a/grc/python/extract_docs.py
+++ b/grc/python/extract_docs.py
@@ -26,6 +26,8 @@ DOXYGEN_NAME_XPATH = '/doxygen/compounddef/compoundname'
DOXYGEN_BRIEFDESC_GR_XPATH = '/doxygen/compounddef/briefdescription'
DOXYGEN_DETAILDESC_GR_XPATH = '/doxygen/compounddef/detaileddescription'
+GROUP_KEYS = "gr|trellis|noaa|vocoder|digital"
+
def extract_txt(xml):
"""
Recursivly pull the text out of an xml tree.
@@ -63,7 +65,7 @@ def _extract(key):
#extract descriptions
comp_name = extract_txt(xml.xpath(DOXYGEN_NAME_XPATH)[0]).strip()
comp_name = ' --- ' + comp_name + ' --- '
- if re.match('(gr|usrp2|trellis|noaa)_.*', key):
+ if re.match(('(%s)_.*' % GROUP_KEYS), key):
brief_desc = extract_txt(xml.xpath(DOXYGEN_BRIEFDESC_GR_XPATH)[0]).strip()
detailed_desc = extract_txt(xml.xpath(DOXYGEN_DETAILDESC_GR_XPATH)[0]).strip()
else: