Commit c5320e77 authored by payno's avatar payno
Browse files

[ewoks] complete conversion to ewoks structure

- complete signature to be `run`
- fix test
- orangecontrib: make inheritance to `Registered` instead of `OWEwoksWidget`
Because `OWEwoksWidget` enforce to use the defined ewokstaskclass which is not something we want for now (avoid task associated with gui, processes on threads...)
parent 8ba5956d
Pipeline #51171 failed with stages
in 7 minutes and 41 seconds
...@@ -118,7 +118,7 @@ class TestStreamSingleSpectrum(unittest.TestCase): ...@@ -118,7 +118,7 @@ class TestStreamSingleSpectrum(unittest.TestCase):
out = PyMca_normalization(inputs={"xas_obj": out})() out = PyMca_normalization(inputs={"xas_obj": out})()
exafs_process = PyMca_exafs(inputs={"xas_obj": out}) exafs_process = PyMca_exafs(inputs={"xas_obj": out})
exafs_process.setConfiguration(configuration=self.exafs_configuration) exafs_process.setConfiguration(configuration=self.exafs_configuration)
out = exafs_process(xas_obj=out) out = exafs_process()
kweight_process = PyMca_k_weight(inputs={"xas_obj": out}) kweight_process = PyMca_k_weight(inputs={"xas_obj": out})
kweight_process.setConfiguration({"k_weight": 0}) kweight_process.setConfiguration({"k_weight": 0})
out = kweight_process() out = kweight_process()
...@@ -183,12 +183,12 @@ class TestWorkflowAndH5LinkedFile(unittest.TestCase): ...@@ -183,12 +183,12 @@ class TestWorkflowAndH5LinkedFile(unittest.TestCase):
"KMax": 2.3, "KMax": 2.3,
} }
exafs_process.setConfiguration(configuration=configuration) exafs_process.setConfiguration(configuration=configuration)
out = exafs_process(xas_obj=out) out = exafs_process()
k_weight_process = PyMca_k_weight(inputs={"xas_obj": out}) k_weight_process = PyMca_k_weight(inputs={"xas_obj": out})
k_weight_process.setConfiguration({"k_weight": 0}) k_weight_process.setConfiguration({"k_weight": 0})
out = k_weight_process(xas_obj=out) out = k_weight_process()
out = PyMca_ft(inputs={"xas_obj": out})() out = PyMca_ft(inputs={"xas_obj": out})()
out = PyMca_normalization(inputs={"xas_obj": out})(xas_obj=out) out = PyMca_normalization(inputs={"xas_obj": out})()
assert isinstance(out, XASObject) assert isinstance(out, XASObject)
assert out.linked_h5_file is self.h5_file assert out.linked_h5_file is self.h5_file
# then check all process are correctly registered with the valid id... # then check all process are correctly registered with the valid id...
...@@ -218,9 +218,9 @@ class TestWorkflowAndH5LinkedFile(unittest.TestCase): ...@@ -218,9 +218,9 @@ class TestWorkflowAndH5LinkedFile(unittest.TestCase):
} }
exafs_process.setConfiguration(configuration=configuration) exafs_process.setConfiguration(configuration=configuration)
out = exafs_process() out = exafs_process()
k_weight_process = PyMca_k_weight(inputs={"xas_obj": out}) k_weight_process = PyMca_k_weight(inputs={"xas_obj": out.to_dict()})
k_weight_process.setConfiguration({"k_weight": 0}) k_weight_process.setConfiguration({"k_weight": 0})
out = k_weight_process(xas_obj=out.to_dict()) out = k_weight_process()
out = PyMca_ft(inputs={"xas_obj": out.to_dict()})() out = PyMca_ft(inputs={"xas_obj": out.to_dict()})()
out = PyMca_normalization(inputs={"xas_obj": out.to_dict()})() out = PyMca_normalization(inputs={"xas_obj": out.to_dict()})()
assert isinstance(out, XASObject) assert isinstance(out, XASObject)
......
...@@ -147,5 +147,4 @@ class ProcessQThread(qt.QThread): ...@@ -147,5 +147,4 @@ class ProcessQThread(qt.QThread):
self._process_obj = process_obj self._process_obj = process_obj
def run(self): def run(self):
return self._xas_obj = self._process_obj()
# self._xas_obj = self._process_obj({"xas_obj": self._xas_obj}).run()
...@@ -32,7 +32,7 @@ import functools ...@@ -32,7 +32,7 @@ import functools
import logging import logging
from Orange.widgets import gui from Orange.widgets import gui
from Orange.widgets.settings import Setting from Orange.widgets.settings import Setting
from ewoksorange.bindings import OWEwoksWidget from Orange.widgets.widget import OWWidget
from Orange.widgets.widget import Input, Output from Orange.widgets.widget import Input, Output
import Orange.data import Orange.data
from silx.gui import qt from silx.gui import qt
...@@ -52,6 +52,7 @@ from est.gui.larch.autobk import _AutobkParameters ...@@ -52,6 +52,7 @@ from est.gui.larch.autobk import _AutobkParameters
from orangecontrib.est.progress import QProgress from orangecontrib.est.progress import QProgress
from orangecontrib.est.utils import Converter from orangecontrib.est.utils import Converter
from orangecontrib.est.widgets.container import _ParameterWindowContainer from orangecontrib.est.widgets.container import _ParameterWindowContainer
from ewokscore.registration import Registered
_logger = logging.getLogger(__file__) _logger = logging.getLogger(__file__)
...@@ -140,13 +141,7 @@ class AutobkWindow(qt.QMainWindow): ...@@ -140,13 +141,7 @@ class AutobkWindow(qt.QMainWindow):
) )
class AutobkOW( class AutobkOW(_ProcessForOrangeMixIn, OWWidget, Registered):
_ProcessForOrangeMixIn,
OWEwoksWidget,
ewokstaskclass=est.core.process.larch.autobk.Larch_autobk,
inputnamemap={},
outputnamemap={},
):
""" """
Widget used for signal extraction Widget used for signal extraction
""" """
...@@ -166,6 +161,8 @@ class AutobkOW( ...@@ -166,6 +161,8 @@ class AutobkOW(
_larchSettings = Setting(dict()) _larchSettings = Setting(dict())
"""Store the configuration of the PyMca XASClass""" """Store the configuration of the PyMca XASClass"""
ewokstaskclass = est.core.process.larch.autobk.Larch_autobk
class Inputs: class Inputs:
xas_obj = Input("xas_obj", XASObject, default=True) xas_obj = Input("xas_obj", XASObject, default=True)
# simple compatibility for some Orange widget and especialy the # simple compatibility for some Orange widget and especialy the
...@@ -232,10 +229,11 @@ class AutobkOW( ...@@ -232,10 +229,11 @@ class AutobkOW(
self._startProcess() self._startProcess()
# setup the normalization process # setup the normalization process
inputs = {"xas_obj": xas_obj}
if _USE_THREAD is True: if _USE_THREAD is True:
# note: for now with larch with cannot do thread computation (see # note: for now with larch with cannot do thread computation (see
# PreEdgeOW ) # PreEdgeOW )
process_obj = QLarch_autobk() process_obj = QLarch_autobk(inputs=inputs)
process_obj._advancement.sigProgress.connect(self._setProgressValue) process_obj._advancement.sigProgress.connect(self._setProgressValue)
process_obj.set_properties( process_obj.set_properties(
{"_larchSettings": self._window._parametersWindow.getParameters()} {"_larchSettings": self._window._parametersWindow.getParameters()}
...@@ -254,7 +252,7 @@ class AutobkOW( ...@@ -254,7 +252,7 @@ class AutobkOW(
# manage advancement # manage advancement
self._advancement.setAdvancement(0) self._advancement.setAdvancement(0)
self._advancement.setMaxSpectrum(self._latest_xas_obj.n_spectrum) self._advancement.setMaxSpectrum(self._latest_xas_obj.n_spectrum)
process_obj = est.core.process.larch.autobk.Larch_autobk() process_obj = est.core.process.larch.autobk.Larch_autobk(inputs=inputs)
process_obj.advancement = self._advancement process_obj.advancement = self._advancement
process_obj.set_properties( process_obj.set_properties(
{"_larchSettings": self._window._parametersWindow.getParameters()} {"_larchSettings": self._window._parametersWindow.getParameters()}
...@@ -263,7 +261,7 @@ class AutobkOW( ...@@ -263,7 +261,7 @@ class AutobkOW(
# to avoid gui freeze, processevents after each spectrum process # to avoid gui freeze, processevents after each spectrum process
process_obj.addCallback(qt.QApplication.instance().processEvents) process_obj.addCallback(qt.QApplication.instance().processEvents)
process_obj.addCallback(self._advancement.increaseAdvancement) process_obj.addCallback(self._advancement.increaseAdvancement)
process_obj.process(self._latest_xas_obj) process_obj.run()
self._callback_finish = None self._callback_finish = None
self._endProcess(self._latest_xas_obj) self._endProcess(self._latest_xas_obj)
...@@ -273,8 +271,8 @@ class QLarch_autobk(est.core.process.larch.autobk.Larch_autobk): ...@@ -273,8 +271,8 @@ class QLarch_autobk(est.core.process.larch.autobk.Larch_autobk):
Normalization able to give advancement using qt.Signal and QThreadPool Normalization able to give advancement using qt.Signal and QThreadPool
""" """
def __init__(self): def __init__(self, *args, **kwargs):
est.core.process.larch.autobk.Larch_autobk.__init__(self) est.core.process.larch.autobk.Larch_autobk.__init__(self, *args, **kwargs)
self._advancement = QProgress("autobk") self._advancement = QProgress("autobk")
def _pool_process(self, xas_obj): def _pool_process(self, xas_obj):
......
...@@ -32,7 +32,7 @@ import functools ...@@ -32,7 +32,7 @@ import functools
import logging import logging
from Orange.widgets import gui from Orange.widgets import gui
from Orange.widgets.settings import Setting from Orange.widgets.settings import Setting
from ewoksorange.bindings import OWEwoksWidget from Orange.widgets.widget import OWWidget
from Orange.widgets.widget import Input, Output from Orange.widgets.widget import Input, Output
import Orange.data import Orange.data
from silx.gui import qt from silx.gui import qt
...@@ -47,6 +47,7 @@ from orangecontrib.est.progress import QProgress ...@@ -47,6 +47,7 @@ from orangecontrib.est.progress import QProgress
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.utils import Converter from orangecontrib.est.utils import Converter
from orangecontrib.est.widgets.container import _ParameterWindowContainer from orangecontrib.est.widgets.container import _ParameterWindowContainer
from ewokscore.registration import Registered
_logger = logging.getLogger(__file__) _logger = logging.getLogger(__file__)
...@@ -113,13 +114,7 @@ class MbackWindow(qt.QMainWindow): ...@@ -113,13 +114,7 @@ class MbackWindow(qt.QMainWindow):
return len(self.xasObjViewer._spectrumViews[0]._plotWidget.getAllCurves()) return len(self.xasObjViewer._spectrumViews[0]._plotWidget.getAllCurves())
class MbackOW( class MbackOW(_ProcessForOrangeMixIn, OWWidget, Registered):
_ProcessForOrangeMixIn,
OWEwoksWidget,
ewokstaskclass=est.core.process.larch.mback.Larch_mback,
inputnamemap={},
outputnamemap={},
):
""" """
Widget used for signal extraction Widget used for signal extraction
""" """
...@@ -142,6 +137,8 @@ class MbackOW( ...@@ -142,6 +137,8 @@ class MbackOW(
_larchSettings = Setting(dict()) _larchSettings = Setting(dict())
"""Store the configuration of the larch configuration""" """Store the configuration of the larch configuration"""
ewokstaskclass = est.core.process.larch.mback.Larch_mback
class Inputs: class Inputs:
xas_obj = Input("xas_obj", XASObject, default=True) xas_obj = Input("xas_obj", XASObject, default=True)
# simple compatibility for some Orange widget and especialy the # simple compatibility for some Orange widget and especialy the
...@@ -206,10 +203,11 @@ class MbackOW( ...@@ -206,10 +203,11 @@ class MbackOW(
self._startProcess() self._startProcess()
# setup the normalization process # setup the normalization process
inputs = {"xas_obj": xas_obj}
if _USE_THREAD is True: if _USE_THREAD is True:
# note: for now with larch with cannot do thread computation (see # note: for now with larch with cannot do thread computation (see
# PreEdgeOW ) # PreEdgeOW )
process_obj = QLarch_mback() process_obj = QLarch_mback(inputs=inputs)
process_obj._advancement.sigProgress.connect(self._setProgressValue) process_obj._advancement.sigProgress.connect(self._setProgressValue)
process_obj.set_properties( process_obj.set_properties(
{"_larchSettings": self._window._parametersWindow.getParameters()} {"_larchSettings": self._window._parametersWindow.getParameters()}
...@@ -227,7 +225,7 @@ class MbackOW( ...@@ -227,7 +225,7 @@ class MbackOW(
# manage advancement # manage advancement
self._advancement.setAdvancement(0) self._advancement.setAdvancement(0)
self._advancement.setMaxSpectrum(self._latest_xas_obj.n_spectrum) self._advancement.setMaxSpectrum(self._latest_xas_obj.n_spectrum)
process_obj = est.core.process.larch.mback.Larch_mback() process_obj = est.core.process.larch.mback.Larch_mback(inputs=inputs)
process_obj.advancement = self._advancement process_obj.advancement = self._advancement
process_obj.set_properties( process_obj.set_properties(
{"_larchSettings": self._window._parametersWindow.getParameters()} {"_larchSettings": self._window._parametersWindow.getParameters()}
...@@ -236,7 +234,7 @@ class MbackOW( ...@@ -236,7 +234,7 @@ class MbackOW(
# to avoid gui freeze, processevents after each spectrum process # to avoid gui freeze, processevents after each spectrum process
process_obj.addCallback(qt.QApplication.instance().processEvents) process_obj.addCallback(qt.QApplication.instance().processEvents)
process_obj.addCallback(self._advancement.increaseAdvancement) process_obj.addCallback(self._advancement.increaseAdvancement)
process_obj.process(self._latest_xas_obj) process_obj.run()
self._callback_finish = None self._callback_finish = None
self._endProcess(self._latest_xas_obj) self._endProcess(self._latest_xas_obj)
...@@ -246,8 +244,8 @@ class QLarch_mback(est.core.process.larch.mback.Larch_mback): ...@@ -246,8 +244,8 @@ class QLarch_mback(est.core.process.larch.mback.Larch_mback):
Normalization able to give advancement using qt.Signal and QThreadPool Normalization able to give advancement using qt.Signal and QThreadPool
""" """
def __init__(self): def __init__(self, *args, **kwargs):
est.core.process.larch.mback.Larch_mback.__init__(self) est.core.process.larch.mback.Larch_mback.__init__(self, *args, **kwargs)
self._advancement = QProgress("mback") self._advancement = QProgress("mback")
def _pool_process(self, xas_obj): def _pool_process(self, xas_obj):
......
...@@ -32,7 +32,7 @@ import functools ...@@ -32,7 +32,7 @@ import functools
import logging import logging
from Orange.widgets import gui from Orange.widgets import gui
from Orange.widgets.settings import Setting from Orange.widgets.settings import Setting
from ewoksorange.bindings import OWEwoksWidget from Orange.widgets.widget import OWWidget
from Orange.widgets.widget import Input, Output from Orange.widgets.widget import Input, Output
import Orange.data import Orange.data
from silx.gui import qt from silx.gui import qt
...@@ -47,6 +47,7 @@ from est.gui.larch.mback import _MBackParameters ...@@ -47,6 +47,7 @@ from est.gui.larch.mback import _MBackParameters
from orangecontrib.est.progress import QProgress from orangecontrib.est.progress import QProgress
from orangecontrib.est.utils import Converter from orangecontrib.est.utils import Converter
from orangecontrib.est.widgets.container import _ParameterWindowContainer from orangecontrib.est.widgets.container import _ParameterWindowContainer
from ewokscore.registration import Registered
_logger = logging.getLogger(__file__) _logger = logging.getLogger(__file__)
...@@ -115,10 +116,8 @@ class Mback_normWindow(qt.QMainWindow): ...@@ -115,10 +116,8 @@ class Mback_normWindow(qt.QMainWindow):
class Mback_normOW( class Mback_normOW(
_ProcessForOrangeMixIn, _ProcessForOrangeMixIn,
OWEwoksWidget, OWWidget,
ewokstaskclass=est.core.process.larch.mback_norm.Larch_mback_norm, Registered,
inputnamemap={},
outputnamemap={},
): ):
""" """
Widget used for signal extraction Widget used for signal extraction
...@@ -138,6 +137,7 @@ class Mback_normOW( ...@@ -138,6 +137,7 @@ class Mback_normOW(
want_main_area = True want_main_area = True
resizing_enabled = True resizing_enabled = True
allows_cycle = False allows_cycle = False
ewokstaskclass = est.core.process.larch.mback_norm.Larch_mback_norm
_larchSettings = Setting(dict()) _larchSettings = Setting(dict())
"""Store the configuration of the larch configuration""" """Store the configuration of the larch configuration"""
...@@ -206,10 +206,11 @@ class Mback_normOW( ...@@ -206,10 +206,11 @@ class Mback_normOW(
self._startProcess() self._startProcess()
# setup the normalization process # setup the normalization process
inputs = {"xas_obj": xas_obj}
if _USE_THREAD is True: if _USE_THREAD is True:
# note: for now with larch with cannot do thread computation (see # note: for now with larch with cannot do thread computation (see
# PreEdgeOW ) # PreEdgeOW )
process_obj = QLarch_mback_norm() process_obj = QLarch_mback_norm(inputs=inputs)
process_obj._advancement.sigProgress.connect(self._setProgressValue) process_obj._advancement.sigProgress.connect(self._setProgressValue)
process_obj.set_properties( process_obj.set_properties(
{"_larchSettings": self._window._parametersWindow.getParameters()} {"_larchSettings": self._window._parametersWindow.getParameters()}
...@@ -227,7 +228,9 @@ class Mback_normOW( ...@@ -227,7 +228,9 @@ class Mback_normOW(
# manage advancement # manage advancement
self._advancement.setAdvancement(0) self._advancement.setAdvancement(0)
self._advancement.setMaxSpectrum(self._latest_xas_obj.n_spectrum) self._advancement.setMaxSpectrum(self._latest_xas_obj.n_spectrum)
process_obj = est.core.process.larch.mback_norm.Larch_mback_norm() process_obj = est.core.process.larch.mback_norm.Larch_mback_norm(
inputs=inputs
)
process_obj.advancement = self._advancement process_obj.advancement = self._advancement
process_obj.set_properties( process_obj.set_properties(
{"_larchSettings": self._window._parametersWindow.getParameters()} {"_larchSettings": self._window._parametersWindow.getParameters()}
...@@ -236,7 +239,7 @@ class Mback_normOW( ...@@ -236,7 +239,7 @@ class Mback_normOW(
# to avoid gui freeze, processevents after each spectrum process # to avoid gui freeze, processevents after each spectrum process
process_obj.addCallback(qt.QApplication.instance().processEvents) process_obj.addCallback(qt.QApplication.instance().processEvents)
process_obj.addCallback(self._advancement.increaseAdvancement) process_obj.addCallback(self._advancement.increaseAdvancement)
process_obj.process(self._latest_xas_obj) process_obj.run()
self._callback_finish = None self._callback_finish = None
self._endProcess(self._latest_xas_obj) self._endProcess(self._latest_xas_obj)
...@@ -246,8 +249,10 @@ class QLarch_mback_norm(est.core.process.larch.mback_norm.Larch_mback_norm): ...@@ -246,8 +249,10 @@ class QLarch_mback_norm(est.core.process.larch.mback_norm.Larch_mback_norm):
Normalization able to give advancement using qt.Signal and QThreadPool Normalization able to give advancement using qt.Signal and QThreadPool
""" """
def __init__(self): def __init__(self, *args, **kwargs):
est.core.process.larch.mback_norm.Larch_mback_norm.__init__(self) est.core.process.larch.mback_norm.Larch_mback_norm.__init__(
self, *args, **kwargs
)
self._advancement = QProgress("mback_norm") self._advancement = QProgress("mback_norm")
def _pool_process(self, xas_obj): def _pool_process(self, xas_obj):
......
...@@ -32,7 +32,7 @@ import functools ...@@ -32,7 +32,7 @@ import functools
import logging import logging
from Orange.widgets import gui from Orange.widgets import gui
from Orange.widgets.settings import Setting from Orange.widgets.settings import Setting
from ewoksorange.bindings import OWEwoksWidget from Orange.widgets.widget import OWWidget
from Orange.widgets.widget import Input, Output from Orange.widgets.widget import Input, Output
import Orange.data import Orange.data
from silx.gui import qt from silx.gui import qt
...@@ -54,6 +54,7 @@ from est.gui.larch.pre_edge import _MPreEdgeParameters ...@@ -54,6 +54,7 @@ from est.gui.larch.pre_edge import _MPreEdgeParameters
from orangecontrib.est.progress import QProgress from orangecontrib.est.progress import QProgress
from orangecontrib.est.utils import Converter from orangecontrib.est.utils import Converter
from orangecontrib.est.widgets.container import _ParameterWindowContainer from orangecontrib.est.widgets.container import _ParameterWindowContainer
from ewokscore.registration import Registered
_logger = logging.getLogger(__file__) _logger = logging.getLogger(__file__)
...@@ -129,10 +130,8 @@ class _PreEdgeWindow(qt.QMainWindow): ...@@ -129,10 +130,8 @@ class _PreEdgeWindow(qt.QMainWindow):
class PreEdgeOW( class PreEdgeOW(
_ProcessForOrangeMixIn, _ProcessForOrangeMixIn,
OWEwoksWidget, OWWidget,
ewokstaskclass=est.core.process.larch.pre_edge.Larch_pre_edge, Registered,
inputnamemap={},
outputnamemap={},
): ):
""" """
Widget used for signal extraction Widget used for signal extraction
...@@ -157,6 +156,7 @@ class PreEdgeOW( ...@@ -157,6 +156,7 @@ class PreEdgeOW(
want_main_area = True want_main_area = True
resizing_enabled = True resizing_enabled = True
allows_cycle = False allows_cycle = False
ewokstaskclass = est.core.process.larch.pre_edge.Larch_pre_edge
_larchSettings = Setting(dict()) _larchSettings = Setting(dict())
"""Store the configuration of the larch configuration""" """Store the configuration of the larch configuration"""
...@@ -230,6 +230,7 @@ class PreEdgeOW( ...@@ -230,6 +230,7 @@ class PreEdgeOW(
self._startProcess() self._startProcess()
# setup the normalization process # setup the normalization process
inputs = {"xas_obj": xas_obj}
if _USE_THREAD is True: if _USE_THREAD is True:
# larch is using sqlite3 for database. access to the database # larch is using sqlite3 for database. access to the database
# require a 'connection' and 'cursor'. theoretically we should be # require a 'connection' and 'cursor'. theoretically we should be
...@@ -253,7 +254,7 @@ class PreEdgeOW( ...@@ -253,7 +254,7 @@ class PreEdgeOW(
# so fo rnow we are making the processing in the main thread that # so fo rnow we are making the processing in the main thread that
# larch is happy about and splitting it in a way to avoid gui # larch is happy about and splitting it in a way to avoid gui
# freeze # freeze
process_obj = QLarch_pre_edge() process_obj = QLarch_pre_edge(inputs=inputs)
process_obj._advancement.sigProgress.connect(self._setProgressValue) process_obj._advancement.sigProgress.connect(self._setProgressValue)
process_obj.set_properties( process_obj.set_properties(
{"_larchSettings": self._window._parametersWindow.getParameters()} {"_larchSettings": self._window._parametersWindow.getParameters()}
...@@ -271,7 +272,7 @@ class PreEdgeOW( ...@@ -271,7 +272,7 @@ class PreEdgeOW(
# manage advancement # manage advancement
self._advancement.setAdvancement(0) self._advancement.setAdvancement(0)
self._advancement.setMaxSpectrum(self._latest_xas_obj.n_spectrum) self._advancement.setMaxSpectrum(self._latest_xas_obj.n_spectrum)
process_obj = est.core.process.larch.pre_edge.Larch_pre_edge() process_obj = est.core.process.larch.pre_edge.Larch_pre_edge(inputs=inputs)
process_obj.advancement = self._advancement process_obj.advancement = self._advancement
process_obj.set_properties( process_obj.set_properties(
{"_larchSettings": self._window._parametersWindow.getParameters()} {"_larchSettings": self._window._parametersWindow.getParameters()}
...@@ -280,7 +281,7 @@ class PreEdgeOW( ...@@ -280,7 +281,7 @@ class PreEdgeOW(
# to avoid gui freeze, processevents after each spectrum process # to avoid gui freeze, processevents after each spectrum process
process_obj.addCallback(qt.QApplication.instance().processEvents) process_obj.addCallback(qt.QApplication.instance().processEvents)
process_obj.addCallback(self._advancement.increaseAdvancement) process_obj.addCallback(self._advancement.increaseAdvancement)
process_obj.process(self._latest_xas_obj) process_obj.run()
self._callback_finish = None self._callback_finish = None
self._endProcess(self._latest_xas_obj) self._endProcess(self._latest_xas_obj)
...@@ -290,8 +291,8 @@ class QLarch_pre_edge(est.core.process.larch.pre_edge.Larch_pre_edge): ...@@ -290,8 +291,8 @@ class QLarch_pre_edge(est.core.process.larch.pre_edge.Larch_pre_edge):
Normalization able to give advancement using qt.Signal and QThreadPool Normalization able to give advancement using qt.Signal and QThreadPool
""" """
def __init__(self): def __init__(self, *args, **kwargs):
est.core.process.larch.pre_edge.Larch_pre_edge.__init__(self) est.core.process.larch.pre_edge.Larch_pre_edge.__init__(self, *args, **kwargs)
self._advancement = QProgress("pre_edge") self._advancement = QProgress("pre_edge")
def _pool_process(self, xas_obj): def _pool_process(self, xas_obj):
......
...@@ -32,7 +32,7 @@ import functools ...@@ -32,7 +32,7 @@ import functools
import logging import logging
from Orange.widgets import gui from Orange.widgets import gui
from Orange.widgets.settings import Setting from Orange.widgets.settings import Setting
from ewoksorange.bindings import OWEwoksWidget from Orange.widgets.widget import OWWidget
from Orange.widgets.widget import Input, Output from Orange.widgets.widget import Input, Output
import Orange.data import Orange.data
from silx.gui import qt from silx.gui import qt
...@@ -53,6 +53,7 @@ from est.gui.larch.xftf import _MXFTFParameters ...@@ -53,6 +53,7 @@ from est.gui.larch.xftf import _MXFTFParameters
from orangecontrib.est.progress import QProgress from orangecontrib.est.progress import QProgress
from orangecontrib.est.utils import Converter from orangecontrib.est.utils import Converter
from orangecontrib.est.widgets.container import _ParameterWindowContainer from orangecontrib.est.widgets.container import _ParameterWindowContainer
from ewokscore.registration import Registered
_logger = logging.getLogger(__file__) _logger = logging.getLogger(__file__)
...@@ -151,10 +152,8 @@ class XFTFWindow(qt.QMainWindow): ...@@ -151,10 +152,8 @@ class XFTFWindow(qt.QMainWindow):
class XFTFOW( class XFTFOW(
_ProcessForOrangeMixIn, _ProcessForOrangeMixIn,
OWEwoksWidget, OWWidget,
ewokstaskclass=est.core.process.larch.xftf.Larch_xftf, Registered,
inputnamemap={},
outputnamemap={},
):