Commit 13493a73 authored by payno's avatar payno
Browse files

[esrftaskgraph] from task graph to orange widget: handle graph and qualified name

settings are not handled yet.
parent 1dc2c251
from esrftaskgraph import Task
class IgnoreTask(Task):
INPUT_NAMES = ["xas_obj"]
OUTPUT_NAMES = ["xas_obj"]
def process(self):
pass
class IgnoreInput(IgnoreTask):
@staticmethod
def registry_name():
return "ignored read"
class IgnoreOrangeConversion(IgnoreTask):
@staticmethod
def registry_name():
return "ignored conversion to orange table"
class IgnoreSavingPoint(IgnoreTask):
@staticmethod
def registry_name():
return "ignored saving point"
class IgnoreE0Calculation(IgnoreTask):
@staticmethod
def registry_name():
return "ignored E0 calculation"
......@@ -253,7 +253,7 @@ class NoiseProcess(Process):
return pkg_resources.get_distribution("est").version
@staticmethod
def registry_name(self):
def registry_name():
return "noise_savgol"
__call__ = process
......@@ -59,7 +59,7 @@ else:
_logger = logging.getLogger(__name__)
class XASObject():
class XASObject:
"""Base class of XAS
:param spectra: absorbed beam as a list of :class:`.Spectrum` or a
......
......@@ -33,6 +33,7 @@ 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
class ConverterOW(OWWidget):
......@@ -63,6 +64,8 @@ class ConverterOW(OWWidget):
# 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:
......
......@@ -36,7 +36,7 @@ import Orange.data
from orangecontrib.est.utils import Converter
from silx.gui import qt
import functools
import est.core.process.ignoreprocess
import est.core.process.setconfig
from est.core.types import XASObject
from est.gui.e0calculator import E0Calculator, E0ComputationMethod
......@@ -66,7 +66,9 @@ class E0calculatorOW(OWWidget):
"Region of Interest",
]
esrftaskclass = est.core.process.setconfig._xas_set_config
# 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
......
......@@ -32,6 +32,7 @@ from Orange.widgets.widget import OWWidget
from Orange.widgets.widget import Input, Output
from est.core.types import XASObject
from silx.gui import qt
import est.core.process.ignoreprocess
import logging
_logger = logging.getLogger(__file__)
......@@ -57,6 +58,8 @@ class SavingPointOW(OWWidget):
resizing_enabled = False
allows_cycle = False
esrftaskclass = est.core.process.ignoreprocess.IgnoreSavingPoint
class Inputs:
xas_obj = Input("xas_obj", XASObject, default=True)
......
......@@ -33,14 +33,14 @@ 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
import est.core.io
import est.core.process.ignoreprocess
from est.core.types import XASObject
from est.gui.xas_object_definition import XASObjectWindow
from esrftaskgraph import Variable
from est.core.types import XASObject
_logger = logging.getLogger(__file__)
......@@ -48,7 +48,7 @@ _logger = logging.getLogger(__file__)
_DEBUG = False
class XASInputOW(OWESRFWidget):
class XASInputOW(OWWidget):
"""
Widget used for signal extraction
"""
......@@ -60,6 +60,7 @@ class XASInputOW(OWESRFWidget):
priority = 0
category = "esrfWidgets"
keywords = ["spectroscopy", "signal", "input", "file"]
esrftaskclass = est.core.process.ignoreprocess.IgnoreInput
want_main_area = True
......@@ -77,10 +78,8 @@ class XASInputOW(OWESRFWidget):
_I2_url_setting = Setting(str())
_mu_ref_url_setting = Setting(str())
process_function = est.core.io.read_frm_file
class Outputs:
output = Output("xas_obj", Variable)
res_xas_obj = Output("xas_obj", XASObject)
# by default we want to avoid sending 'Orange.data.Table' to avoid
# loosing the XASObject flow process and results.
......@@ -92,9 +91,6 @@ class XASInputOW(OWESRFWidget):
self._inputDialog = XASObjectWindow(parent=self)
self._inputWindow.layout().addWidget(self._inputDialog, 0, 0, 1, 2)
style = qt.QApplication.instance().style()
icon = style.standardIcon(qt.QStyle.SP_DialogApplyButton)
# add the apply button
types = qt.QDialogButtonBox.Ok
self._buttons = qt.QDialogButtonBox(parent=self)
......@@ -108,7 +104,6 @@ class XASInputOW(OWESRFWidget):
layout = gui.vBox(self.mainArea, "input").layout()
layout.addWidget(self._inputWindow)
# deal with setting
try:
self._loadSettings()
except:
......@@ -123,8 +118,6 @@ class XASInputOW(OWESRFWidget):
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()
......
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