Great!
Thanks!
---- Replied Message ----
From | Jeff Long<willco...@gmail.com> |
Date | 1/6/2023 11:50 |
To | discuss-gnuradio@gnu.org<discuss-gnuradio@gnu.org> |
Subject | Re: change grc hier blocks root directory |
You can edit the embedded block code directly, and it may import other code.
As for including the same code multiple times, you would probably want to create a hier block (click on the block, type "c") from your embedded python block, then reuse it wherever you want.
On Thu, Jan 5, 2023 at 9:34 PM wieniawski <wieniaw...@outlook.com> wrote:
thx.I get understand the whole thing.Take https://wiki.gnuradio.org/index.php?title=Creating_Your_First_Block this for example.When I choose an editor to edit the epy_block, it is temporally saved in C:\User\[user name]\AppData\Local\Temp\epy_block_0_[some char].py. This file is temp file.The real descriptions will be copied to grc file:If I changed the temp file, the grc file changed correspondingly. (This is what you said "Embedded python blocks should go wherever the flowgraph goes").Even I remove the temp file, after I reopen the grc file, another new temp python will be opened(copied in temp directory) with the same code in grc. However, the temp python file's name changed, with suffixchanged. for example, from epy_block_0_n8bgjds3 to epy_block_0_usl3fla6, and I guess the suffix is a time stamp. Am I right?So1. I can edit the grc file's _source_code directly to update the python code(block code)?2. Is there any way that use a include way? take above as example, can I write like this in grc file:_source_code: "include epy_block.py" // or "import epy_block.py"or even better:_source_code: "include some_dir/my_own_name.py" // or "import some_dir/my_own_name.py"And I should make sure in some_dir, there is a file named my_own_name.py, which describes the block function.I know this definitely does not work. But I wish to.My aim is that:1. I only write python file one time.2. it can be instanced in grc block many times but maybe with different parameter input.3. grc only describes the interconnection of blocks and parameters, the real implement is in python file, and then I can use swig to import my C++ code, when I need to accelerate the simulation(calculation).Thanks a lot!
---- Replied Message ----
From Jeff Long<willco...@gmail.com> Date 1/5/2023 21:07 To GNURadio Discussion List<discuss-gnuradio@gnu.org> Subject Re: change grc hier blocks root directory Embedded python blocks should go wherever the flowgraph goes. The name can be set using ID in the GRC block.Please keep the discussion on the mailing list - thanks.On Wed, Jan 4, 2023 at 9:59 PM wieniawski <wieniaw...@outlook.com> wrote:thxGRC_HIER_PATH EnvVar works quite well!However, GRC_BLOCKS_PATH doesnot work.the python block file still generated under [user home]/AppData/Local/Temp/[python_block_name].py (in windows)And the [python_block_name] is named as epy_block_0_[some number].py, can I change both the directory and the name.I searched the grc file by epy_block:Which does not specify the epy_block name and directory. Where does these information specified?Thx.
---- Replied Message ----
From Jeff Long<willco...@gmail.com> Date 1/5/2023 06:55 To discuss-gnuradio@gnu.org<discuss-gnuradio@gnu.org> Subject Re: change grc hier blocks root directory Environment variables:GRC_HIER_PATH defaults to ~/.grc_gnuradioGRC_BLOCKS_PATH can be used to specify an additional pathOn Wed, Jan 4, 2023 at 8:00 AM wieniawski <wieniaw...@outlook.com> wrote: