Commit b3c15714 authored by payno's avatar payno
Browse files

[orangecontrib] make Orange widget inherit from OWESRFWidget instead of OWWidget

OWESRFWidget fir the expected design for the esrf task graph. Creating a OWWidgetTaskExecutor for example
parent 92871b60
......@@ -43,7 +43,7 @@ class OWESRFWidget(OWWidget):
self._esrfexecutor = OWWidgetTaskExecutor(self)
# maybe we could create a callback to handleNewSignals when this is created ?
# maybe we could create a callback on handleNewSignals when this is created ?
def handleNewSignals(self):
for name, value in self._esrfexecutor.dynamic_input_values.items():
......
......@@ -32,7 +32,7 @@ import functools
import logging
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from Orange.widgets.widget import OWWidget
from orangecontrib.est.process import OWESRFWidget
from Orange.widgets.widget import Input, Output
import Orange.data
from silx.gui import qt
......@@ -140,7 +140,7 @@ class AutobkWindow(qt.QMainWindow):
)
class AutobkOW(_ProcessForOrangeMixIn, OWWidget):
class AutobkOW(_ProcessForOrangeMixIn, OWESRFWidget):
"""
Widget used for signal extraction
"""
......@@ -196,6 +196,8 @@ class AutobkOW(_ProcessForOrangeMixIn, OWWidget):
# set up (insure settings will be store
self._update_settings()
self.handleNewSignals()
def _updateProcess(self):
"""Update settings keeping current xas obj"""
self._update_settings()
......
......@@ -32,7 +32,7 @@ import functools
import logging
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from Orange.widgets.widget import OWWidget
from orangecontrib.est.process import OWESRFWidget
from Orange.widgets.widget import Input, Output
import Orange.data
from silx.gui import qt
......@@ -113,7 +113,7 @@ class MbackWindow(qt.QMainWindow):
return len(self.xasObjViewer._spectrumViews[0]._plotWidget.getAllCurves())
class MbackOW(_ProcessForOrangeMixIn, OWWidget):
class MbackOW(_ProcessForOrangeMixIn, OWESRFWidget):
"""
Widget used for signal extraction
"""
......@@ -171,6 +171,7 @@ class MbackOW(_ProcessForOrangeMixIn, OWWidget):
# set up (insure settings will be store
self._update_settings()
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 Orange.widgets.widget import OWWidget
from orangecontrib.est.process import OWESRFWidget
from Orange.widgets.widget import Input, Output
import Orange.data
from silx.gui import qt
......@@ -113,7 +113,7 @@ class Mback_normWindow(qt.QMainWindow):
return len(self.xasObjViewer._spectrumViews[0]._plotWidget.getAllCurves())
class Mback_normOW(_ProcessForOrangeMixIn, OWWidget):
class Mback_normOW(_ProcessForOrangeMixIn, OWESRFWidget):
"""
Widget used for signal extraction
"""
......@@ -171,6 +171,7 @@ class Mback_normOW(_ProcessForOrangeMixIn, OWWidget):
# set up (insure settings will be store
self._update_settings()
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 Orange.widgets.widget import OWWidget
from orangecontrib.est.process import OWESRFWidget
from Orange.widgets.widget import Input, Output
import Orange.data
from silx.gui import qt
......@@ -127,7 +127,7 @@ class _PreEdgeWindow(qt.QMainWindow):
return len(self.xasObjViewer._spectrumViews[0]._plotWidget.getAllCurves())
class PreEdgeOW(_ProcessForOrangeMixIn, OWWidget):
class PreEdgeOW(_ProcessForOrangeMixIn, OWESRFWidget):
"""
Widget used for signal extraction
"""
......@@ -190,6 +190,7 @@ class PreEdgeOW(_ProcessForOrangeMixIn, OWWidget):
# set up (insure settings will be store
self._update_settings()
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 Orange.widgets.widget import OWWidget
from orangecontrib.est.process import OWESRFWidget
from Orange.widgets.widget import Input, Output
import Orange.data
from silx.gui import qt
......@@ -149,7 +149,7 @@ class XFTFWindow(qt.QMainWindow):
self._parametersWindow._mainwidget.setRWeight(kweight)
class XFTFOW(_ProcessForOrangeMixIn, OWWidget):
class XFTFOW(_ProcessForOrangeMixIn, OWESRFWidget):
"""
Widget used for signal extraction
"""
......@@ -208,6 +208,8 @@ class XFTFOW(_ProcessForOrangeMixIn, OWWidget):
# set up (insure settings will be store
self._update_settings()
self.handleNewSignals()
def _updateProcess(self):
self._update_settings()
if self._latest_xas_obj:
......
......@@ -33,7 +33,7 @@ import logging
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from Orange.widgets.widget import OWWidget
from orangecontrib.est.process import OWESRFWidget
from Orange.widgets.widget import Input, Output
import Orange.data
from est.core.types import XASObject
......@@ -117,7 +117,7 @@ class ExafsWindow(qt.QMainWindow):
)
class ExafsOW(_ProcessForOrangeMixIn, OWWidget):
class ExafsOW(_ProcessForOrangeMixIn, OWESRFWidget):
"""
Widget used for signal extraction
"""
......@@ -169,6 +169,8 @@ class ExafsOW(_ProcessForOrangeMixIn, OWWidget):
# signal / slot connection
self._window._pymcaWindow.sigChanged.connect(self._updateProcess)
self.handleNewSignals()
def _updateProcess(self):
self._update_settings()
if self._latest_xas_obj:
......
......@@ -33,7 +33,7 @@ import logging
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from Orange.widgets.widget import OWWidget
from orangecontrib.est.process import OWESRFWidget
from Orange.widgets.widget import Input, Output
import Orange.data
from PyMca5.PyMcaGui.physics.xas.XASFourierTransformParameters import (
......@@ -135,7 +135,7 @@ class FTWindow(qt.QMainWindow):
)
class FTOW(_ProcessForOrangeMixIn, OWWidget):
class FTOW(_ProcessForOrangeMixIn, OWESRFWidget):
"""
Widget used for signal extraction
"""
......@@ -186,6 +186,8 @@ class FTOW(_ProcessForOrangeMixIn, OWWidget):
# connect signals / slots
self._window._pymcaWindow.sigChanged.connect(self._updateProcess)
self.handleNewSignals()
def _updateProcess(self, *arv, **kwargs):
self._update_settings()
if self._latest_xas_obj:
......
......@@ -32,7 +32,7 @@ import logging
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from Orange.widgets.widget import OWWidget
from orangecontrib.est.process import OWESRFWidget
from Orange.widgets.widget import Input, Output
import Orange.data
from silx.gui import qt
......@@ -66,7 +66,7 @@ class KWeightWindow(qt.QMainWindow):
self.setWindowFlags(qt.Qt.Widget)
class KWeightOW(_ProcessForOrangeMixIn, OWWidget):
class KWeightOW(_ProcessForOrangeMixIn, OWESRFWidget):
"""
Widget used for signal extraction
"""
......@@ -116,6 +116,8 @@ class KWeightOW(_ProcessForOrangeMixIn, OWWidget):
# signal / slot connection
self._window._k_spin_box.valueChanged.connect(self._updateProcess)
self.handleNewSignals()
def _updateProcess(self, *arv, **kwargs):
self._update_settings()
if self._latest_xas_obj:
......
......@@ -33,7 +33,7 @@ import logging
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from Orange.widgets.widget import OWWidget
from orangecontrib.est.process import OWESRFWidget
from Orange.widgets.widget import Input, Output
import Orange.data
from PyMca5.PyMcaGui.physics.xas.XASNormalizationParameters import (
......@@ -183,7 +183,7 @@ class NormalizationWindow(qt.QMainWindow):
)
class NormalizationOW(_ProcessForOrangeMixIn, OWWidget):
class NormalizationOW(_ProcessForOrangeMixIn, OWESRFWidget):
"""
Widget used for signal extraction
"""
......@@ -239,6 +239,8 @@ class NormalizationOW(_ProcessForOrangeMixIn, OWWidget):
self._getE0FrmDialog
)
self.handleNewSignals()
def _updateProcess(self):
self._update_settings()
if self._latest_xas_obj:
......
......@@ -28,7 +28,7 @@ __license__ = "MIT"
__date__ = "08/08/2019"
from Orange.widgets.widget import OWWidget
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
......@@ -36,7 +36,7 @@ import Orange.data
import est.core.process.ignoreprocess
class ConverterOW(OWWidget):
class ConverterOW(OWESRFWidget):
"""
Offer a conversion from XASObject to Orange.data.Table, commonly used
from Orange widget
......
......@@ -30,7 +30,7 @@ __date__ = "02/10/2018"
import logging
from Orange.widgets import gui
from Orange.widgets.widget import OWWidget
from orangecontrib.est.process import OWESRFWidget
from Orange.widgets.widget import Input, Output
import Orange.data
from orangecontrib.est.utils import Converter
......@@ -44,7 +44,7 @@ from est.gui.e0calculator import E0Calculator, E0ComputationMethod
_logger = logging.getLogger(__file__)
class E0calculatorOW(OWWidget):
class E0calculatorOW(OWESRFWidget):
"""
Widget used to make compute E0 from the dataset.
"""
......@@ -115,6 +115,8 @@ class E0calculatorOW(OWWidget):
# set up
self._buttons.hide()
self.handleNewSignals()
def validateMethodToUse(self, method):
"""Define the method to use and close the dialog"""
method = E0ComputationMethod.from_value(method)
......
......@@ -31,7 +31,7 @@ import logging
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from Orange.widgets.widget import OWWidget
from orangecontrib.est.process import OWESRFWidget
from Orange.widgets.widget import Input, Output
import Orange.data
from orangecontrib.est.utils import Converter
......@@ -44,7 +44,7 @@ from est.gui.energyroi import EnergyRoiWidget
_logger = logging.getLogger(__file__)
class EnergyRoiOW(OWWidget):
class EnergyRoiOW(OWESRFWidget):
"""
Widget used to make the selection of a region of Interest to treat in a
Dataset.
......@@ -109,6 +109,8 @@ class EnergyRoiOW(OWWidget):
self.setROI = self._widget.setROI
self.getROI = self._widget.getROI
self.handleNewSignals()
@Inputs.data_table
def processFrmDataTable(self, data_table):
if data_table is None:
......@@ -150,7 +152,7 @@ class EnergyRoiOW(OWWidget):
except Exception as e:
_logger.error(e)
else:
OWWidget.accept(self)
OWESRFWidget.accept(self)
def updateProperties(self):
# as dim are named tuple we have to cast them to dict
......
......@@ -31,7 +31,7 @@ import logging
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from Orange.widgets.widget import OWWidget
from orangecontrib.est.process import OWESRFWidget
from Orange.widgets.widget import Input, Output
from orangecontrib.est.progress import QProgress
from orangecontrib.est.process import ProcessRunnable
......@@ -47,7 +47,7 @@ from est.gui.noise import SavitskyGolayNoise
_logger = logging.getLogger(__file__)
class NoiseOW(_ProcessForOrangeMixIn, OWWidget):
class NoiseOW(_ProcessForOrangeMixIn, OWESRFWidget):
"""
Widget used to make the selection of a region of Interest to treat in a
Dataset.
......@@ -121,6 +121,8 @@ class NoiseOW(_ProcessForOrangeMixIn, OWWidget):
# connect signals / slots
self._window.sigChanged.connect(self._updateProcess)
self.handleNewSignals()
def _updateProcess(self, *arv, **kwargs):
self._update_settings()
if self._latest_xas_obj:
......
......@@ -31,7 +31,7 @@ import logging
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from Orange.widgets.widget import OWWidget
from orangecontrib.est.process import OWESRFWidget
from Orange.widgets.widget import Input, Output
import Orange.data
from orangecontrib.est.utils import Converter
......@@ -44,7 +44,7 @@ from est.gui.roiselector import ROISelector
_logger = logging.getLogger(__file__)
class RoiSelectionOW(OWWidget):
class RoiSelectionOW(OWESRFWidget):
"""
Widget used to make the selection of a region of Interest to treat in a
Dataset.
......@@ -102,6 +102,8 @@ class RoiSelectionOW(OWWidget):
self.setROI = self._widget.setROI
self.getROI = self._widget.getROI
self.handleNewSignals()
@Inputs.data_table
def processFrmDataTable(self, data_table):
if data_table is None:
......@@ -135,7 +137,7 @@ class RoiSelectionOW(OWWidget):
except Exception as e:
_logger.error(e)
else:
OWWidget.accept(self)
OWESRFWidget.accept(self)
def updateProperties(self):
# as dim are named tuple we have to cast them to dict
......
......@@ -32,8 +32,6 @@ import logging
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from orangecontrib.est.process import OWESRFWidget
from Orange.widgets.widget import OWWidget
from Orange.widgets.widget import Output
from silx.gui import qt
from silx.io.url import DataUrl
......@@ -48,7 +46,7 @@ _logger = logging.getLogger(__file__)
_DEBUG = False
class XASInputOW(OWWidget):
class XASInputOW(OWESRFWidget):
"""
Widget used for signal extraction
"""
......@@ -118,6 +116,8 @@ class XASInputOW(OWWidget):
self._inputDialog.getMainWindow().editingFinished.connect(self._storeSettings)
self.setFileSelected = self._inputDialog.setDatFile
self.handleNewSignals()
def _emitNewFile(self, *args, **kwargs):
try:
xas_obj = self._inputDialog.buildXASObject()
......
......@@ -29,7 +29,7 @@ __date__ = "06/11/2019"
from Orange.widgets import gui
from Orange.widgets.widget import OWWidget
from orangecontrib.est.process import OWESRFWidget
from Orange.widgets.settings import Setting
from Orange.widgets.widget import Input
from silx.gui import qt
......@@ -42,7 +42,7 @@ import h5py
_logger = logging.getLogger(__file__)
class XASOutputOW(OWWidget):
class XASOutputOW(OWESRFWidget):
"""
Widget used for signal extraction
"""
......@@ -89,6 +89,8 @@ class XASOutputOW(OWWidget):
# signal / slot connection
self._selectPB.pressed.connect(self._selectFile)
self.handleNewSignals()
def _selectFile(self, *args, **kwargs):
old = self.blockSignals(True)
dialog = qt.QFileDialog(self)
......
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