2317: Prompt user to restart when preferences change#2381
Conversation
…re restart are changed
… shows each message a single time
rozyczko
left a comment
There was a problem hiding this comment.
Works fine, except of one potential issue mentioned.
This is, however, just a mild nuisance for users and can be made into a separate issue.
| widget.restoreDefaults() | ||
|
|
||
| def stageSingleChange(self, key, value): | ||
| def stageSingleChange(self, key: str, value: ConfigType, config_restart_message: Optional[str] = ""): |
There was a problem hiding this comment.
There is no unstaging taking place on option change.
This means when I click twice on Automatic Scale Factor checkbox, I still get prompted to restart even though the preferences haven't changed.
There was a problem hiding this comment.
yeah, need to check if anything has actually changed at some point.
| msgBox.show() | ||
| if msgBox.exec() == QMessageBox.Yes: | ||
| self.parent.guiManager.quitApplication() | ||
| os.execl(sys.executable, os.path.abspath(__file__), *sys.argv) |
There was a problem hiding this comment.
Interestingly, this works fine in the installed version, despite __file__ pointing to relative location of sasview.exe in pyinstaller generated setups.
If you open the python shell in the installed version, the __file__ attribute is not even defined.
I would probably use sys.executable instead of os.path.abspath(__file__), since in the installed version it points to location of the exe file (without the need to expand the path with abspath) and in the dev build, it points to python.exe, with sys.argv containing run.py and other arguments.
But since this is working as is, I wouldn't put too much importance in the abve.
|
One more issue - when the scaling value is empty, the parser throws: Hitting OK with empty line text doesn't trigger the warning and resets the value to default |
Ticketed in #2389 |

Description
This PR prompts the user to restart SasView if changes are made that only take effect at the next startup of SasView.
NOTE This PR is currently chained off 2313-save-on-ok. Once #2358 is merged, I will rebase this to
main.Fixes #2317
How Has This Been Tested?
Run SasView, open the preferences window and change one of the display parameters that require a restart.
Review Checklist (please remove items if they don't apply):