There was a tidy way to insert code at certain formalized points in
the flow-graph setup, without having
to post-process the output of GRC.
For example, I want to setup a timeout function, that goes off once in a
while, to “do stuff”. But that’s
just an example.
We already have “variables” and “import” which have special semantics,
in terms of where they get placed
in the layout of the generated code.
Any thoughts been given to that?
–
Marcus L.
Principal Investigator
Shirleys Bay Radio Astronomy Consortium
It would be nice. Though you can get away without the ability to embed
custom functions. Actually, the import was the answer to that.
With the current framework, I usually suggest encapsulating logic into
python modules or hier2_blocks, that grc will call into. Post processing
the output is a bad idea.
Id love to see multi-line editable parameters. And to go with that a
function block of some sort. Howabout a block that imports arbitrary
python code from a file and writes it into the generated code? Although
thats only one step away from the above mentioned method.
Thanks,
-Josh
On 04/26/2010 09:05 PM, Josh B. wrote:
Although thats only one step away from the above mentioned method.
Thanks,
-Josh
Hmmmm, I spoze I could use an import of my own module, and then have a
variable
call an Init routine that starts the timer. Will have to cogitate.
I agree that a block that causes a wholesale copy is only slightly-less
bletchiferous than post-processing
the GRC generated code.
–
Marcus L.
Principal Investigator
Shirleys Bay Radio Astronomy Consortium
On 04/26/2010 09:05 PM, Josh B. wrote:
Although thats only one step away from the above mentioned method.
Thanks,
-Josh
Abandoned the timer idea.
My goal was to be able to save the values of the GUI parameters in a
file whenever they changed. But
realized that the GRC “engine” already has dependency graph logic
wired in. So I defined a variable,
that relied on the output of a “save the variables” function,
imported from a custom module. This
function takes flowgraph variables as parameters, and saves 'em.
The appropriate “set” functions within the flow-graph end up calling my
“saver” function, and when
the starter shell script comes up, it checks to see if there’s a
“saved variables” file, and if so,
passes those values on the command line to the python flowgraph. Easy
as pie.
Still would like to know what the “official” way to get an interval
timer is from a GRC flowgraph, though.
The gr.timer class doesn’t appear to have a corresponding python
class.
–
Marcus L.
Principal Investigator
Shirleys Bay Radio Astronomy Consortium
You should be able to do this very thing with the variable config block.
Provided that you like the format of conf files. -Josh