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" ...@@ -30,7 +30,6 @@ __date__ = "04/10/2021"
import logging import logging
from Orange.widgets import gui from Orange.widgets import gui
from Orange.widgets.settings import Setting
from silx.gui import qt from silx.gui import qt
from silx.gui.plot import LegendSelector from silx.gui.plot import LegendSelector
import est.core.process.larch.autobk import est.core.process.larch.autobk
...@@ -44,6 +43,7 @@ from est.gui.XasObjectViewer import ( ...@@ -44,6 +43,7 @@ from est.gui.XasObjectViewer import (
) )
from est.gui.larch.autobk import _AutobkParameters from est.gui.larch.autobk import _AutobkParameters
from orangecontrib.est.widgets.container import _ParameterWindowContainer from orangecontrib.est.widgets.container import _ParameterWindowContainer
from ewokscore.hashing import MissingData
_logger = logging.getLogger(__file__) _logger = logging.getLogger(__file__)
...@@ -150,11 +150,6 @@ class AutobkOW( ...@@ -150,11 +150,6 @@ class AutobkOW(
want_main_area = True want_main_area = True
resizing_enabled = 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): def __init__(self):
super().__init__() super().__init__()
self._window = AutobkWindow(parent=self) self._window = AutobkWindow(parent=self)
...@@ -163,26 +158,16 @@ class AutobkOW( ...@@ -163,26 +158,16 @@ class AutobkOW(
self._window.xasObjViewer.setWindowTitle("spectra") self._window.xasObjViewer.setWindowTitle("spectra")
# manage settings # manage settings
larch_settings = self.static_input.get("autobk", None) larch_settings = self.task_input_values.get("autobk", MissingData)
if larch_settings is None: if larch_settings is not MissingData:
larch_settings = self._larchSettings
if larch_settings != dict():
self._window._parametersWindow.setParameters(larch_settings) self._window._parametersWindow.setParameters(larch_settings)
# connect signals / slots # connect signals / slots
self._window._parametersWindow.sigChanged.connect(self._updateProcess) self._window._parametersWindow.sigChanged.connect(self._updateProcess)
# set up (insure settings will be store
self._update_settings()
def _updateProcess(self): def _updateProcess(self):
"""Update settings keeping current xas obj""" """Update settings keeping current xas obj"""
self._update_settings()
self.handleNewSignals() self.handleNewSignals()
self.receiveDynamicInputs(
def _update_settings(self): "autobk", self._window._parametersWindow.getParameters()
self._larchSettings = self._window._parametersWindow.getParameters() )
self.static_input = {
"autobk": self._window._parametersWindow.getParameters(),
"xas_obj": None,
}
...@@ -37,9 +37,9 @@ import est.core.process.larch.mback ...@@ -37,9 +37,9 @@ import est.core.process.larch.mback
from orangecontrib.est.process import _ProcessForOrangeMixIn from orangecontrib.est.process import _ProcessForOrangeMixIn
from est.gui.XasObjectViewer import XasObjectViewer, ViewType from est.gui.XasObjectViewer import XasObjectViewer, ViewType
from est.gui.larch.mback import _MBackParameters from est.gui.larch.mback import _MBackParameters
from est.gui.XasObjectViewer import _plot_norm, _plot_raw, _plot_fpp, _plot_f2 from est.gui.XasObjectViewer import _plot_norm, _plot_raw, _plot_fpp, _plot_f2
from orangecontrib.est.widgets.container import _ParameterWindowContainer from orangecontrib.est.widgets.container import _ParameterWindowContainer
from ewokscore.hashing import MissingData
_logger = logging.getLogger(__file__) _logger = logging.getLogger(__file__)
...@@ -138,10 +138,8 @@ class MbackOW( ...@@ -138,10 +138,8 @@ class MbackOW(
self._window.xasObjViewer.setWindowTitle("spectra") self._window.xasObjViewer.setWindowTitle("spectra")
# manage settings # manage settings
larch_settings = self.static_input.get("mback", None) larch_settings = self.task_input_values.get("mback", MissingData)
if larch_settings is None: if larch_settings is not MissingData:
larch_settings = self._larchSettings
if larch_settings != dict():
self._window._parametersWindow.setParameters(larch_settings) self._window._parametersWindow.setParameters(larch_settings)
# connect signals / slots # connect signals / slots
...@@ -151,12 +149,7 @@ class MbackOW( ...@@ -151,12 +149,7 @@ class MbackOW(
self._update_settings() self._update_settings()
def _updateProcess(self): def _updateProcess(self):
self._update_settings()
self.handleNewSignals() self.handleNewSignals()
self.receiveDynamicInputs(
def _update_settings(self): "mback", self._window._parametersWindow.getParameters()
self._larchSettings = self._window._parametersWindow.getParameters() )
self.static_input = {
"mback": self._window._parametersWindow.getParameters(),
"xas_obj": None,
}
...@@ -39,8 +39,8 @@ from orangecontrib.est.process import _ProcessForOrangeMixIn ...@@ -39,8 +39,8 @@ from orangecontrib.est.process import _ProcessForOrangeMixIn
from est.gui.XasObjectViewer import XasObjectViewer, ViewType from est.gui.XasObjectViewer import XasObjectViewer, ViewType
from est.gui.XasObjectViewer import _plot_norm, _plot_mback_mu from est.gui.XasObjectViewer import _plot_norm, _plot_mback_mu
from est.gui.larch.mback import _MBackParameters from est.gui.larch.mback import _MBackParameters
from orangecontrib.est.widgets.container import _ParameterWindowContainer from orangecontrib.est.widgets.container import _ParameterWindowContainer
from ewokscore.hashing import MissingData
_logger = logging.getLogger(__file__) _logger = logging.getLogger(__file__)
...@@ -141,25 +141,15 @@ class Mback_normOW( ...@@ -141,25 +141,15 @@ class Mback_normOW(
self._window.xasObjViewer.setWindowTitle("spectra") self._window.xasObjViewer.setWindowTitle("spectra")
# manage settings # manage settings
larch_settings = self.static_input.get("mback_norm", None) larch_settings = self.task_input_values.get("mback_norm", MissingData)
if larch_settings is None: if larch_settings is not MissingData:
larch_settings = self._larchSettings
if larch_settings != dict():
self._window._parametersWindow.setParameters(larch_settings) self._window._parametersWindow.setParameters(larch_settings)
# connect signals / slots # connect signals / slots
self._window._parametersWindow.sigChanged.connect(self._updateProcess) self._window._parametersWindow.sigChanged.connect(self._updateProcess)
# set up (insure settings will be store
self._update_settings()
def _updateProcess(self): def _updateProcess(self):
self._update_settings()
self.handleNewSignals() self.handleNewSignals()
self.receiveDynamicInputs(
def _update_settings(self): "mback_norm", self._window._parametersWindow.getParameters()
self._larchSettings = self._window._parametersWindow.getParameters() )
self.static_input = {
"mback_norm": self._window._parametersWindow.getParameters(),
"xas_obj": None,
}
...@@ -45,8 +45,8 @@ from est.gui.XasObjectViewer import ( ...@@ -45,8 +45,8 @@ from est.gui.XasObjectViewer import (
_plot_pre_edge, _plot_pre_edge,
) )
from est.gui.larch.pre_edge import _MPreEdgeParameters from est.gui.larch.pre_edge import _MPreEdgeParameters
from orangecontrib.est.widgets.container import _ParameterWindowContainer from orangecontrib.est.widgets.container import _ParameterWindowContainer
from ewokscore.hashing import MissingData
_logger = logging.getLogger(__file__) _logger = logging.getLogger(__file__)
...@@ -160,26 +160,15 @@ class PreEdgeOW( ...@@ -160,26 +160,15 @@ class PreEdgeOW(
self._window.xasObjViewer.setWindowTitle("spectra") self._window.xasObjViewer.setWindowTitle("spectra")
# manage settings # manage settings
larch_settings = self.static_input.get("pre_edge", None) larch_settings = self.task_input_values.get("pre_edge", MissingData)
if larch_settings is None: if larch_settings is not MissingData:
larch_settings = self._larchSettings
if larch_settings != dict():
self._window._parametersWindow.setParameters(larch_settings) self._window._parametersWindow.setParameters(larch_settings)
# connect signals / slots # connect signals / slots
self._window._parametersWindow.sigChanged.connect(self._updateProcess) self._window._parametersWindow.sigChanged.connect(self._updateProcess)
# set up (insure settings will be store
self._update_settings()
# self.handleNewSignals()
def _updateProcess(self): def _updateProcess(self):
self._update_settings()
self.handleNewSignals() self.handleNewSignals()
self.receiveDynamicInputs(
def _update_settings(self): "pre_edge", self._window._parametersWindow.getParameters()
self._larchSettings = self._window._parametersWindow.getParameters() )
self.static_input = {
"pre_edge": self._window._parametersWindow.getParameters(),
"xas_obj": None,
}
...@@ -44,8 +44,8 @@ from est.gui.XasObjectViewer import ( ...@@ -44,8 +44,8 @@ from est.gui.XasObjectViewer import (
_plot_masked_chi_weighted_k, _plot_masked_chi_weighted_k,
) )
from est.gui.larch.xftf import _MXFTFParameters from est.gui.larch.xftf import _MXFTFParameters
from orangecontrib.est.widgets.container import _ParameterWindowContainer from orangecontrib.est.widgets.container import _ParameterWindowContainer
from ewokscore.hashing import MissingData
_logger = logging.getLogger(__file__) _logger = logging.getLogger(__file__)
...@@ -175,25 +175,15 @@ class XFTFOW( ...@@ -175,25 +175,15 @@ class XFTFOW(
self._window.xasObjViewer.setWindowTitle("spectra") self._window.xasObjViewer.setWindowTitle("spectra")
# manage settings # manage settings
larch_settings = self.static_input.get("xftf", None) larch_settings = self.task_input_values.get("xftf", MissingData)
if larch_settings is None: if larch_settings is not MissingData:
larch_settings = self._larchSettings
if larch_settings != dict():
self._window._parametersWindow.setParameters(larch_settings) self._window._parametersWindow.setParameters(larch_settings)
# connect signals / slots # connect signals / slots
self._window._parametersWindow.sigChanged.connect(self._updateProcess) self._window._parametersWindow.sigChanged.connect(self._updateProcess)
# set up (insure settings will be store
self._update_settings()
def _updateProcess(self): def _updateProcess(self):
self._update_settings()
self.handleNewSignals() self.handleNewSignals()
self.receiveDynamicInputs(
def _update_settings(self): "xftf", self._window._parametersWindow.getParameters()
self._larchSettings = self._window._parametersWindow.getParameters() )
self.static_input = {
"xftf": self._window._parametersWindow.getParameters(),
"xas_obj": None,
}
Supports Markdown
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