Skip to content

Commit

Permalink
Merge main into release_6.0.0 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
krzywon committed Jun 21, 2024
2 parents 8e146c5 + d170380 commit 6cf920a
Show file tree
Hide file tree
Showing 56 changed files with 1,840 additions and 47 deletions.
25 changes: 16 additions & 9 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,20 @@ Fixes # (issue/issues)

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.

## Review Checklist (please remove items if they don't apply):

- [ ] Code has been reviewed
- [ ] Functionality has been tested
- [ ] Windows installer (GH artifact) has been tested (installed and worked)
- [ ] MacOSX installer (GH artifact) has been tested (installed and worked)
- [ ] User documentation is available and complete (if required)
- [ ] Developers documentation is available and complete (if required)
- [ ] The introduced changes comply with SasView license (BSD 3-Clause)
## Review Checklist:

[if using the editor, use `[x]` in place of `[ ]` to check a box]

**Documentation** (check at least one)
- [ ] There is **nothing** that needs documenting
- [ ] Documentation changes are **in this PR**
- [ ] There is an **issue** open for the documentation (link?)

**Installers**
- [ ] There is a chance this will affect the **installers**, if so
- [ ] **Windows** installer (GH artifact) has been tested (installed and worked)
- [ ] **MacOSX** installer (GH artifact) has been tested (installed and worked)

**Licencing** (untick if necessary)
- [x] The introduced changes comply with SasView license (BSD 3-Clause)

15 changes: 11 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
name: CI

on:
[push, pull_request, workflow_call]
workflow_call:
pull_request:
push:
branches: [main]
tags: ['v*']

defaults:
run:
Expand Down Expand Up @@ -77,6 +81,7 @@ jobs:
- name: Install X11 libraries (Linux)
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: |
sudo apt-get update
sudo apt install libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 x11-utils xvfb libegl-dev
- name: Install Python dependencies
Expand Down Expand Up @@ -105,9 +110,9 @@ jobs:
- name: Fetch sources for sibling projects
run: |
git clone --depth=50 --branch=release_0.9.0 https://github.com/SasView/sasdata.git ../sasdata
git clone --depth=50 --branch=release_1.0.8 https://github.com/SasView/sasmodels.git ../sasmodels
git clone --depth=50 --branch=v0.9.2 https://github.com/bumps/bumps.git ../bumps
git clone --depth=50 --branch=master https://github.com/SasView/sasdata.git ../sasdata
git clone --depth=50 --branch=master https://github.com/SasView/sasmodels.git ../sasmodels
git clone --depth=50 --branch=master https://github.com/bumps/bumps.git ../bumps
- name: Build and install sasdata
run: |
Expand Down Expand Up @@ -195,6 +200,7 @@ jobs:
### Build the installer (if enabled)

- name: Install utilities to build installer
if: ${{ matrix.installer }}
run: |
python -m pip install pyinstaller
Expand Down Expand Up @@ -452,6 +458,7 @@ jobs:
- name: Install X11 libraries (Linux)
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: |
sudo apt-get update
sudo apt install libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 x11-utils xvfb
- name: Try running the installation (Linux)
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/nightly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
os: [ macos-latest]
python-version: [ 3.8 ]
python-version: [ 3.11 ]
needs: reuse_main_ci

steps:
Expand Down Expand Up @@ -62,20 +62,20 @@ jobs:
- name: Rename artifacts
run: |
mv installers/dist/SasView-Installer-windows-*/setupSasView.exe installers/dist/setupSasView-nightly-Win64.exe
mv installers/dist/SasView-Installer-macos-*/SasView5.dmg installers/dist/SasView-nightly-MacOSX.dmg
mv installers/dist/SasView-Installer-ubuntu-*/sasview5.tar.gz installers/dist/SasView-nightly-Linux.tar.gz
mv installers/dist/SasView-Installer-macos-*/SasView6.dmg installers/dist/SasView-nightly-MacOSX.dmg
mv installers/dist/SasView-Installer-ubuntu-*/sasview6.tar.gz installers/dist/SasView-nightly-Linux.tar.gz
- name: Notarize Release Build (OSX)
uses: GuillaumeFalourd/xcode-notarize@v1
uses: lando/notarize-action@v2
with:
product-path: "installers/dist/SasView-nightly-MacOSX.dmg"
primary-bundle-id: "org.sasview.SasView5"
appstore-connect-username: ${{ secrets.NOTARIZATION_USERNAME }}
appstore-connect-password: ${{ secrets.NOTARIZATION_PASSWORD }}
verbose: True
product-path: "installers/dist/SasView-nightly-MacOSX.dmg"
primary-bundle-id: "org.sasview.SasView6"
appstore-connect-username: ${{ secrets.NOTARIZATION_USERNAME }}
appstore-connect-password: ${{ secrets.NOTARIZATION_PASSWORD }}
appstore-connect-team-id: W2AG9MPZ43
verbose: True

- name: Staple Release Build (OSX)
if: ${{ startsWith(matrix.os, 'macos') }}
uses: BoundfoxStudios/action-xcode-staple@v1
with:
product-path: "installers/dist/SasView-nightly-MacOSX.dmg"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ default_categories.json
**/UI/*.py
!**/UI/__init__.py
config.json
**/db.sqlite3

# doc build
/docs/sphinx-docs/build
Expand Down
14 changes: 3 additions & 11 deletions src/sas/qtgui/Calculators/SldPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,8 @@ def setupUi(self):
self.ui.setupUi(self)

# set validators
# TODO: GuiUtils.FormulaValidator() crashes with Qt5 - fix
#self.ui.editMolecularFormula.setValidator(GuiUtils.FormulaValidator(self.ui.editMolecularFormula))

# No need for recalculate
self.ui.recalculateButton.setVisible(False)
# Chemical formula is checked via periodictable.formula module.
self.ui.editMolecularFormula.setValidator(GuiUtils.FormulaValidator(self.ui.editMolecularFormula))

rx = QtCore.QRegularExpression("[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?")
self.ui.editMassDensity.setValidator(QtGui.QRegularExpressionValidator(rx, self.ui.editMassDensity))
Expand All @@ -130,7 +127,7 @@ def setupUi(self):
# signals
self.ui.helpButton.clicked.connect(self.displayHelp)
self.ui.closeButton.clicked.connect(self.closePanel)
self.ui.recalculateButton.clicked.connect(self.calculateSLD)
self.ui.calculateButton.clicked.connect(self.calculateSLD)

def calculateSLD(self):
self.recalculateSLD()
Expand All @@ -147,11 +144,6 @@ def setupModel(self):

#self.model.dataChanged.connect(self.dataChanged)

self.ui.editMassDensity.textChanged.connect(self.recalculateSLD)
self.ui.editMolecularFormula.textChanged.connect(self.recalculateSLD)
self.ui.editNeutronWavelength.textChanged.connect(self.recalculateSLD)
self.ui.editXrayWavelength.textChanged.connect(self.recalculateSLD)

self.modelReset()

def setupMapper(self):
Expand Down
15 changes: 12 additions & 3 deletions src/sas/qtgui/Calculators/UI/SldPanel.ui
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QPushButton" name="recalculateButton">
<widget class="QPushButton" name="calculateButton">
<property name="enabled">
<bool>true</bool>
</property>
Expand All @@ -336,7 +336,10 @@
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Recalculate</string>
<string>Calculate</string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
</widget>
</item>
Expand Down Expand Up @@ -364,6 +367,9 @@
<property name="text">
<string>Close</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="3">
Expand All @@ -377,6 +383,9 @@
<property name="text">
<string>Help</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
Expand All @@ -398,7 +407,7 @@
<tabstop>editNeutronLength</tabstop>
<tabstop>closeButton</tabstop>
<tabstop>helpButton</tabstop>
<tabstop>recalculateButton</tabstop>
<tabstop>calculateButton</tabstop>
</tabstops>
<resources/>
<connections/>
Expand Down
4 changes: 3 additions & 1 deletion src/sas/qtgui/MainWindow/DataExplorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1883,7 +1883,9 @@ def closeAllPlots(self):
"""
Close all currently displayed plots
"""

# results panel
self.parent.results_frame.setVisible(False)
# plots
for plot_id in PlotHelper.currentPlotIds():
try:
plotter = PlotHelper.plotById(plot_id)
Expand Down
2 changes: 1 addition & 1 deletion src/sas/qtgui/Perspectives/Fitting/UI/FittingWidgetUI.ui
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Polydispersity and Orientational Distribution</string>
<string>Number-average Polydispersity and Orientational Distribution</string>
</property>
<layout class="QGridLayout" name="gridLayout_9">
<item row="0" column="0">
Expand Down
2 changes: 2 additions & 0 deletions src/sas/qtgui/Utilities/DocRegenInProgess.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ def __init__(self, parent=None):
self.setupUi(self)
self.parent = parent

self.setWindowTitle("Documentation Regenerating")
self.label.setText("Regeneration In Progress")
self.textBrowser.setText("Placeholder Text.")
self.file_watcher = QtCore.QFileSystemWatcher()
self.addSignals()
Expand Down
15 changes: 7 additions & 8 deletions src/sas/qtgui/Utilities/GuiUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,16 +741,15 @@ def __init__(self, parent=None):
def validate(self, input, pos):

self._setStyleSheet("")
return QtGui.QValidator.Acceptable, pos

#try:
# Formula(str(input))
# self._setStyleSheet("")
# return QtGui.QValidator.Acceptable, pos
try:
Formula(str(input))
self._setStyleSheet("")
return QtGui.QValidator.Acceptable

#except Exception as e:
# self._setStyleSheet("background-color:pink;")
# return QtGui.QValidator.Intermediate, pos
except Exception as e:
self._setStyleSheet("background-color:pink;")
return QtGui.QValidator.Intermediate

def _setStyleSheet(self, value):
try:
Expand Down
17 changes: 17 additions & 0 deletions src/sas/qtgui/Utilities/TabbedModelEditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,15 @@ def onLoad(self, at_launch=False):
self.file_to_regenerate = filename
self.loadFile(str(filename))

def allBuiltinModels(self):
"""
create a list of all builtin models
"""
from sas.sascalc.fit.models import ModelManager
model_list = ModelManager().cat_model_list()
model_names = [model.name for model in model_list]
return model_names

def loadFile(self, filename):
"""
Performs the load operation and updates the view
Expand Down Expand Up @@ -491,6 +500,14 @@ def canWriteModel(self, model=None, full_path=""):
QtWidgets.QMessageBox.critical(self, "Plugin Error", msg)
# Don't accept but return
return False

if model['filename'].casefold() in (model.casefold() for model in self.builtinmodels):
# notify the viewer
msg = "Built-in model with specified name already exists.\n"
msg += "Please specify different filename."
QtWidgets.QMessageBox.critical(self, "Plugin Error", msg)
# Don't accept but return
return False
# Update model editor if plugin definition changed
func_str = model['text']
msg = None
Expand Down
Empty file added src/sas/webfit/__init__.py
Empty file.
Empty file.
3 changes: 3 additions & 0 deletions src/sas/webfit/analyze/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
6 changes: 6 additions & 0 deletions src/sas/webfit/analyze/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class DataConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "analyze"
Empty file.
4 changes: 4 additions & 0 deletions src/sas/webfit/analyze/fitting/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from django.contrib import admin
from .models import Fit, FitParameter

# Register your models here.
6 changes: 6 additions & 0 deletions src/sas/webfit/analyze/fitting/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class FittingConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "analyze.fitting"
40 changes: 40 additions & 0 deletions src/sas/webfit/analyze/fitting/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Generated by Django 4.2.2 on 2023-08-10 22:02

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

initial = True

dependencies = [
('analyze', '0001_initial'),
]

operations = [
migrations.CreateModel(
name='Fit',
fields=[
('analysisbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='analyze.analysisbase')),
('results', models.CharField(blank=True, help_text='the string result', max_length=1000000, null=True)),
('status', models.IntegerField(choices=[(1, 'Queued'), (2, 'Running'), (3, 'Complete')], default=1)),
('q_minimum', models.FloatField(blank=True, default=0.0005, help_text='Minimum Q value for the fit', null=True)),
('q_maximum', models.FloatField(blank=True, default=0.5, help_text='Maximum Q value for the fit', null=True)),
('polydispersity', models.BooleanField(default=False, help_text='Is polydispersity being checked in this model')),
('magnetism', models.BooleanField(default=False, help_text='Is magnetism being checked in this model?')),
('model', models.CharField(help_text='model string', max_length=256)),
('optimizer', models.CharField(blank=True, help_text='optimizer string', max_length=50)),
],
bases=('analyze.analysisbase',),
),
migrations.CreateModel(
name='FitParameter',
fields=[
('analysisparameterbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='analyze.analysisparameterbase')),
('polydisperse', models.BooleanField(default=False, help_text='Is this a polydisperse parameter?')),
('magnetic', models.BooleanField(default=False, help_text='is this a magnetic parameter?')),
],
bases=('analyze.analysisparameterbase',),
),
]
Empty file.
Loading

0 comments on commit 6cf920a

Please sign in to comment.