Commit ba49bf34 authored by Anthony Lim's avatar Anthony Lim
Browse files

refs #32539 muon GUI reads features from user file

parent 223a83f5
......@@ -577,7 +577,9 @@ void ConfigServiceImpl::createUserPropertiesFile() const {
filestr << "#MantidOptions.ReusePlotInstances=Off\n\n";
filestr << "## Uncomment to disable use of OpenGL to render unwrapped "
"instrument views\n";
filestr << "#MantidOptions.InstrumentView.UseOpenGL=Off\n";
filestr << "#MantidOptions.InstrumentView.UseOpenGL=Off\n\n";
filestr << "## Muon GUI settings\n";
filestr << "#muon.GUI = \n";
filestr.close();
} catch (std::runtime_error &ex) {
......
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright &copy; 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
from mantid import config
def load_features():
feature_list = {}
# this allows for a mangled config
try:
feature_list=attempt_load()
except:
return {}
return feature_list
def attempt_load():
string = config["muon.GUI"]
if string:
string.replace(" ","")
item_list = string.split(",")
for item in item_list:
key, value = item.split(":")
feature_list[key] = int(value)
return feature_list
......@@ -8,7 +8,7 @@ from mantidqtinterfaces.Muon.GUI.Common.features.add_feature import addFeature
from mantidqtinterfaces.Muon.GUI.Common.model_fitting_tab_widget.model_fitting_tab_widget import ModelFittingTabWidget
MODELANALYSIS = "model analysis"
MODELANALYSIS = "model_analysis"
TABONLY = 1
TABANDPLOT = 2
......
......@@ -7,7 +7,7 @@
from mantidqtinterfaces.Muon.GUI.Common.features.add_feature import addFeature
RAWPLOTS = "raw plots"
RAWPLOTS = "raw_plots"
ADD = 1
......
......@@ -42,6 +42,7 @@ from mantidqtinterfaces.Muon.GUI.Common.plotting_dock_widget.plotting_dock_widge
from mantidqt.utils.observer_pattern import GenericObserver, GenericObserverWithArgPassing, GenericObservable
from mantidqtinterfaces.Muon.GUI.Common.features.model_analysis import addModelAnalysis
from mantidqtinterfaces.Muon.GUI.Common.features.raw_plots import addRawPlots
from mantidqtinterfaces.Muon.GUI.Common.features.load_features import load_features
SUPPORTED_FACILITIES = ["ISIS", "SmuS"]
......@@ -81,6 +82,8 @@ class FrequencyAnalysisGui(QtWidgets.QMainWindow):
check_facility()
except AttributeError as error:
self.warning_popup(error.args[0])
# load the feature flags
feature_dict = load_features()
# initialise the data storing classes of the interface
self.loaded_data = MuonLoadData()
......@@ -132,8 +135,6 @@ class FrequencyAnalysisGui(QtWidgets.QMainWindow):
self.seq_fitting_tab = SeqFittingTabWidget(self.context, self.fitting_tab.fitting_tab_model, self)
self.results_tab = ResultsTabWidget(self.context.fitting_context, self.context, self)
feature_dict ={"bob": True, "cake": False, "model analysis": 2, "raw plots":1}
self.add_model_analysis = addModelAnalysis(self, feature_dict)
self.add_raw_plots = addRawPlots(self, feature_dict)
......
......@@ -36,6 +36,7 @@ from mantidqtinterfaces.Muon.GUI.Common.plotting_dock_widget.plotting_dock_widge
from mantidqt.utils.observer_pattern import GenericObserver, GenericObservable
from mantidqtinterfaces.Muon.GUI.Common.features.model_analysis import addModelAnalysis
from mantidqtinterfaces.Muon.GUI.Common.features.raw_plots import addRawPlots
from mantidqtinterfaces.Muon.GUI.Common.features.load_features import load_features
SUPPORTED_FACILITIES = ["ISIS", "SmuS"]
......@@ -78,6 +79,8 @@ class MuonAnalysisGui(QtWidgets.QMainWindow):
check_facility()
except AttributeError as error:
self.warning_popup(error.args[0])
# load the feature flags
feature_dict = load_features()
# initialise the data storing classes of the interface
self.loaded_data = MuonLoadData()
......@@ -125,8 +128,6 @@ class MuonAnalysisGui(QtWidgets.QMainWindow):
self.seq_fitting_tab = SeqFittingTabWidget(self.context, self.fitting_tab.fitting_tab_model, self)
self.results_tab = ResultsTabWidget(self.context.fitting_context, self.context, self)
feature_dict ={"bob": True, "cake": False, "model analysis": 0, "raw plots":1}
self.add_model_analysis = addModelAnalysis(self, feature_dict)
self.add_raw_plots = addRawPlots(self, feature_dict)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment