Ticket #10015 (closed: fixed)
Implement a reset to factory defaults mechanism
Reported by: | Martyn Gigg | Owned by: | Dan Nixon |
---|---|---|---|
Priority: | major | Milestone: | Release 3.3 |
Component: | GUI | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | #8912 | Tester: | Peter Peterson |
Description
Occasionally errors occur that require purging user settings. The settings themselves have two sources:
- Mantid.user.properties - framework
- MantidPlot Qt saved settings - GUI
The framework settings can be cleared by simply removing the user.properties file but the Mantid-related Qt settings are in different places on different platforms. On Windows the settings are stored in the registry, which makes it hazardous to ask a user to remove them.
We should implement functionality to essentially reset Mantid to "factory defaults". This will require 2 levels:
- resetting the ConfigService for the framework settings and
- clearing the Mantid-related Qt settings.
The simplest way to do this is probably to have a standalone script that can run to perform the reset. A batch script on windows/shell script on Linux that then calls a python script to do the reset.
Change History
comment:1 Changed 6 years ago by Nick Draper
- Status changed from new to assigned
- Owner set to Dan Nixon
- Milestone set to Release 3.3
comment:2 Changed 6 years ago by Dan Nixon
- Status changed from assigned to inprogress
Added Python script to modify Qt properties
Need to test on Mac and Windows
Refs #10015
Changeset: a498e3ccbe6e62c187e34dbfd94bc5a4cf2147fa
comment:3 Changed 6 years ago by Dan Nixon
Added reset bash script for Unix systems
Needs tested on Mac
Refs #10015
Changeset: d298c277dc4a5f037d7395f122c8020ad7c6a197
comment:4 Changed 6 years ago by Martyn Gigg
This looks good so far but I have a couple of comments.
We still need to support RHEL6, which only has Python 2.6 and argparse module. It is probably most sensible to implement a get_arguments() function that uses argparse if it is available but falls back to optparse if not.
My other more minor comment is that we don't include author/date information in the header info (we can get this from git) and in fact the copyright should be there instead. Could you replace the header in the shell script with:
Copyright © 2007-2014 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory This file is part of Mantid. Mantid is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. Mantid is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. File change history is stored at: <https://github.com/mantidproject/mantid>. Code Documentation is available at: <http://doxygen.mantidproject.org>
comment:5 Changed 6 years ago by Martyn Gigg
Another few comments for the Windows scripts:
- the user properties file is not in the HOME directory, it is alongside the executable;
- it can't just call python like the Unix version can as we need to make sure we call the Python that we bundle with Mantid.
If we put the reset scripts in the bin directory then those two things should be covered.
comment:6 Changed 6 years ago by Dan Nixon
Added license, added fallback to optparse
Refs #10015
Changeset: a606a08258b2e183579573bcb644f506cb4b22f0
comment:7 Changed 6 years ago by Dan Nixon
Still needs tested/fixed for Python 2.6 but added fallback to optparse.
comment:8 Changed 6 years ago by Dan Nixon
Fixed formatting to be Python3 compatible
Refs #10015
Changeset: 1158605194910bf25b8407180fb653381fb41478
comment:9 Changed 6 years ago by Dan Nixon
Install reset scripts alongside executable
Refs #10015
Changeset: 741c785ac3a1393eec6316963cffa406fd6fd75a
comment:10 Changed 6 years ago by Martyn Gigg
This looks like its going in the right direction but just a couple of additional points:
- The "file ( COPY" command will only cover the development build and doesn't do anything with the script for the packages. Have a look at the "installation settings" section at the bottom of the file for how to use the "install" cmake command to get the scripts in the package.
- I also think we should just call the shell scripts "reset_settings.sh" and "reset_settings.bat" as each platform will only ever see one and the different extensions already indicated the differences.
comment:11 Changed 6 years ago by Dan Nixon
Fix CMakeLists to install reset scripts properly
Refs #10015
Changeset: 8e07fcac3f9fafb1d49e204fb820843b0e438266
comment:12 Changed 6 years ago by Dan Nixon
comment:13 Changed 6 years ago by Dan Nixon
- Status changed from inprogress to verify
- Resolution set to fixed
To test:
- Build Mantid
- Open and change some of the default settings (selecting a default instrument and changing the window size should be sufficient)
- Run the reset script for your platform, it should be in the bin or bin/CONFIG folder
- Verify that both Mantid (prompted to select default instrument once more) and Qt settings (window defaults to fullscreen) are reset
- Install Mantid and verify thet the reset_settings and qt_settings_editor files are installed in the same directory as the executable.
This should be tested on Windows, Mac and Linux.
comment:14 Changed 6 years ago by Martyn Gigg
- Status changed from verify to reopened
- Resolution fixed deleted
Something I just spotted in windows is that the reset_settings.bat is in the wrong directory for a build. On Windows/XCode the build configuration is specified by Visual Studio/XCode and not by CMake so there is an extra subdirectory under bin that contains the configuration, i.e.
bin/Debug bin/Release
At the moment the reset_settings is ending up in bin and not bin/CONFIG. The qt_settings.py does seem to have gone to the correct directory though.
comment:15 Changed 6 years ago by Dan Nixon
- Status changed from reopened to inprogress
COpy reset script to build config dir
Refs #10015
Changeset: 4702dc90354e7dfe41f0e7de6c72c8b3bfd9020c
comment:16 Changed 6 years ago by Dan Nixon
- Status changed from inprogress to verify
- Resolution set to fixed
comment:17 Changed 6 years ago by Karl Palmen
- Status changed from verify to verifying
- Tester set to Karl Palmen
comment:18 Changed 6 years ago by Karl Palmen
- Status changed from verifying to verify
- Tester Karl Palmen deleted
Testing on Windows7.
No reset_settings.bat found in bin/Release after building.
Either a CMake file needs modifying to ensure it appears or what is meant by 'Install Mantid' in the test workflow context needs explaining.
comment:19 Changed 6 years ago by Dan Nixon
- Status changed from verify to reopened
- Resolution fixed deleted
comment:20 Changed 6 years ago by Dan Nixon
- Status changed from reopened to inprogress
Renamed copy_python_files_to_dir cmake function
Refs #10015
Changeset: 0cd9bde0f314599d1896db47c7ede4ebf4730d96
comment:21 Changed 6 years ago by Dan Nixon
- Status changed from inprogress to verify
- Resolution set to fixed
comment:22 Changed 6 years ago by Dan Nixon
- Status changed from verify to reopened
- Resolution fixed deleted
comment:23 Changed 6 years ago by Dan Nixon
- Status changed from reopened to inprogress
Merge branch 'feature/10015_settings_reset_mechanism' into develop
Conflicts:
Code/Mantid/MantidPlot/CMakeLists.txt
Refs #10015
Changeset: fb6c010034d657154ff0adee67d184e55d6a8988
comment:24 Changed 6 years ago by Dan Nixon
comment:25 Changed 6 years ago by Dan Nixon
- Status changed from inprogress to verify
- Resolution set to fixed
comment:26 Changed 6 years ago by Alex Buts
- Status changed from verify to verifying
- Tester set to Alex Buts
comment:27 Changed 6 years ago by Alex Buts
- Status changed from verifying to verify
- Tester Alex Buts deleted
Tested on windows and Linux and done code review. All looks fine.
Minor issue discovered on RHEL6:
if one runs reset_settings.sh from mantid installation folder, all runs fine but trying to run it from home (e.g. >>bash /opt/mantid/bin/reset_settings.sh ) complains: python: can't open file './qt_settings_editor.py': [Errno 2] No such file or directory
This is minor issue, which can be addressed by another ticket or within this one.
I am returning this ticket to testing pool as mac user is needed to test it on MAC and I do not have access to one.
comment:28 Changed 6 years ago by Federico M Pouzols
- Blocking 8912 added
(In #8912) Added 10015 as a blocker. In that ticket a cmake function has been renamed (copy_python_files_to_dir => copy_files_to_dir) that creates conflicts with this ticket either in the develop or master branches.
comment:29 Changed 6 years ago by Peter Peterson
- Status changed from verify to verifying
- Tester set to Peter Peterson
comment:30 Changed 6 years ago by Peter Peterson
- Status changed from verifying to reopened
- Resolution fixed deleted
This is the wrong name for the reset script. Since /opt/Mantid/bin gets into people's PATHs this will be a very generic name for two scripts that do something very specific to mantid. If you were to prefix the scripts with mantid_ I'd be satisfied.
comment:31 Changed 6 years ago by Dan Nixon
- Status changed from reopened to inprogress
comment:32 Changed 6 years ago by Dan Nixon
Merge branch 'feature/10015_settings_reset_mechanism' into develop
Conflicts:
Code/Mantid/MantidPlot/CMakeLists.txt
Refs #10015
Changeset: bcee047423ee5cc8af12fb3004db4826c88b20d3
comment:33 Changed 6 years ago by Dan Nixon
- Status changed from inprogress to verify
- Resolution set to fixed
comment:34 Changed 6 years ago by Pete Peterson
- Status changed from verify to closed
Merge remote-tracking branch 'origin/feature/10015_settings_reset_mechanism'
Full changeset: fe2a80f503e310fc991b3e715e94c9300de14e95
comment:35 Changed 6 years ago by Dan Nixon
Merge branch 'feature/10015_settings_reset_mechanism' into develop
Conflicts:
Code/Mantid/MantidPlot/CMakeLists.txt
Refs #10015
Changeset: bcee047423ee5cc8af12fb3004db4826c88b20d3
comment:36 Changed 5 years ago by Stuart Campbell
This ticket has been transferred to github issue 10857
Talk to Martyn for suggestions on how to do this