Reload and Test deletes data

Is there a way to recover data that is removed when one clicks on the “Reload and Test” button on some modules? I have accidentally pressed this button once or twice recently on different modules and it is frustrating to have my data wiped from the scene. Thanks!

An example functionality that might be useful for preventing this might be an option in the application settings (next to “Confirm on Restart” checkbox, for example) that is enabled by default that ensures the user actually wants to reload and test, and warns that it will delete the scene’s data

The Reload and Test feature is exposed only in developer mode and is meant to quickly test new code from a fresh start. If others agree, I would be okay a confirmation dialog before closing the scene. It would be just a small change to the ScriptedLoadableModuleWidget base class.

1 Like

That would certainly help me prevent accidentally closing the scene–thanks!

Would you be able to draft a PR?

I can certainly give it a try, but I have never done so before. Is there a tutorial for this I can follow?

Nevermind, found it here: Contributing to Slicer — 3D Slicer documentation. I’ll let you know if I am able to figure this out in a timely manner. Thanks again.

Yes, exactly. You can search in the repository for the onReloadAndTest method and consider options to add a dialog (probably a ctkMessageBox).