[Top][All Lists]

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

Re: [Discuss-gnuradio] GRC Block XML Tags

From: Jordan Otomo
Subject: Re: [Discuss-gnuradio] GRC Block XML Tags
Date: Mon, 22 Aug 2011 10:32:29 -0700 (PDT)

Hi Josh,

Thanks for your help.  I don't encounter the mentioned error, as I renamed the 
copied file.  Oddly, the two *.xml files are generating different code.  The 
gnuradio project file (properly) generates:

self.variable_function_probe_0 = variable_function_probe_0 = 0

def _variable_function_probe_0_probe():
    while True:
        val = self.my_block_0.get_number()
        try: self.set_variable_function_probe_0(val)
        except AttributeError, e: pass
    _variable_function_probe_0_thread = 
    _variable_function_probe_0_thread.daemon = True

while the copied definition generates:

self.variable_function_probe_1 = def _variable_function_probe_1_probe():
    while True:
        val = self.my_block_0.get_number()
        try: self.set_variable_function_probe_1(val)
        except AttributeError, e: pass
    _variable_function_probe_1_thread = 
    _variable_function_probe_1_thread.daemon = True

The copied definition is clearly producing incorrect code, but I can't seem to 
figure out why.  All I did was copy and rename the *.xml and added:


Any further help would be greatly appreciated.


----- Original Message -----
From: "Josh Blum" <address@hidden>
To: address@hidden
Sent: Saturday, August 20, 2011 9:53:30 PM
Subject: Re: [Discuss-gnuradio] GRC Block XML Tags

On 08/19/2011 02:11 PM, Jordan Otomo wrote:
> Hi,
> I'm having issues creating a GRC block in an "out-of-tree-project"
> that will generate a few lines of python code and update a python
> variable (similar to the "variable_function_probe").  In my project,
> the <var_make> and <make> tags do not seem to behave as they do in
> the "variable_function_probe."  GRC does not appear to be recognizing
> <var_make>, and <make> generates "self.my_block_0 = " (as expected).
> Are there any limitations preventing me from using the <var_make>
> tag?  Also, how can I get <make> to not generate "self.my_block_0 = "
> as it does for the "variable_function_probe"?

GRC will recognize a block as a variable if it passes the regexp
"_variable_matcher = re.compile('^(variable\w*)$')", in other words, if
the key starts with the string "variable"

If grc recognizes the block as a variable, it will eval the var_make,
#for $var in $variables
#end for

> I've tried copying 'variable_function_probe.xml' and 'variable.xml'
> into my project and they do not behave as they do when they're in the
> gnuradio directory.  Thus, I'm wondering if I need to designate my
> block as being a special "Variable" type block.  Any help would be
> greatly appreciated.

There is nothing special about the directory an xml file is in. As long
as grc is told to import it. If you actually copied the file and it was
imported twice, grc would print an error



Discuss-gnuradio mailing list

reply via email to

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