Skip to content
Draft
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/sas/qtgui/MainWindow/DataExplorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,8 +778,15 @@ def isItemReady(index):
try:
if self.chkSwap.isChecked():
self._perspective().swapData(selected_items[0])
if self._perspective().name == 'Fitting':
if config.FITTING_PLOT_ON_SEND_DATA:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using and to concatenate the two conditionals looks slightly better as there is less levels of indentation.
Here and in the other cases

self.newPlot() #todo sort out where the plot should go.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this TODO explains why I get a separate data+model chart on Compute/plot.
Up to @butlerpd to decide if this is what we want the plots to behave.

p1

else:
self._perspective().setData(data_item=selected_items, is_batch=self.chkBatch.isChecked())
if self._perspective().name == 'Fitting':
if config.FITTING_PLOT_ON_SEND_DATA:
self.newPlot()

except Exception as ex:
msg = "%s perspective returned the following message: \n%s\n" % (self._perspective().name, str(ex))
logging.error(ex, exc_info=True)
Expand Down
11 changes: 11 additions & 0 deletions src/sas/qtgui/Utilities/Preferences/FittingPreferencesWidget.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from sas.system import config

from .PreferencesWidget import PreferencesWidget, config_value_setter_generator


class FittingPreferencesWidget(PreferencesWidget):
def __init__(self):
super(FittingPreferencesWidget, self).__init__("Fitting Settings")
self.addCheckBox(title="Auto-plot data when sent to fitting perspective",
callback=config_value_setter_generator('FITTING_PLOT_ON_SEND_DATA', dtype=bool),
checked=config.FITTING_PLOT_ON_SEND_DATA)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs porting to the new way of describing preferences

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class PlottingPreferencesWidget(PreferencesWidget):
def __init__(self):
super(PlottingPreferencesWidget, self).__init__("Plotting Options")
super(PlottingPreferencesWidget, self).__init__("Plotting Settings")
self.addCheckBox(title="Use full-width plot legends (most compatible)?",
callback=config_value_setter_generator('FITTING_PLOT_FULL_WIDTH_LEGENDS', dtype=bool),
checked=config.FITTING_PLOT_FULL_WIDTH_LEGENDS)
Expand Down
6 changes: 4 additions & 2 deletions src/sas/qtgui/Utilities/Preferences/PreferencesPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@
from sas.qtgui.Utilities.Preferences.UI.PreferencesUI import Ui_preferencesUI
from sas.qtgui.Utilities.Preferences.PreferencesWidget import PreferencesWidget
from sas.qtgui.Utilities.Preferences.DisplayPreferencesWidget import DisplayPreferencesWidget

from sas.qtgui.Utilities.Preferences.PlottingPreferencesWidget import PlottingPreferencesWidget
from sas.qtgui.Utilities.Preferences.FittingPreferencesWidget import FittingPreferencesWidget
# The PreferencesPanel object will instantiate all widgets during its instantiation.
# e.g:
# `from foo.bar import BarWidget # BarWidget is a child of PreferencesWidget`
# `BASE_PANELS = {"Bar Widget Options": BarWidget}`
# PreferenceWidget Imports go here and then are added to the BASE_PANELS, but not instantiated.
from .PlottingPreferencesWidget import PlottingPreferencesWidget

# Pre-made option widgets

BASE_PANELS = {"Plotting Settings":PlottingPreferencesWidget,
"Display Settings":DisplayPreferencesWidget,
"Fitting Settings":FittingPreferencesWidget,
} # Type: Dict[str, Union[Type[PreferencesWidget], Callable[[],QWidget]]

logger = logging.getLogger(__name__)
Expand Down
3 changes: 3 additions & 0 deletions src/sas/system/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ def __init__(self):
self.QT_SCALE_FACTOR = 1.0
self.QT_AUTO_SCREEN_SCALE_FACTOR = False

# Auto-plot when sending data to Fitting
self.FITTING_PLOT_ON_SEND_DATA = True

# If True, use an ugly but more robust legend plotting method in Fitting that results in full-
# width legends.
self.FITTING_PLOT_FULL_WIDTH_LEGENDS = False
Expand Down