Commit a8bed186 authored by Henri Payno's avatar Henri Payno
Browse files

[orangecontrib] fix Setting management for larch widget

parent 2c0e2f09
Pipeline #56137 passed with stages
in 6 minutes and 22 seconds
......@@ -30,7 +30,6 @@ __date__ = "04/10/2021"
import logging
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from silx.gui import qt
from silx.gui.plot import LegendSelector
import est.core.process.larch.autobk
......@@ -44,6 +43,7 @@ from est.gui.XasObjectViewer import (
)
from est.gui.larch.autobk import _AutobkParameters
from orangecontrib.est.widgets.container import _ParameterWindowContainer
from ewokscore.hashing import MissingData
_logger = logging.getLogger(__file__)
......@@ -150,11 +150,6 @@ class AutobkOW(
want_main_area = True
resizing_enabled = True
_larchSettings = Setting(dict())
# kept for compatibility
static_input = Setting({"xas_obj": None, "autobk": None})
"""Store the configuration of the larch configuration"""
def __init__(self):
super().__init__()
self._window = AutobkWindow(parent=self)
......@@ -163,26 +158,16 @@ class AutobkOW(
self._window.xasObjViewer.setWindowTitle("spectra")
# manage settings
larch_settings = self.static_input.get("autobk", None)
if larch_settings is None:
larch_settings = self._larchSettings
if larch_settings != dict():
larch_settings = self.task_input_values.get("autobk", MissingData)
if larch_settings is not MissingData:
self._window._parametersWindow.setParameters(larch_settings)
# connect signals / slots
self._window._parametersWindow.sigChanged.connect(self._updateProcess)
# set up (insure settings will be store
self._update_settings()
def _updateProcess(self):
"""Update settings keeping current xas obj"""
self._update_settings()
self.handleNewSignals()
def _update_settings(self):
self._larchSettings = self._window._parametersWindow.getParameters()
self.static_input = {
"autobk": self._window._parametersWindow.getParameters(),
"xas_obj": None,
}
self.receiveDynamicInputs(
"autobk", self._window._parametersWindow.getParameters()
)
......@@ -37,9 +37,9 @@ import est.core.process.larch.mback
from orangecontrib.est.process import _ProcessForOrangeMixIn
from est.gui.XasObjectViewer import XasObjectViewer, ViewType
from est.gui.larch.mback import _MBackParameters
from est.gui.XasObjectViewer import _plot_norm, _plot_raw, _plot_fpp, _plot_f2
from orangecontrib.est.widgets.container import _ParameterWindowContainer
from ewokscore.hashing import MissingData
_logger = logging.getLogger(__file__)
......@@ -138,10 +138,8 @@ class MbackOW(
self._window.xasObjViewer.setWindowTitle("spectra")
# manage settings
larch_settings = self.static_input.get("mback", None)
if larch_settings is None:
larch_settings = self._larchSettings
if larch_settings != dict():
larch_settings = self.task_input_values.get("mback", MissingData)
if larch_settings is not MissingData:
self._window._parametersWindow.setParameters(larch_settings)
# connect signals / slots
......@@ -151,12 +149,7 @@ class MbackOW(
self._update_settings()
def _updateProcess(self):
self._update_settings()
self.handleNewSignals()
def _update_settings(self):
self._larchSettings = self._window._parametersWindow.getParameters()
self.static_input = {
"mback": self._window._parametersWindow.getParameters(),
"xas_obj": None,
}
self.receiveDynamicInputs(
"mback", self._window._parametersWindow.getParameters()
)
......@@ -39,8 +39,8 @@ from orangecontrib.est.process import _ProcessForOrangeMixIn
from est.gui.XasObjectViewer import XasObjectViewer, ViewType
from est.gui.XasObjectViewer import _plot_norm, _plot_mback_mu
from est.gui.larch.mback import _MBackParameters
from orangecontrib.est.widgets.container import _ParameterWindowContainer
from ewokscore.hashing import MissingData
_logger = logging.getLogger(__file__)
......@@ -141,25 +141,15 @@ class Mback_normOW(
self._window.xasObjViewer.setWindowTitle("spectra")
# manage settings
larch_settings = self.static_input.get("mback_norm", None)
if larch_settings is None:
larch_settings = self._larchSettings
if larch_settings != dict():
larch_settings = self.task_input_values.get("mback_norm", MissingData)
if larch_settings is not MissingData:
self._window._parametersWindow.setParameters(larch_settings)
# connect signals / slots
self._window._parametersWindow.sigChanged.connect(self._updateProcess)
# set up (insure settings will be store
self._update_settings()
def _updateProcess(self):
self._update_settings()
self.handleNewSignals()
def _update_settings(self):
self._larchSettings = self._window._parametersWindow.getParameters()
self.static_input = {
"mback_norm": self._window._parametersWindow.getParameters(),
"xas_obj": None,
}
self.receiveDynamicInputs(
"mback_norm", self._window._parametersWindow.getParameters()
)
......@@ -45,8 +45,8 @@ from est.gui.XasObjectViewer import (
_plot_pre_edge,
)
from est.gui.larch.pre_edge import _MPreEdgeParameters
from orangecontrib.est.widgets.container import _ParameterWindowContainer
from ewokscore.hashing import MissingData
_logger = logging.getLogger(__file__)
......@@ -160,26 +160,15 @@ class PreEdgeOW(
self._window.xasObjViewer.setWindowTitle("spectra")
# manage settings
larch_settings = self.static_input.get("pre_edge", None)
if larch_settings is None:
larch_settings = self._larchSettings
if larch_settings != dict():
larch_settings = self.task_input_values.get("pre_edge", MissingData)
if larch_settings is not MissingData:
self._window._parametersWindow.setParameters(larch_settings)
# connect signals / slots
self._window._parametersWindow.sigChanged.connect(self._updateProcess)
# set up (insure settings will be store
self._update_settings()
# self.handleNewSignals()
def _updateProcess(self):
self._update_settings()
self.handleNewSignals()
def _update_settings(self):
self._larchSettings = self._window._parametersWindow.getParameters()
self.static_input = {
"pre_edge": self._window._parametersWindow.getParameters(),
"xas_obj": None,
}
self.receiveDynamicInputs(
"pre_edge", self._window._parametersWindow.getParameters()
)
......@@ -44,8 +44,8 @@ from est.gui.XasObjectViewer import (
_plot_masked_chi_weighted_k,
)
from est.gui.larch.xftf import _MXFTFParameters
from orangecontrib.est.widgets.container import _ParameterWindowContainer
from ewokscore.hashing import MissingData
_logger = logging.getLogger(__file__)
......@@ -175,25 +175,15 @@ class XFTFOW(
self._window.xasObjViewer.setWindowTitle("spectra")
# manage settings
larch_settings = self.static_input.get("xftf", None)
if larch_settings is None:
larch_settings = self._larchSettings
if larch_settings != dict():
larch_settings = self.task_input_values.get("xftf", MissingData)
if larch_settings is not MissingData:
self._window._parametersWindow.setParameters(larch_settings)
# connect signals / slots
self._window._parametersWindow.sigChanged.connect(self._updateProcess)
# set up (insure settings will be store
self._update_settings()
def _updateProcess(self):
self._update_settings()
self.handleNewSignals()
def _update_settings(self):
self._larchSettings = self._window._parametersWindow.getParameters()
self.static_input = {
"xftf": self._window._parametersWindow.getParameters(),
"xas_obj": None,
}
self.receiveDynamicInputs(
"xftf", self._window._parametersWindow.getParameters()
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment