[Python4Capella] Customize contextual menu items

Is it possible to customize contextual menu items in Python4Capella?

Right after installing Python4Capella and configuring as recommended in the documentation, the contextual menu displays additional options for calling python scripts (such as the ones in the sceenshot below).

Some of these scripts change the model without ‘undo’ capability which is a problem when someone misclicks on that option. (e.g.: To reverse the “rename logical functions” option I have to open the .capella file and rename all functions).

I wanted to be able to either remove or move these options into a submenu.

Not possible at the moment to my knowledge, but I would recommend:

  • removing the sample scripts from the Python4Capella folder if you’re deploying this in production
  • When adding new scripts, you can contextualize them depending on which model elements you want them to execute on
1 Like

Thank Stephane! That works very well! I created a “inactive_scripts” folder just to move the ones I didn’t want active for now.

I was so annoyed I was reluctant of adding Python4Capella on my latest Capella installation.

This accidental renaming happened a number of times…

1 Like