Skip to content

Commit

Permalink
Merge branch 'release_5.0.6' into release_5.0.6_cherrypick_notes
Browse files Browse the repository at this point in the history
  • Loading branch information
krzywon authored Feb 2, 2023
2 parents b953fbb + 4f3914c commit df3fdbc
Show file tree
Hide file tree
Showing 31 changed files with 260 additions and 123 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
- name: Fetch sources for sibling projects
run: |
git clone --depth=1 --branch=release_1.0.7 https://github.com/SasView/sasmodels.git ../sasmodels
git clone --depth=1 --branch=v0.9.0 https://github.com/bumps/bumps.git ../bumps
git clone --depth=1 --branch=master https://github.com/bumps/bumps.git ../bumps
- name: Build and install sasmodels
run: |
Expand Down
3 changes: 2 additions & 1 deletion LICENSE.TXT
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Copyright (c) 2009-2022, SasView Developers
Copyright (c) 2009-2023, SasView Developers



All rights reserved.
Expand Down
4 changes: 2 additions & 2 deletions docs/sphinx-docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

# General information about the project.
project = u'SasView'
copyright = u'2022, The SasView Project'
copyright = u'2023, The SasView Project'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand All @@ -81,7 +81,7 @@
# The short X.Y version.
version = '5.0'
# The full version, including e.g. alpha tags (a1).
release = '5.0.5'
release = '5.0.6b1'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion installers/license.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ sentence:
*"This work benefited from the use of the SasView application, originally
developed under NSF award DMR-0520547."*

Copyright (c) 2009-2022 UTK, UMD, ESS, NIST, ORNL, ISIS, ILL, DLS, DUT, BAM, ANSTO
Copyright (c) 2009-2023 UTK, UMD, ESS, NIST, ORNL, ISIS, ILL, DLS, DUT, BAM, ANSTO
2 changes: 1 addition & 1 deletion src/sas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def get_custom_config():
global _CUSTOM_CONFIG
if not _CUSTOM_CONFIG:
from ._config import setup_custom_config
_CUSTOM_CONFIG = setup_custom_config(get_app_dir(), get_user_dir())
_CUSTOM_CONFIG = setup_custom_config(get_user_dir())
return _CUSTOM_CONFIG


Expand Down
33 changes: 28 additions & 5 deletions src/sas/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,30 @@

logger = logging.getLogger(__name__)

CUSTOM_CONFIG = r'''
"""
Application appearance custom configuration
"""
DATAPANEL_WIDTH = -1
CLEANUP_PLOT = False
FIXED_PANEL = True
PLOPANEL_WIDTH = -1
DATALOADER_SHOW = True
GUIFRAME_HEIGHT = -1
GUIFRAME_WIDTH = -1
CONTROL_WIDTH = -1
CONTROL_HEIGHT = -1
DEFAULT_OPEN_FOLDER = None
WELCOME_PANEL_SHOW = False
TOOLBAR_SHOW = True
DEFAULT_PERSPECTIVE = "Fitting"
SAS_OPENCL = "None"
MARKETPLACE_URL = "http://marketplace.sasview.org/"
# Logging options
FILTER_DEBUG_LOGS = True
'''

def dirn(path, n):
"""
Return the directory n up from the current path
Expand Down Expand Up @@ -83,15 +107,14 @@ def make_custom_config_path(user_dir):
path = os.path.join(dirname, "custom_config.py")
return path

def setup_custom_config(app_dir, user_dir):
def setup_custom_config(user_dir):
path = make_custom_config_path(user_dir)
if not os.path.isfile(path):
try:
# if the custom config file does not exist, copy the default from
# the app dir
shutil.copyfile(os.path.join(app_dir, "custom_config.py"), path)
with open(path, 'w+') as f:
f.write(CUSTOM_CONFIG)
except Exception:
logger.error("Could not copy default custom config.")
logger.error("Could not write default custom config.")

#Adding SAS_OPENCL if it doesn't exist in the config file
# - to support backcompability
Expand Down
2 changes: 2 additions & 0 deletions src/sas/logger_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def config_production(self):
logging.captureWarnings(True)
logger = logging.getLogger(self.name)
logging.getLogger('matplotlib').setLevel(logging.WARN)
logging.getLogger('numba').setLevel(logging.WARN)
return logger

def config_development(self):
Expand All @@ -42,6 +43,7 @@ def config_development(self):
logging.captureWarnings(True)
self._disable_debug_from_config()
logging.getLogger('matplotlib').setLevel(logging.WARN)
logging.getLogger('numba').setLevel(logging.WARN)
return logger

def _disable_debug_from_config(self):
Expand Down
2 changes: 1 addition & 1 deletion src/sas/qtgui/Calculators/DataOperationUtilityPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ def onPrepareOutputData(self):
""" Prepare datasets to be added to DataExplorer and DataManager """
name = self.txtOutputData.text()
self.output.name = name
self.output.id = name + str(time.time())
new_item = GuiUtils.createModelItemWithPlot(
self.output,
name=name)
Expand Down Expand Up @@ -410,7 +411,6 @@ def updatePlot(self, graph, layout, data):
# plot 2D data
plotter2D = Plotter2DWidget(self, quickplot=True)
plotter2D.scale = 'linear'

plotter2D.ax.tick_params(axis='x', labelsize=8)
plotter2D.ax.tick_params(axis='y', labelsize=8)

Expand Down
30 changes: 27 additions & 3 deletions src/sas/qtgui/Calculators/UI/SldPanel.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>490</width>
<height>446</height>
<width>552</width>
<height>495</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -308,10 +308,16 @@
</item>
<item row="4" column="0">
<widget class="QWidget" name="widget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>466</width>
<height>32</height>
<height>50</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout">
Expand All @@ -320,6 +326,12 @@
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>28</height>
</size>
</property>
<property name="text">
<string>Recalculate</string>
</property>
Expand All @@ -340,13 +352,25 @@
</item>
<item row="0" column="2">
<widget class="QPushButton" name="closeButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>28</height>
</size>
</property>
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="helpButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>28</height>
</size>
</property>
<property name="text">
<string>Help</string>
</property>
Expand Down
42 changes: 32 additions & 10 deletions src/sas/qtgui/MainWindow/DataExplorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ def __init__(self, parent=None, guimanager=None, manager=None):
self.cbgraph.editTextChanged.connect(self.enableGraphCombo)
self.cbgraph.currentIndexChanged.connect(self.enableGraphCombo)

self.cbgraph_2.editTextChanged.connect(self.enableGraphCombo)
self.cbgraph_2.currentIndexChanged.connect(self.enableGraphCombo)

# Proxy model for showing a subset of Data1D/Data2D content
self.data_proxy = QtCore.QSortFilterProxyModel(self)
self.data_proxy.setSourceModel(self.model)
Expand Down Expand Up @@ -696,6 +699,10 @@ def deleteFile(self, event):

# Delete corresponding open plots
self.closePlotsForItem(item)
# Close result panel if results represent the deleted data item
# Results panel only stores Data1D/Data2D object
# => QStandardItems must still exist for direct comparison
self.closeResultPanelOnDelete(GuiUtils.dataFromItem(item))

self.model.removeRow(ind)
# Decrement index since we just deleted it
Expand Down Expand Up @@ -940,9 +947,12 @@ def updatePlotName(self, name_tuple):
Modify the name of the current plot
"""
old_name, current_name = name_tuple
ind = self.cbgraph.findText(old_name)
self.cbgraph.setCurrentIndex(ind)
self.cbgraph.setItemText(ind, current_name)
graph = self.cbgraph
if self.current_view == self.freezeView:
graph = self.cbgraph_2
ind = graph.findText(old_name)
graph.setCurrentIndex(ind)
graph.setItemText(ind, current_name)

def add_data(self, data_list):
"""
Expand Down Expand Up @@ -972,12 +982,15 @@ def updateGraphCombo(self, graph_list):
"""
Modify Graph combo box on graph add/delete
"""
orig_text = self.cbgraph.currentText()
self.cbgraph.clear()
self.cbgraph.insertItems(0, graph_list)
ind = self.cbgraph.findText(orig_text)
graph = self.cbgraph
if self.current_view == self.freezeView:
graph = self.cbgraph_2
orig_text = graph.currentText()
graph.clear()
graph.insertItems(0, graph_list)
ind = graph.findText(orig_text)
if ind > 0:
self.cbgraph.setCurrentIndex(ind)
graph.setCurrentIndex(ind)

def updatePerspectiveCombo(self, index):
"""
Expand Down Expand Up @@ -1207,11 +1220,13 @@ def appendPlot(self):
# new plot data; check which tab is currently active
if self.current_view == self.treeView:
new_plots = GuiUtils.plotsFromCheckedItems(self.model)
graph = self.cbgraph
else:
new_plots = GuiUtils.plotsFromCheckedItems(self.theory_model)
graph = self.cbgraph_2

# old plot data
plot_id = str(self.cbgraph.currentText())
plot_id = str(graph.currentText())
try:
assert plot_id in PlotHelper.currentPlots(), "No such plot: %s" % (plot_id)
except:
Expand Down Expand Up @@ -1883,7 +1898,14 @@ def closePlotsForItem(self, item):

pass # debugger anchor

def onAnalysisUpdate(self, new_perspective=""):
def closeResultPanelOnDelete(self, data):
"""
Given a data1d/2d object, close the fitting results panel if currently populated with the data
"""
# data - Single data1d/2d object to be deleted
self.parent.results_panel.onDataDeleted(data)

def onAnalysisUpdate(self, new_perspective_name: str):
"""
Update the perspective combo index based on passed string
"""
Expand Down
26 changes: 12 additions & 14 deletions src/sas/qtgui/MainWindow/GuiManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,33 +123,31 @@ def addWidgets(self):
"""
Populate the main window with widgets
"""
# Add the console window as another docked widget
self.logDockWidget = QDockWidget("Log Explorer", self._workspace)
self.logDockWidget.setObjectName("LogDockWidget")
self.logDockWidget.visibilityChanged.connect(self.updateLogContextMenus)


self.listWidget = QTextBrowser()
self.logDockWidget.setWidget(self.listWidget)
self._workspace.addDockWidget(Qt.BottomDockWidgetArea, self.logDockWidget)

# Preload all perspectives
self.loadAllPerspectives()

# Add FileDialog widget as docked
self.filesWidget = DataExplorerWindow(self._parent, self, manager=self._data_manager)
ObjectLibrary.addObject('DataExplorer', self.filesWidget)

self.dockedFilesWidget = QDockWidget("Data Explorer", self._workspace)
self.dockedFilesWidget.setFloating(False)
self.dockedFilesWidget.setWidget(self.filesWidget)

# Modify menu items on widget visibility change
self.dockedFilesWidget.visibilityChanged.connect(self.updateContextMenus)

self._workspace.addDockWidget(Qt.LeftDockWidgetArea, self.dockedFilesWidget)
self._workspace.resizeDocks([self.dockedFilesWidget], [305], Qt.Horizontal)

# Add the console window as another docked widget
self.logDockWidget = QDockWidget("Log Explorer", self._workspace)
self.logDockWidget.setObjectName("LogDockWidget")
self.logDockWidget.visibilityChanged.connect(self.updateLogContextMenus)


self.listWidget = QTextBrowser()
self.logDockWidget.setWidget(self.listWidget)
self._workspace.addDockWidget(Qt.BottomDockWidgetArea, self.logDockWidget)

# Add other, minor widgets
self.ackWidget = Acknowledgements()
self.aboutWidget = AboutBox()
Expand All @@ -168,8 +166,8 @@ def addWidgets(self):
self.results_frame.setVisible(False)
self.results_panel.windowClosedSignal.connect(lambda: self.results_frame.setVisible(False))

self._workspace.toolBar.setVisible(LocalConfig.TOOLBAR_SHOW)
self._workspace.actionHide_Toolbar.setText("Show Toolbar")
custom_config = get_custom_config()
self._workspace.toolBar.setVisible(custom_config.TOOLBAR_SHOW)

# Add calculators - floating for usability
self.SLDCalculator = SldPanel(self)
Expand Down
5 changes: 2 additions & 3 deletions src/sas/qtgui/MainWindow/MainWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from PyQt5.QtWidgets import QSplashScreen
from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import QPixmap
from PyQt5.QtCore import Qt
from PyQt5.QtCore import Qt, QTimer

# Local UI
from sas.qtgui.UI import main_resources_rc
Expand All @@ -35,7 +35,7 @@ def __init__(self, screen_resolution, parent=None):
self.screen_width = screen_resolution.width()
self.screen_height = screen_resolution.height()
self.setCentralWidget(self.workspace)

QTimer.singleShot(100, self.showMaximized)
# Temporary solution for problem with menubar on Mac
if sys.platform == "darwin": # Mac
self.menubar.setNativeMenuBar(False)
Expand Down Expand Up @@ -110,7 +110,6 @@ def run_sasview():

# Show the main SV window
mainwindow = MainSasViewWindow(screen_resolution)
mainwindow.showMaximized()

# no more splash screen
splash.finish(mainwindow)
Expand Down
Loading

0 comments on commit df3fdbc

Please sign in to comment.