discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Pass boolean parameter to gnuradio script from co


From: George Vardakis
Subject: Re: [Discuss-gnuradio] Pass boolean parameter to gnuradio script from command line
Date: Tue, 18 Jul 2017 13:10:42 +0300

Thank you Marcus I'll give it a try :) 

Στις 18 Ιουλ 2017 12:05 μ.μ., ο χρήστης "Marcus Müller" <address@hidden> έγραψε:

Hi George,

you could go into gnuradio/grc/blocks, change parameter.xml to have

		<option>
			<name>Boolean</name>
			<key>bool</key>
			<opt>type:bool</opt>
		</option>

and then change grc/core/generator/flow_graph.tmpl and in the

    #for $param in $parameters

loop add an if type == "bool": clause that adds a binary option (something with ..action="" see [1]). great chance to contribute :) .

Alternatively, just use an int parameter, and use bool(parameter_id) whereever you need a true or false. You'll have to pass 0 for False, and any other int for True, then.

Best regards,

Marcus

[1] https://docs.python.org/2/library/optparse.html#standard-option-actions


On 18.07.2017 10:40, George Vardakis wrote:
Hi all!

I need to give the user the option to pass a boolean parameter when executing my script from command line, something like '--split-image=True', where split_image is a parameter of a block. What is the way to do that from gnuradio without needing to translate inside my code the 'True' string to the boolean True? The 'parameter' block in gnuradio does not support boolean type as i saw...

Thank you!


_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


reply via email to

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