diff --git a/src/sas/qtgui/MainWindow/DataExplorer.py b/src/sas/qtgui/MainWindow/DataExplorer.py index 72d5146735..ba2729ea42 100644 --- a/src/sas/qtgui/MainWindow/DataExplorer.py +++ b/src/sas/qtgui/MainWindow/DataExplorer.py @@ -1086,11 +1086,17 @@ def displayData(self, data_list, id=None): plot_name = plot_to_show.name role = plot_to_show.plot_role - stand_alone_types = [DataRole.ROLE_RESIDUAL, DataRole.ROLE_STAND_ALONE] + stand_alone_types = [DataRole.ROLE_RESIDUAL, DataRole.ROLE_STAND_ALONE, DataRole.ROLE_POLYDISPERSITY] if (role in stand_alone_types and shown) or role == DataRole.ROLE_DELETABLE: # Nothing to do if stand-alone plot already shown or plot to be deleted continue + elif role == DataRole.ROLE_RESIDUAL and config.DISABLE_RESIDUAL_PLOT: + # Nothing to do if residuals are not plotted + continue + elif role == DataRole.ROLE_POLYDISPERSITY and config.DISABLE_POLYDISPERSITY_PLOT: + # Nothing to do if polydispersity plot is not plotted + continue elif role in stand_alone_types: # Stand-alone plots should always be separate self.plotData([(plot_item, plot_to_show)]) diff --git a/src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py b/src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py index 825c66a628..48330b8090 100644 --- a/src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py +++ b/src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py @@ -643,7 +643,7 @@ def plotPolydispersities(model): data1d.symbol = 'Line' data1d.name = "{} polydispersity".format(name) data1d.id = data1d.name # placeholder, has to be completed later - data1d.plot_role = DataRole.ROLE_STAND_ALONE + data1d.plot_role = DataRole.ROLE_POLYDISPERSITY plots.append(data1d) return plots diff --git a/src/sas/qtgui/Plotting/PlotterData.py b/src/sas/qtgui/Plotting/PlotterData.py index 8fbaf7991e..e43539dcc0 100644 --- a/src/sas/qtgui/Plotting/PlotterData.py +++ b/src/sas/qtgui/Plotting/PlotterData.py @@ -27,6 +27,8 @@ class DataRole(Enum): ROLE_RESIDUAL = 3 # Stand alone is for plots that should be plotted separately ROLE_STAND_ALONE = 4 + # Polydispersity is for stand-alone polydispersity plot + ROLE_POLYDISPERSITY = 5 class Data1D(PlottableData1D, LoadData1D): diff --git a/src/sas/qtgui/Utilities/Preferences/DisplayPreferencesWidget.py b/src/sas/qtgui/Utilities/Preferences/DisplayPreferencesWidget.py index abdd1d6143..da535cb4f6 100644 --- a/src/sas/qtgui/Utilities/Preferences/DisplayPreferencesWidget.py +++ b/src/sas/qtgui/Utilities/Preferences/DisplayPreferencesWidget.py @@ -6,7 +6,10 @@ class DisplayPreferencesWidget(PreferencesWidget): def __init__(self): super(DisplayPreferencesWidget, self).__init__("Display Settings") - self.config_params = ['QT_SCALE_FACTOR', 'QT_AUTO_SCREEN_SCALE_FACTOR'] + self.config_params = ['QT_SCALE_FACTOR', + 'QT_AUTO_SCREEN_SCALE_FACTOR', + 'DISABLE_RESIDUAL_PLOT', + 'DISABLE_POLYDISPERSITY_PLOT'] self.restart_params = {'QT_SCALE_FACTOR': 'QT Screen Scale Factor', 'QT_AUTO_SCREEN_SCALE_FACTOR': "Enable Automatic Scaling"} @@ -21,12 +24,26 @@ def _addAllWidgets(self): checked=config.QT_AUTO_SCREEN_SCALE_FACTOR) self.autoScaling.clicked.connect( lambda: self._stageChange('QT_AUTO_SCREEN_SCALE_FACTOR', self.autoScaling.isChecked())) + self.disableResidualPlot = self.addCheckBox( + title="Disable Residuals Display", + checked=config.DISABLE_RESIDUAL_PLOT) + self.disableResidualPlot.clicked.connect( + lambda: self._stageChange('DISABLE_RESIDUAL_PLOT', self.disableResidualPlot.isChecked())) + self.disablePolydispersityPlot = self.addCheckBox( + title="Disable Polydispersity Plot Display", + checked=config.DISABLE_POLYDISPERSITY_PLOT) + self.disablePolydispersityPlot.clicked.connect( + lambda: self._stageChange('DISABLE_POLYDISPERSITY_PLOT', self.disablePolydispersityPlot.isChecked())) def _toggleBlockAllSignaling(self, toggle): self.qtScaleFactor.blockSignals(toggle) self.autoScaling.blockSignals(toggle) + self.disableResidualPlot.blockSignals(toggle) + self.disablePolydispersityPlot.blockSignals(toggle) def _restoreFromConfig(self): self.qtScaleFactor.setText(str(config.QT_SCALE_FACTOR)) self.qtScaleFactor.setStyleSheet("background-color: white") self.autoScaling.setChecked(bool(config.QT_AUTO_SCREEN_SCALE_FACTOR)) + self.disableResidualPlot.setChecked(config.DISABLE_RESIDUAL_PLOT) + self.disablePolydispersityPlot.setChecked(config.DISABLE_POLYDISPERSITY_PLOT) diff --git a/src/sas/system/config/config.py b/src/sas/system/config/config.py index 816110eb90..d3fd556955 100644 --- a/src/sas/system/config/config.py +++ b/src/sas/system/config/config.py @@ -197,6 +197,14 @@ def __init__(self): # sets the maximum number of characters per Fitting plot legend entry. self.FITTING_PLOT_LEGEND_MAX_LINE_LENGTH = 30 + # Residuals management + # If true, disables residual plot display + self.DISABLE_RESIDUAL_PLOT = False + + # Polydispersity plot management + # If true, disables polydispersity plot display + self.DISABLE_POLYDISPERSITY_PLOT = False + # Default fitting optimizer self.FITTING_DEFAULT_OPTIMIZER = 'lm'