[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 03/10: grc: add <flags> to blocks dtd (<thr
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 03/10: grc: add <flags> to blocks dtd (<throttle> still supported) |
Date: |
Sun, 14 Jun 2015 16:34:15 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 80272df0bd29c02e7d677062431ba0ae4e07ed60
Author: Sebastian Koslowski <address@hidden>
Date: Thu Apr 9 20:44:59 2015 +0200
grc: add <flags> to blocks dtd (<throttle> still supported)
---
gr-audio/grc/audio_sink.xml | 2 +-
gr-audio/grc/audio_source.xml | 2 +-
gr-blocks/grc/blocks_throttle.xml | 2 +-
gr-blocks/grc/blocks_udp_source.xml | 2 +-
gr-fcd/grc/fcd_source_c.xml | 2 +-
gr-uhd/grc/gen_uhd_usrp_blocks.py | 2 +-
grc/base/Block.py | 18 ++++++++++++++++--
grc/base/Constants.py | 2 ++
grc/python/Block.py | 3 ---
grc/python/block.dtd | 5 ++++-
10 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/gr-audio/grc/audio_sink.xml b/gr-audio/grc/audio_sink.xml
index 9a70006..727767b 100644
--- a/gr-audio/grc/audio_sink.xml
+++ b/gr-audio/grc/audio_sink.xml
@@ -8,7 +8,7 @@
<name>Audio Sink</name>
<key>audio_sink</key>
<category>Audio</category>
- <throttle>1</throttle>
+ <flags>throttle</flags>
<import>from gnuradio import audio</import>
<make>audio.sink($samp_rate, $device_name, $ok_to_block)</make>
<param>
diff --git a/gr-audio/grc/audio_source.xml b/gr-audio/grc/audio_source.xml
index 0cb73a3..aaa3225 100644
--- a/gr-audio/grc/audio_source.xml
+++ b/gr-audio/grc/audio_source.xml
@@ -8,7 +8,7 @@
<name>Audio Source</name>
<key>audio_source</key>
<category>Audio</category>
- <throttle>1</throttle>
+ <flags>throttle</flags>
<import>from gnuradio import audio</import>
<make>audio.source($samp_rate, $device_name, $ok_to_block)</make>
<param>
diff --git a/gr-blocks/grc/blocks_throttle.xml
b/gr-blocks/grc/blocks_throttle.xml
index 790e195..26f4aa7 100644
--- a/gr-blocks/grc/blocks_throttle.xml
+++ b/gr-blocks/grc/blocks_throttle.xml
@@ -7,7 +7,7 @@
<block>
<name>Throttle</name>
<key>blocks_throttle</key>
- <throttle>1</throttle>
+ <flags>throttle</flags>
<import>from gnuradio import blocks</import>
<make>blocks.throttle($type.size*$vlen,
$samples_per_second,$ignoretag)</make>
<callback>set_sample_rate($samples_per_second)</callback>
diff --git a/gr-blocks/grc/blocks_udp_source.xml
b/gr-blocks/grc/blocks_udp_source.xml
index 3b434c1..03dbb57 100644
--- a/gr-blocks/grc/blocks_udp_source.xml
+++ b/gr-blocks/grc/blocks_udp_source.xml
@@ -7,7 +7,7 @@
<block>
<name>UDP Source</name>
<key>blocks_udp_source</key>
- <throttle>1</throttle>
+ <flags>throttle</flags>
<import>from gnuradio import blocks</import>
<make>blocks.udp_source($type.size*$vlen, $ipaddr, $port, $psize,
$eof)</make>
<callback>set_mtu($mtu)</callback>
diff --git a/gr-fcd/grc/fcd_source_c.xml b/gr-fcd/grc/fcd_source_c.xml
index b514c61..01ea26d 100644
--- a/gr-fcd/grc/fcd_source_c.xml
+++ b/gr-fcd/grc/fcd_source_c.xml
@@ -3,7 +3,7 @@
<name>Funcube Dongle Source</name>
<key>fcd_source_c</key>
<category>FCD</category>
- <throttle>1</throttle>
+ <flags>throttle</flags>
<import>from gnuradio import fcd</import>
<make>fcd.source_c($device_name)
#if $lna() != 20.0
diff --git a/gr-uhd/grc/gen_uhd_usrp_blocks.py
b/gr-uhd/grc/gen_uhd_usrp_blocks.py
index fda1b9d..72f1b50 100644
--- a/gr-uhd/grc/gen_uhd_usrp_blocks.py
+++ b/gr-uhd/grc/gen_uhd_usrp_blocks.py
@@ -23,7 +23,7 @@ MAIN_TMPL = """\
<block>
<name>UHD: USRP $sourk.title()</name>
<key>uhd_usrp_$(sourk)</key>
- <throttle>1</throttle>
+ <flags>throttle</flags>
<import>from gnuradio import uhd</import>
<import>import time</import>
<make>uhd.usrp_$(sourk)(
diff --git a/grc/base/Block.py b/grc/base/Block.py
index b367e60..d2d7ebf 100644
--- a/grc/base/Block.py
+++ b/grc/base/Block.py
@@ -18,13 +18,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA
"""
from . import odict
-from . Constants import ADVANCED_PARAM_TAB, DEFAULT_PARAM_TAB
+from . Constants import ADVANCED_PARAM_TAB, DEFAULT_PARAM_TAB,
BLOCK_FLAG_THROTTLE
from Element import Element
from Cheetah.Template import Template
from UserDict import UserDict
from itertools import imap
+from .. gui import Messages
+
+
class TemplateArg(UserDict):
"""
A cheetah template argument created from a param.
@@ -46,11 +49,16 @@ class TemplateArg(UserDict):
def __call__(self):
return self._param.get_evaluated()
-def _get_keys(lst): return [elem.get_key() for elem in lst]
+
+def _get_keys(lst):
+ return [elem.get_key() for elem in lst]
+
+
def _get_elem(lst, key):
try: return lst[_get_keys(lst).index(key)]
except ValueError: raise ValueError, 'Key "%s" not found in %s.'%(key,
_get_keys(lst))
+
class Block(Element):
def __init__(self, flow_graph, n):
@@ -73,6 +81,9 @@ class Block(Element):
self._name = n.find('name')
self._key = n.find('key')
self._category = n.find('category') or ''
+ self._flags = n.find('flags') or ''
+ if n.find('throttle') and BLOCK_FLAG_THROTTLE not in self._flags: #
backwards-compatibility
+ self._flags += BLOCK_FLAG_THROTTLE
self._grc_source = n.find('grc_source') or ''
self._block_wrapper_path = n.find('block_wrapper_path')
self._bussify_sink = n.find('bus_sink')
@@ -240,6 +251,9 @@ class Block(Element):
def get_block_wrapper_path(self): return self._block_wrapper_path
def get_comment(self): return self.get_param('comment').get_value()
+ def get_flags(self): return self._flags
+ def throttle(self): return "throttle" in self._flags
+
##############################################
# Access Params
##############################################
diff --git a/grc/base/Constants.py b/grc/base/Constants.py
index efae0ec..7949708 100644
--- a/grc/base/Constants.py
+++ b/grc/base/Constants.py
@@ -38,3 +38,5 @@ DOMAIN_DTD = os.path.join(DATA_DIR, 'domain.dtd')
GR_STREAM_DOMAIN = "gr_stream"
GR_MESSAGE_DOMAIN = "gr_message"
DEFAULT_DOMAIN = GR_STREAM_DOMAIN
+
+BLOCK_FLAG_THROTTLE = 'throttle'
diff --git a/grc/python/Block.py b/grc/python/Block.py
index 191b03b..5d52e2b 100644
--- a/grc/python/Block.py
+++ b/grc/python/Block.py
@@ -52,7 +52,6 @@ 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 ''
self._bus_structure_source = n.find('bus_structure_source') or ''
self._bus_structure_sink = n.find('bus_structure_sink') or ''
#build the block
@@ -78,8 +77,6 @@ class Block(_Block, _GUIBlock):
except: return ''
- def throttle(self): return bool(self._throttle)
-
def validate(self):
"""
Validate this block.
diff --git a/grc/python/block.dtd b/grc/python/block.dtd
index 8cfd3dd..145f4d8 100644
--- a/grc/python/block.dtd
+++ b/grc/python/block.dtd
@@ -25,7 +25,9 @@ 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?, throttle?, import*, var_make?,
var_value?, make, callback*, param_tab_order?, param*, bus_sink?, bus_source?,
check*, sink*, source*, bus_structure_sink?, bus_structure_source?, doc?,
grc_source?)>
+<!ELEMENT block (name, key, category?, throttle?, flags?, import*, var_make?,
var_value?,
+ make, callback*, param_tab_order?, param*, bus_sink?, bus_source?,
check*,
+ sink*, source*, bus_structure_sink?, bus_structure_source?, doc?,
grc_source?)>
<!--
Sub level elements.
-->
@@ -64,3 +66,4 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA
<!ELEMENT callback (#PCDATA)>
<!ELEMENT optional (#PCDATA)>
<!ELEMENT throttle (#PCDATA)>
+<!ELEMENT flags (#PCDATA)>
- [Commit-gnuradio] [gnuradio] branch master updated (1dc65e1 -> 7ee2f91), git, 2015/06/14
- [Commit-gnuradio] [gnuradio] 06/10: Merge remote-tracking branch 'skoslowski/top_block_wait', git, 2015/06/14
- [Commit-gnuradio] [gnuradio] 09/10: Merge branch 'maint', git, 2015/06/14
- [Commit-gnuradio] [gnuradio] 01/10: runtime: add flag to wrapped top_block to control SIGINT handling in wait(), git, 2015/06/14
- [Commit-gnuradio] [gnuradio] 08/10: Merge remote-tracking branch 'mbr0wn/uhd/gpios', git, 2015/06/14
- [Commit-gnuradio] [gnuradio] 07/10: Merge remote-tracking branch 'drmpeg/dtv-coverity-cleanup', git, 2015/06/14
- [Commit-gnuradio] [gnuradio] 05/10: uhd: Expose GPIO functions through SWIG, git, 2015/06/14
- [Commit-gnuradio] [gnuradio] 10/10: Merge remote-tracking branch 'gnuradio-wg-grc/master_grcwg', git, 2015/06/14
- [Commit-gnuradio] [gnuradio] 03/10: grc: add <flags> to blocks dtd (<throttle> still supported),
git <=
- [Commit-gnuradio] [gnuradio] 04/10: grc: Added ability to bypass blocks (Suggested by Chris Headley)., git, 2015/06/14
- [Commit-gnuradio] [gnuradio] 02/10: gr-dtv: Clean up minor Coverity Scan issues., git, 2015/06/14