I’m writing an extension and I would like that it automatically links the slice views. I know I can add it to .slicerrc.py, and this works, however, I wouldn’t want to ‘ship’ a custom .slicerrc.py together with my extension.
I tried to take the code from Set all slice views linked by default, put it in a function linkViews() in my MyExtension.py and add it to the the __init__() of class MyExtension(ScriptedLoadableModule) similarily to the sample data: slicer.app.connect("startupCompleted()", linkViews)
However, this doesn’t work - it doesn’t throw any error - the code gets executed (if I add a print() it prints to the console) but the views remain unlinked.
This is probably a timing issue - the startupCompleted signal comes after the windows already exist, while the slicerrc.py is processed during command line processing where the windows must not have been set up yet.
Can you try calling linkViews directly in the __init__()?