Maybe "defaults" is not the correct word to describe what I am trying to 
accomplish.  The parameter values that pop up when you first drop the block 
down onto a flowgraph aren't necessarily important.  But once the user double 
clicks the block to open the properties dialog, I want them to be able to 
select from a drop down menu list of presets that will auto-fill the rest of 
the parameters according to which option was selected.  Note that I would like 
the user to still be able to change the values that were "auto-filled" 
previously, so they can enter a setup that deviates slightly from the preset 
without having to enter all of the parameters manually.

I can add all of the necessary info in the xml file.  I just don't know how to 
set the parameters to the proper values based on the selected option.  It seems 
like there should be some mechanism to do it because I can hide or show 
parameters based on the selected options (conditional statements seem to work 
inside of <hide> tags), so there must be some callback mechanism in place.  But 
no way to change the values of the parameters based on a selected option?

Mark
________________________________
From: Marcus D. Leech [mle...@ripnet.com]
Sent: Monday, June 20, 2016 3:49 PM
To: Mark Arlinghaus; discuss-gnuradio@gnu.org
Subject: Re: [Discuss-gnuradio] Load Preset parameters in block

On 06/20/2016 03:17 PM, Mark Arlinghaus wrote:
Hi Marcus,

Thank you for your quick response.  Sorry I wasn't clear.  I'm actually talking 
about GRC construction.  Once the code is running the parameters won't need to 
be changed.  If we need to change the parameters, stopping the flowgraph is 
acceptable.  It's really just meant to make the block slightly easier/faster to 
set up by the user.  I'm hoping that this makes the solution simpler!?

Mark
Defaults for block parameters in GRC are defined in the .xml description of the 
block, but there's no way to override what ever is in
  the .xml when you first instantiate a block in GRC.


________________________________
From: Discuss-gnuradio 
[discuss-gnuradio-bounces+marlinghaus=girdsystems....@gnu.org<redir.aspx?REF=xb5bwgEQ0OaiOKnheNAluV0bWS-B7jwqDcqHn5IH0hubltv4RpnTCAFtYWlsdG86ZGlzY3Vzcy1nbnVyYWRpby1ib3VuY2VzK21hcmxpbmdoYXVzPWdpcmRzeXN0ZW1zLmNvbUBnbnUub3Jn>]
 on behalf of Marcus D. Leech 
[mle...@ripnet.com<redir.aspx?REF=c0J3TQhf4sXryBXBs9IZlZAaR8Vobd4p5NnOeB1D76Kbltv4RpnTCAFtYWlsdG86bWxlZWNoQHJpcG5ldC5jb20.>]
Sent: Monday, June 20, 2016 3:09 PM
To: 
discuss-gnuradio@gnu.org<redir.aspx?REF=ooaOniZ1a9-YPnGqEeifPXhPG0V3TgDImLSr_aptjTabltv4RpnTCAFtYWlsdG86ZGlzY3Vzcy1nbnVyYWRpb0BnbnUub3Jn>
Subject: Re: [Discuss-gnuradio] Load Preset parameters in block

On 06/20/2016 02:15 PM, Mark Arlinghaus wrote:
Hello,

Is there a way to load preset default parameters in a block.  For example, I 
have a channel model block that takes several parameters, such as the doppler 
spread, path delays, path gains, doppler spectrum, etc., and I want to have 
presets that will auto-populate the parameters in the GRC block for pre-defined 
channel models.  I can make a drop-down menu that has the pre-defined channel 
models, but I don't know how to change the values that populate in the other 
parameters.  I would like to do this using the xml file.  Is there a way to put 
a conditional parameter in the <value> tags that would depend on the setting in 
the drop down menu (It seems conditionals can be used in the <hide> and 
<import> tags, but not inside the <value> tags)?  Is there a way to do it using 
the <opt> tags?  Is there a list of valid options and what they do anywhere?  
It seems the <opt> val:XXX <\opt> tags might do it, but I can't seem to get any 
of them to work.

Although I could pass in a preset parameter to the C++ function and simply 
override everything coming from the GUI, I'd rather have it populate the 
parameters in the block, but still let them be changed.  This way, if someone 
wanted to load the settings for a "Channel X" preset, except with a different 
Doppler spread, it could be done easily.

Note this is a similar problem as posted here:
https://lists.gnu.org/archive/html/discuss-gnuradio/2015-02/msg00016.html,<UrlBlockedError.aspx>
 but it doesn't appear the previous question was ever answered.

Thank you in advance for your help.

Mark Arlinghaus



_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org<UrlBlockedError.aspx>
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio<UrlBlockedError.aspx>


It's not clear whether you're talking about *runtime* or during GRC 
construction.

For runtime, I'd write a little Python module that contains a function for each 
parameter:

setter_function(configfilename, command-line-parameter, widget-control-value)

You then have logic in the function to determine the priority of what gets 
returned:

config-->command-line-->widget-control-value

I've done that in the past.



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

Reply via email to