commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 01/01: grc: allow function probe with empty


From: git
Subject: [Commit-gnuradio] [gnuradio] 01/01: grc: allow function probe with empty Block ID
Date: Fri, 9 May 2014 22:28:41 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

jcorgan pushed a commit to branch maint
in repository gnuradio.

commit e6325686ea337ff9e2fb9b6a57cf79a740cd9ce0
Author: Sebastian Koslowski <address@hidden>
Date:   Wed May 7 16:48:47 2014 -0700

    grc: allow function probe with empty Block ID
---
 grc/blocks/variable_function_probe.xml | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/grc/blocks/variable_function_probe.xml 
b/grc/blocks/variable_function_probe.xml
index 269966c..baa996c 100644
--- a/grc/blocks/variable_function_probe.xml
+++ b/grc/blocks/variable_function_probe.xml
@@ -12,11 +12,14 @@
        <var_make>self.$(id) = $(id) = $value</var_make>
        <make>#slurp
 def _$(id)_probe():
-       while True:
-               val = self.$(block_id()).$(function_name())($(function_args()))
-               try: self.set_$(id)(val)
-               except AttributeError, e: pass
-               time.sleep(1.0/($poll_rate))
+    while True:
+        #set $obj = 'self' + ('.' + $block_id() if $block_id() else '')
+        val = $(obj).$(function_name())($(function_args()))
+        try:
+            self.set_$(id)(val)
+        except AttributeError:
+            pass
+        time.sleep(1.0 / ($poll_rate))
 _$(id)_thread = threading.Thread(target=_$(id)_probe)
 _$(id)_thread.daemon = True
 _$(id)_thread.start()</make>
@@ -57,13 +60,16 @@ Periodically probe a function and set its value to this 
variable.
 
 Set the values for block ID, function name, and function args appropriately: \
 Block ID should be the ID of another block in this flow graph. \
+An empty Block ID references the flow graph itself. \
 Function name should be the name of a class method on that block. \
 Function args are the parameters passed into that function. \
 For a function with no arguments, leave function args blank. \
 When passing a string for the function arguments, quote the string literal: 
'"arg"'.
 
 The values will used literally, and generated into the following form:
-self.block_id.function_name(function_args)
+    self.block_id.function_name(function_args)
+or, if the Block ID is empty,
+    self.function_name(function_args)
 
 To poll a stream for a level, use this with the probe signal block.
        </doc>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]