Magic Header Stopped working

So I Had this header working previously but it got annoying when I was testing new scripts to create elements so I changed “onResourceChange” to “PAUSEonResourceChange” so it wouldn’t run. Now I’m trying to turn it back on and after changing the header Above image the header isn’t running. It also doesn’t run with “onSave”. Any solutions would be appreciated. I will continue trial and error till I figure this out.

I just deleted my P4C package and installed it again and see that none of the Magic headered scripts are appearing as a pop-up. Is there a way to turn on and off this ability??

Hi,

I had never tried the onSave in the magic header. I gave it a try, but without any success. Maybe something is missing in the implementation. Can you open an issue on the Python4Capella issue tracking system ?

About the scripts not appearing did you properly setup the scripts locations in the preferences ?

Regards,
Arnaud

It’s not just for onSave, it also doesn’t work for onResourceChange. I remember you helping me out with setting up onResourceChange on another form post.


This is the script.


This is the scripting locations
Would you like to see my workspace and test it on your Capella installation?

Headers are handled by EASE and there containing folder need to be accessible via Script locations. Do you have an error when saving/changing the Capella resource ? If you change the header to a menu header does the menu appears in the project explorer ?

I also think the onResourceChange should be the file extension:

onResourceChange: *.capella

And the argv[0] should be used to check the name of the changed resource.

I tried it with, pop-up and it works. I have the scripting location set to the correct folder and made sure that the script wasn’t hidden in another folder inside the scripting location, still nothing. I just tried <onResourceChange: *.capella >, nothing. Also tried <workspace://In-Flight Entertainment System*.capella> and still nothing.

I was able to make it works with the followinf magic header:

# onResourceChange     : *.txt
# script-type          : Python

I think the order of the properties is important to EASE. I also tried with an absolute workspace path workspace://Python4Capella/toto.txt and it worked as well.

onSave also work this way:

# onSave               : *.txt
# script-type          : Python

So I got onSave working. The ordering of properties didn’t have an effect, but I changed the resource it was looking at from <.capella> to <.aird>. Like you said, having the full address or just the asterisk with the following extension worked, but I did have problem getting certain projects to work with this. With projects with spaces in the name I would have to use <*.aird>. Still looking for a way to get onResourceChange to work with changes that occur with the project.

Yes semantic changes to the Capella model are saved in the .capella model but graphical changes are saved in the .aird model.

Well I tried a few weeks back by adding and deleting a new element I add to the project and it worked for both onSave and onResourceChange using .capella and it worked. I haven’t tested this on changes on diagram.

Also tried printing argv[0] and get returned index out of range so I’m not sure if onSave returns the item that was saved as an argument.