Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Reparameterization Editor (rebase) #3136

Draft
wants to merge 37 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
ed523e4
creates skeleton reparameterization editor UI file, python file, and …
tsole0 Jul 2, 2024
a4cf57f
create essential GUI layout for later features
tsole0 Jul 5, 2024
4a19672
add more buttons and clean layout of reparam editor
tsole0 Jul 8, 2024
c44b54d
design .ui file for selecting model to be reparameterized
tsole0 Jul 8, 2024
f8ff424
make reparameterization editor UI auto-expand to fit available space …
tsole0 Jul 8, 2024
cc38531
create model selection popup logic
tsole0 Jul 8, 2024
b8b41c6
update UI: add name input box, overwrite checkbox, and restructure se…
tsole0 Jul 8, 2024
ffcc7bf
connect `cancel` buttons and add docstrings to functions
tsole0 Jul 8, 2024
f6d5bb9
include "type" in loaded model parameters to display in table
tsole0 Jul 9, 2024
bc51eca
create `.ui` file for dialog used to create new parameter for model r…
tsole0 Jul 9, 2024
f0f4fad
add `ReparameterEditDialog.py` and logic for creating parameters and …
tsole0 Jul 9, 2024
7789cac
delete whitespace
tsole0 Jul 9, 2024
6334325
allow user to edit newly created parameters by using a modified `Para…
tsole0 Jul 11, 2024
1179631
Add default values to `Edit Parameters` dialog
tsole0 Jul 11, 2024
7717842
Create delete parameter logic.
tsole0 Jul 11, 2024
a5ac232
add support for displaying and editing parameter descriptions in a co…
tsole0 Jul 11, 2024
f3844a7
refresh `lblSelectModelInfo` with name of model loaded into the editor
tsole0 Jul 11, 2024
5097e10
clear `oldParamTable` before adding new parameters
tsole0 Jul 11, 2024
0d5986e
Write blank model file to user plugins directory when `Apply` is pres…
tsole0 Jul 11, 2024
76a09bb
Fixes bug preventing adding new parameters by filtering for adding ol…
tsole0 Jul 11, 2024
94e753a
Generate output template and fill in using correct values.
tsole0 Jul 12, 2024
0b9e570
adds formatting, python syntax highlighting, and tooptip to function box
tsole0 Jul 12, 2024
23621e4
detect model edited status and allow saving if model is edited. Displ…
tsole0 Jul 12, 2024
e37488c
add python syntax/model checking to output reparameterized model
tsole0 Jul 15, 2024
e860d7b
fix `txtFunction` text formatting bug
tsole0 Jul 15, 2024
764abad
subclass QTreeWidget -> QParameterTreeWidget so we can add text to di…
tsole0 Jul 15, 2024
bb2d616
remove print() statements
tsole0 Jul 15, 2024
9127921
large code refactor and new feature: warning icons next to problemati…
tsole0 Jul 17, 2024
6e8dcf6
remove print statement
tsole0 Jul 17, 2024
3ffd7ff
add error messages for common errors. detect if window has been edite…
tsole0 Jul 17, 2024
79ca75d
fixes bug causing parameters to save incorrectly on Mac if user didn'…
tsole0 Jul 22, 2024
5b4104c
prevent widget from trying to open a parameter edit window when no pa…
tsole0 Sep 3, 2024
0f1d504
ensure no content is cut off in either treewidget by dynamically resi…
tsole0 Sep 3, 2024
3dd0464
add help button that shows user model documentation from reparameteri…
tsole0 Sep 3, 2024
497becd
add code comment
tsole0 Sep 4, 2024
4c9d71f
refresh list of models in existing fitting tabs after model created/e…
tsole0 Sep 9, 2024
0576c83
Refactor model and custom GUI files into subpackages for neatness
tsole0 Sep 12, 2024
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
2 changes: 1 addition & 1 deletion src/sas/qtgui/Calculators/GenericScatteringCalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import periodictable

import sas.qtgui.Utilities.GuiUtils as GuiUtils
from sas.qtgui.Utilities.TabbedModelEditor import TabbedModelEditor
from sas.qtgui.Utilities.ModelEditors.TabbedEditor.TabbedModelEditor import TabbedModelEditor
from sas.qtgui.Utilities.GenericReader import GenReader
from sasdata.dataloader.data_info import Detector, Source
from sas.system.version import __version__
Expand Down
12 changes: 10 additions & 2 deletions src/sas/qtgui/MainWindow/GuiManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
import sas.qtgui.Utilities.GuiUtils as GuiUtils

import sas.qtgui.Utilities.ObjectLibrary as ObjectLibrary
from sas.qtgui.Utilities.TabbedModelEditor import TabbedModelEditor
from sas.qtgui.Utilities.ModelEditors.TabbedEditor.TabbedModelEditor import TabbedModelEditor
from sas.qtgui.Utilities.PluginManager import PluginManager
from sas.qtgui.Utilities.ModelEditors.ReparamEditor.ReparameterizationEditor import ReparameterizationEditor
from sas.qtgui.Utilities.GridPanel import BatchOutputPanel
from sas.qtgui.Utilities.ResultPanel import ResultPanel
from sas.qtgui.Utilities.OrientationViewer.OrientationViewer import show_orientation_viewer
Expand Down Expand Up @@ -68,7 +69,7 @@

from sas.qtgui.MainWindow.DataExplorer import DataExplorerWindow

from sas.qtgui.Utilities.AddMultEditor import AddMultEditor
from sas.qtgui.Utilities.ModelEditors.AddMultEditor.AddMultEditor import AddMultEditor
from sas.qtgui.Utilities.ImageViewer import ImageViewer
from sas.qtgui.Utilities.FileConverter import FileConverterWidget
from sas.qtgui.Utilities.WhatsNew.WhatsNew import WhatsNew
Expand Down Expand Up @@ -755,6 +756,7 @@ def addTriggers(self):
self._workspace.actionAdd_Custom_Model.triggered.connect(self.actionAdd_Custom_Model)
self._workspace.actionEdit_Custom_Model.triggered.connect(self.actionEdit_Custom_Model)
self._workspace.actionManage_Custom_Models.triggered.connect(self.actionManage_Custom_Models)
self._workspace.actionReparameterize_Model.triggered.connect(self.actionReparameterize_Model)
self._workspace.actionAddMult_Models.triggered.connect(self.actionAddMult_Models)
self._workspace.actionEditMask.triggered.connect(self.actionEditMask)

Expand Down Expand Up @@ -1169,6 +1171,12 @@ def actionManage_Custom_Models(self):
self.model_manager = PluginManager(self)
self.model_manager.show()

def actionReparameterize_Model(self):
"""
"""
self.reparameterizer = ReparameterizationEditor(self)
self.reparameterizer.show()

def actionAddMult_Models(self):
"""
"""
Expand Down
25 changes: 25 additions & 0 deletions src/sas/qtgui/Utilities/CustomGUI/ParameterTree.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from PySide6.QtWidgets import QApplication, QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget
from PySide6.QtGui import QPainter, QPen, QColor, QFont
from PySide6.QtCore import Qt, QRect

class QParameterTreeWidget(QTreeWidget):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.disabled_text = ""

def setDisabledText(self, text):
self.disabled_text = text
self.viewport().update()

def paintEvent(self, event):
super().paintEvent(event)

if not self.isEnabled() and self.disabled_text:
painter = QPainter(self.viewport())
painter.setRenderHint(QPainter.Antialiasing)
painter.setRenderHint(QPainter.TextAntialiasing)
painter.setPen(QPen(QColor(170, 170, 170))) # Light gray color for text
painter.setFont(QFont("Segoe UI", 11, italic=True))

rect = self.viewport().rect()
painter.drawText(rect, Qt.AlignCenter, self.disabled_text)
2 changes: 1 addition & 1 deletion src/sas/qtgui/Utilities/DocViewWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from twisted.internet import threads

from .UI.DocViewWidgetUI import Ui_DocViewerWindow
from sas.qtgui.Utilities.TabbedModelEditor import TabbedModelEditor
from sas.qtgui.Utilities.ModelEditors.TabbedEditor.TabbedModelEditor import TabbedModelEditor
from sas.sascalc.fit import models
from sas.sascalc.data_util.calcthread import CalcThread
from sas.sascalc.doc_regen.makedocumentation import (make_documentation, create_user_files_if_needed,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from sas.qtgui.Perspectives.Fitting.FittingWidget import SUPPRESSED_MODELS

# Local UI
from sas.qtgui.Utilities.UI.AddMultEditorUI import Ui_AddMultEditorUI
from sas.qtgui.Utilities.ModelEditors.AddMultEditor.UI.AddMultEditorUI import Ui_AddMultEditorUI

# Template for the output plugin file
SUM_TEMPLATE = """
Expand Down
Loading
Loading