Commit e3cd1bdb authored by payno's avatar payno
Browse files

start inheritance from esrf2orange3.bindings.OWESRFWidget

parent 2ee26319
......@@ -159,7 +159,7 @@ class NoiseProcess(Process):
_output_desc(name="xas_obj", type=XASObject, doc=""),
]
def __init__(self, varinfo=varinfo, **inputs):
def __init__(self, varinfo=None, **inputs):
Process.__init__(self, name="noise", varinfo=varinfo, **inputs)
self._window_size = 5
self._polynomial_order = 2
......
......@@ -30,29 +30,11 @@ __date__ = "06/07/2019"
from silx.gui import qt
from Orange.widgets import gui
from Orange.widgets.widget import OWWidget
from esrf2orange3 import OWWidgetTaskExecutor
import logging
_logger = logging.getLogger(__file__)
class OWESRFWidget(OWWidget):
def __init__(self):
self._esrf_executor = OWWidgetTaskExecutor(self)
super().__init__()
# maybe we could create a callback on handleNewSignals when this is created ?
def handleNewSignals(self):
for name, value in self._esrf_executor.dynamic_input_values.items():
self._dynamic_input_form.setParameter(name, value)
self._static_input_form.disable(name)
self._esrf_executor.run()
for name, value in self._esrf_executor.output_values.items():
self._output_form.setParameter(name, value)
class _ProcessForOrangeMixIn(object):
"""
Group processing and progress display in a common class for xasObject
......
......@@ -32,7 +32,7 @@ import functools
import logging
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from orangecontrib.est.process import OWESRFWidget
from esrf2orange3.bindings import OWESRFWidget
from Orange.widgets.widget import Input, Output
import Orange.data
from silx.gui import qt
......@@ -140,7 +140,13 @@ class AutobkWindow(qt.QMainWindow):
)
class AutobkOW(_ProcessForOrangeMixIn, OWESRFWidget):
class AutobkOW(
_ProcessForOrangeMixIn,
OWESRFWidget,
esrftaskclass=est.core.process.larch.autobk.Larch_autobk,
inputnamemap={"xas_obj": "toto"},
outputnamemap={"xas_obj": "toto"},
):
"""
Widget used for signal extraction
"""
......@@ -157,8 +163,6 @@ class AutobkOW(_ProcessForOrangeMixIn, OWESRFWidget):
resizing_enabled = True
allows_cycle = False
esrftaskclass = est.core.process.larch.autobk.Larch_autobk
_larchSettings = Setting(dict())
"""Store the configuration of the PyMca XASClass"""
......@@ -196,7 +200,7 @@ class AutobkOW(_ProcessForOrangeMixIn, OWESRFWidget):
# set up (insure settings will be store
self._update_settings()
self.handleNewSignals()
# self.handleNewSignals()
def _updateProcess(self):
"""Update settings keeping current xas obj"""
......
......@@ -32,7 +32,7 @@ import functools
import logging
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from orangecontrib.est.process import OWESRFWidget
from esrf2orange3.bindings import OWESRFWidget
from Orange.widgets.widget import Input, Output
import Orange.data
from silx.gui import qt
......@@ -113,7 +113,13 @@ class MbackWindow(qt.QMainWindow):
return len(self.xasObjViewer._spectrumViews[0]._plotWidget.getAllCurves())
class MbackOW(_ProcessForOrangeMixIn, OWESRFWidget):
class MbackOW(
_ProcessForOrangeMixIn,
OWESRFWidget,
esrftaskclass=est.core.process.larch.mback.Larch_mback,
inputnamemap={"xas_obj": "toto"},
outputnamemap={"xas_obj": "toto"},
):
"""
Widget used for signal extraction
"""
......@@ -133,8 +139,6 @@ class MbackOW(_ProcessForOrangeMixIn, OWESRFWidget):
resizing_enabled = True
allows_cycle = False
esrftaskclass = est.core.process.larch.mback.Larch_mback
_larchSettings = Setting(dict())
"""Store the configuration of the larch configuration"""
......@@ -171,7 +175,7 @@ class MbackOW(_ProcessForOrangeMixIn, OWESRFWidget):
# set up (insure settings will be store
self._update_settings()
self.handleNewSignals()
# self.handleNewSignals()
def _updateProcess(self):
self._update_settings()
......
......@@ -32,7 +32,7 @@ import functools
import logging
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from orangecontrib.est.process import OWESRFWidget
from esrf2orange3.bindings import OWESRFWidget
from Orange.widgets.widget import Input, Output
import Orange.data
from silx.gui import qt
......@@ -113,7 +113,13 @@ class Mback_normWindow(qt.QMainWindow):
return len(self.xasObjViewer._spectrumViews[0]._plotWidget.getAllCurves())
class Mback_normOW(_ProcessForOrangeMixIn, OWESRFWidget):
class Mback_normOW(
_ProcessForOrangeMixIn,
OWESRFWidget,
esrftaskclass=est.core.process.larch.mback_norm.Larch_mback_norm,
inputnamemap={"xas_obj": "toto"},
outputnamemap={"xas_obj": "toto"},
):
"""
Widget used for signal extraction
"""
......@@ -133,8 +139,6 @@ class Mback_normOW(_ProcessForOrangeMixIn, OWESRFWidget):
resizing_enabled = True
allows_cycle = False
esrftaskclass = est.core.process.larch.mback_norm.Larch_mback_norm
_larchSettings = Setting(dict())
"""Store the configuration of the larch configuration"""
......@@ -171,7 +175,7 @@ class Mback_normOW(_ProcessForOrangeMixIn, OWESRFWidget):
# set up (insure settings will be store
self._update_settings()
self.handleNewSignals()
# self.handleNewSignals()
def _updateProcess(self):
self._update_settings()
......
......@@ -32,7 +32,7 @@ import functools
import logging
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from orangecontrib.est.process import OWESRFWidget
from esrf2orange3.bindings import OWESRFWidget
from Orange.widgets.widget import Input, Output
import Orange.data
from silx.gui import qt
......@@ -127,7 +127,13 @@ class _PreEdgeWindow(qt.QMainWindow):
return len(self.xasObjViewer._spectrumViews[0]._plotWidget.getAllCurves())
class PreEdgeOW(_ProcessForOrangeMixIn, OWESRFWidget):
class PreEdgeOW(
_ProcessForOrangeMixIn,
OWESRFWidget,
esrftaskclass=est.core.process.larch.pre_edge.Larch_pre_edge,
inputnamemap={"xas_obj": "toto"},
outputnamemap={"xas_obj": "toto"},
):
"""
Widget used for signal extraction
"""
......@@ -152,8 +158,6 @@ class PreEdgeOW(_ProcessForOrangeMixIn, OWESRFWidget):
resizing_enabled = True
allows_cycle = False
esrftaskclass = est.core.process.larch.pre_edge.Larch_pre_edge
_larchSettings = Setting(dict())
"""Store the configuration of the larch configuration"""
......@@ -190,7 +194,7 @@ class PreEdgeOW(_ProcessForOrangeMixIn, OWESRFWidget):
# set up (insure settings will be store
self._update_settings()
self.handleNewSignals()
# self.handleNewSignals()
def _updateProcess(self):
self._update_settings()
......
......@@ -32,7 +32,7 @@ import functools
import logging
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from orangecontrib.est.process import OWESRFWidget
from esrf2orange3.bindings import OWESRFWidget
from Orange.widgets.widget import Input, Output
import Orange.data
from silx.gui import qt
......@@ -149,7 +149,13 @@ class XFTFWindow(qt.QMainWindow):
self._parametersWindow._mainwidget.setRWeight(kweight)
class XFTFOW(_ProcessForOrangeMixIn, OWESRFWidget):
class XFTFOW(
_ProcessForOrangeMixIn,
OWESRFWidget,
esrftaskclass=est.core.process.larch.xftf.Larch_xftf,
inputnamemap={"xas_obj": "toto"},
outputnamemap={"xas_obj": "toto"},
):
"""
Widget used for signal extraction
"""
......@@ -169,8 +175,6 @@ class XFTFOW(_ProcessForOrangeMixIn, OWESRFWidget):
resizing_enabled = True
allows_cycle = False
esrftaskclass = est.core.process.larch.xftf.Larch_xftf
_larchSettings = Setting(dict())
"""Store the configuration of the larch configuration"""
......@@ -208,7 +212,7 @@ class XFTFOW(_ProcessForOrangeMixIn, OWESRFWidget):
# set up (insure settings will be store
self._update_settings()
self.handleNewSignals()
# self.handleNewSignals()
def _updateProcess(self):
self._update_settings()
......
......@@ -33,7 +33,7 @@ import logging
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from orangecontrib.est.process import OWESRFWidget
from esrf2orange3.bindings import OWESRFWidget
from Orange.widgets.widget import Input, Output
import Orange.data
from est.core.types import XASObject
......@@ -117,7 +117,13 @@ class ExafsWindow(qt.QMainWindow):
)
class ExafsOW(_ProcessForOrangeMixIn, OWESRFWidget):
class ExafsOW(
_ProcessForOrangeMixIn,
OWESRFWidget,
esrftaskclass=est.core.process.pymca.exafs.PyMca_exafs,
inputnamemap={"xas_obj": "toto"},
outputnamemap={"xas_obj": "toto"},
):
"""
Widget used for signal extraction
"""
......@@ -134,8 +140,6 @@ class ExafsOW(_ProcessForOrangeMixIn, OWESRFWidget):
resizing_enabled = True
allows_cycle = False
esrftaskclass = est.core.process.pymca.exafs.PyMca_exafs
_larchSettings = Setting(dict())
"""Store the configuration of the PyMca XASClass"""
......@@ -169,7 +173,7 @@ class ExafsOW(_ProcessForOrangeMixIn, OWESRFWidget):
# signal / slot connection
self._window._pymcaWindow.sigChanged.connect(self._updateProcess)
self.handleNewSignals()
# self.handleNewSignals()
def _updateProcess(self):
self._update_settings()
......
......@@ -33,7 +33,7 @@ import logging
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from orangecontrib.est.process import OWESRFWidget
from esrf2orange3.bindings import OWESRFWidget
from Orange.widgets.widget import Input, Output
import Orange.data
from PyMca5.PyMcaGui.physics.xas.XASFourierTransformParameters import (
......@@ -135,7 +135,13 @@ class FTWindow(qt.QMainWindow):
)
class FTOW(_ProcessForOrangeMixIn, OWESRFWidget):
class FTOW(
_ProcessForOrangeMixIn,
OWESRFWidget,
esrftaskclass=est.core.process.pymca.ft.PyMca_ft,
inputnamemap={"xas_obj": "toto"},
outputnamemap={"xas_obj": "toto"},
):
"""
Widget used for signal extraction
"""
......@@ -152,8 +158,6 @@ class FTOW(_ProcessForOrangeMixIn, OWESRFWidget):
resizing_enabled = True
allows_cycle = False
esrftaskclass = est.core.process.pymca.ft.PyMca_ft
_pymcaSettings = Setting(dict())
"""Store the configuration of the PyMca XASClass"""
......@@ -186,7 +190,7 @@ class FTOW(_ProcessForOrangeMixIn, OWESRFWidget):
# connect signals / slots
self._window._pymcaWindow.sigChanged.connect(self._updateProcess)
self.handleNewSignals()
# self.handleNewSignals()
def _updateProcess(self, *arv, **kwargs):
self._update_settings()
......
......@@ -32,7 +32,7 @@ import logging
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from orangecontrib.est.process import OWESRFWidget
from esrf2orange3.bindings import OWESRFWidget
from Orange.widgets.widget import Input, Output
import Orange.data
from silx.gui import qt
......@@ -66,7 +66,13 @@ class KWeightWindow(qt.QMainWindow):
self.setWindowFlags(qt.Qt.Widget)
class KWeightOW(_ProcessForOrangeMixIn, OWESRFWidget):
class KWeightOW(
_ProcessForOrangeMixIn,
OWESRFWidget,
esrftaskclass=est.core.process.pymca.k_weight.PyMca_k_weight,
inputnamemap={"xas_obj": "toto"},
outputnamemap={"xas_obj": "toto"},
):
"""
Widget used for signal extraction
"""
......@@ -83,8 +89,6 @@ class KWeightOW(_ProcessForOrangeMixIn, OWESRFWidget):
resizing_enabled = True
allows_cycle = False
esrftaskclass = est.core.process.pymca.k_weight.PyMca_k_weight
_kWeightSetting = Setting(int(3))
"""Store the configuration of the PyMca XASClass"""
......@@ -116,7 +120,7 @@ class KWeightOW(_ProcessForOrangeMixIn, OWESRFWidget):
# signal / slot connection
self._window._k_spin_box.valueChanged.connect(self._updateProcess)
self.handleNewSignals()
# self.handleNewSignals()
def _updateProcess(self, *arv, **kwargs):
self._update_settings()
......
......@@ -33,7 +33,7 @@ import logging
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from orangecontrib.est.process import OWESRFWidget
from esrf2orange3.bindings import OWESRFWidget
from Orange.widgets.widget import Input, Output
import Orange.data
from PyMca5.PyMcaGui.physics.xas.XASNormalizationParameters import (
......@@ -183,7 +183,13 @@ class NormalizationWindow(qt.QMainWindow):
)
class NormalizationOW(_ProcessForOrangeMixIn, OWESRFWidget):
class NormalizationOW(
_ProcessForOrangeMixIn,
OWESRFWidget,
esrftaskclass=est.core.process.pymca.normalization.PyMca_normalization,
inputnamemap={"xas_obj": "toto"},
outputnamemap={"xas_obj": "toto"},
):
"""
Widget used for signal extraction
"""
......@@ -200,8 +206,6 @@ class NormalizationOW(_ProcessForOrangeMixIn, OWESRFWidget):
resizing_enabled = True
allows_cycle = False
esrftaskclass = est.core.process.pymca.normalization.PyMca_normalization
_pymcaSettings = Setting(dict())
"""Store the configuration of the PyMca XASClass"""
......@@ -218,6 +222,7 @@ class NormalizationOW(_ProcessForOrangeMixIn, OWESRFWidget):
def __init__(self):
super().__init__()
# super().__init__()
self._latest_xas_obj = None
self._window = NormalizationWindow(parent=self)
layout = gui.vBox(self.mainArea, "normalization").layout()
......@@ -239,7 +244,7 @@ class NormalizationOW(_ProcessForOrangeMixIn, OWESRFWidget):
self._getE0FrmDialog
)
self.handleNewSignals()
# self.handleNewSignals()
def _updateProcess(self):
self._update_settings()
......
......@@ -28,15 +28,14 @@ __license__ = "MIT"
__date__ = "08/08/2019"
from orangecontrib.est.process import OWESRFWidget
from Orange.widgets.widget import Input, Output
from est.core.types import XASObject
from orangecontrib.est.utils import Converter
import Orange.data
import est.core.process.ignoreprocess
from Orange.widgets.widget import OWWidget
class ConverterOW(OWESRFWidget):
class ConverterOW(OWWidget):
"""
Offer a conversion from XASObject to Orange.data.Table, commonly used
from Orange widget
......@@ -64,8 +63,6 @@ class ConverterOW(OWESRFWidget):
# by default we want to avoid sending 'Orange.data.Table' to avoid
# loosing the XASObject flow process and results.
esrftaskclass = est.core.process.ignoreprocess.IgnoreOrangeConversion
@Inputs.xas_obj
def process(self, xas_object):
if xas_object is None:
......
......@@ -30,7 +30,7 @@ __date__ = "02/10/2018"
import logging
from Orange.widgets import gui
from orangecontrib.est.process import OWESRFWidget
from esrf2orange3.bindings import OWESRFWidget
from Orange.widgets.widget import Input, Output
import Orange.data
from orangecontrib.est.utils import Converter
......@@ -44,7 +44,12 @@ from est.gui.e0calculator import E0Calculator, E0ComputationMethod
_logger = logging.getLogger(__file__)
class E0calculatorOW(OWESRFWidget):
class E0calculatorOW(
OWESRFWidget,
esrftaskclass=est.core.process.ignoreprocess.IgnoreE0Calculation,
inputnamemap={"xas_obj": "toto"},
outputnamemap={"xas_obj": "toto"},
):
"""
Widget used to make compute E0 from the dataset.
"""
......@@ -66,10 +71,6 @@ class E0calculatorOW(OWESRFWidget):
"Region of Interest",
]
# I guess this one should not be ignored. We should at least have
# some settings management or an algorithm to find E0
esrftaskclass = est.core.process.ignoreprocess.IgnoreE0Calculation
want_main_area = True
resizing_enabled = True
compress_signal = False
......@@ -115,7 +116,7 @@ class E0calculatorOW(OWESRFWidget):
# set up
self._buttons.hide()
self.handleNewSignals()
# self.handleNewSignals()
def validateMethodToUse(self, method):
"""Define the method to use and close the dialog"""
......
......@@ -31,7 +31,7 @@ import logging
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from orangecontrib.est.process import OWESRFWidget
from esrf2orange3.bindings import OWESRFWidget
from Orange.widgets.widget import Input, Output
import Orange.data
from orangecontrib.est.utils import Converter
......@@ -44,7 +44,12 @@ from est.gui.energyroi import EnergyRoiWidget
_logger = logging.getLogger(__file__)
class EnergyRoiOW(OWESRFWidget):
class EnergyRoiOW(
OWESRFWidget,
esrftaskclass=est.core.process.energyroi.EnergyROIProcess,
inputnamemap={"xas_obj": "toto"},
outputnamemap={"xas_obj": "toto"},
):
"""
Widget used to make the selection of a region of Interest to treat in a
Dataset.
......@@ -67,8 +72,6 @@ class EnergyRoiOW(OWESRFWidget):
"energy",
]
esrftaskclass = est.core.process.energyroi.EnergyROIProcess
want_main_area = True
resizing_enabled = True
compress_signal = False
......@@ -109,7 +112,7 @@ class EnergyRoiOW(OWESRFWidget):
self.setROI = self._widget.setROI
self.getROI = self._widget.getROI
self.handleNewSignals()
# self.handleNewSignals()
@Inputs.data_table
def processFrmDataTable(self, data_table):
......
......@@ -31,7 +31,7 @@ import logging
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from orangecontrib.est.process import OWESRFWidget
from esrf2orange3.bindings import OWESRFWidget
from Orange.widgets.widget import Input, Output
from orangecontrib.est.progress import QProgress
from orangecontrib.est.process import ProcessRunnable
......@@ -47,7 +47,13 @@ from est.gui.noise import SavitskyGolayNoise
_logger = logging.getLogger(__file__)
class NoiseOW(_ProcessForOrangeMixIn, OWESRFWidget):
class NoiseOW(
_ProcessForOrangeMixIn,
OWESRFWidget,
esrftaskclass=est.core.process.noise.NoiseProcess,
inputnamemap={"xas_obj": "toto"},
outputnamemap={"xas_obj": "toto"},
):
"""
Widget used to make the selection of a region of Interest to treat in a
Dataset.
......@@ -62,8 +68,6 @@ class NoiseOW(_ProcessForOrangeMixIn, OWESRFWidget):
category = "esrfWidgets"
keywords = ["dataset", "data", "noise"]
esrftaskclass = est.core.process.noise.NoiseProcess
want_main_area = True
resizing_enabled = True
compress_signal = False
......@@ -121,7 +125,7 @@ class NoiseOW(_ProcessForOrangeMixIn, OWESRFWidget):
# connect signals / slots
self._window.sigChanged.connect(self._updateProcess)
self.handleNewSignals()
# self.handleNewSignals()
def _updateProcess(self, *arv, **kwargs):
self._update_settings()
......
......@@ -31,7 +31,7 @@ import logging
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from orangecontrib.est.process import OWESRFWidget
from esrf2orange3.bindings import OWESRFWidget
from Orange.widgets.widget import Input, Output
import Orange.data
from orangecontrib.est.utils import Converter
......@@ -44,7 +44,12 @@ from est.gui.roiselector import ROISelector
_logger = logging.getLogger(__file__)
class RoiSelectionOW(OWESRFWidget):
class RoiSelectionOW(
OWESRFWidget,
esrftaskclass=est.core.process.roi.ROIProcess,
inputnamemap={"xas_obj": "toto"},
outputnamemap={"xas_obj": "toto"},
):
"""
Widget used to make the selection of a region of Interest to treat in a
Dataset.
......@@ -59,8 +64,6 @@ class RoiSelectionOW(OWESRFWidget):
category = "esrfWidgets"
keywords = ["dataset", "data", "selection", "ROI", "Region of Interest"]
esrftaskclass = est.core.process.roi.ROIProcess
want_main_area = True
resizing_enabled = True
compress_signal = False
......@@ -102,7 +105,7 @@ class RoiSelectionOW(OWESRFWidget):
self.setROI = self._widget.setROI
self.getROI = self._widget.getROI
self.handleNewSignals()
# self.handleNewSignals()
@Inputs.data_table
def processFrmDataTable(self, data_table):
......
......@@ -31,7 +31,7 @@ __date__ = "06/11/2019"
import logging
from Orange.widgets import gui
from Orange.widgets.settings import Setting