Commit e4ff57a7 authored by payno's avatar payno
Browse files

[orange-add-on] manage pymca settings

parent 51888912
Pipeline #11996 canceled with stage
......@@ -34,6 +34,7 @@ from Orange.widgets import gui
from Orange.widgets.widget import OWWidget
from xas.core.types import XASBase
from PyMca5.PyMcaGui.physics.xas.XASPostEdgeParameters import XASPostEdgeParameters
from Orange.widgets.settings import Setting
import xas.core.process.exafs
import copy
import logging
......@@ -84,6 +85,9 @@ class ExafsOW(OWWidget):
process_function = xas.core.process.exafs.pymca_exafs
_pymcaSettings = Setting(dict())
"""Store the configuration of the PyMca XASClass"""
def __init__(self):
super().__init__()
self._window = ExafsWindow()
......@@ -91,11 +95,16 @@ class ExafsOW(OWWidget):
layout.addWidget(self._window)
self._latest_xas_obj = None
# manage settings
if self._pymcaSettings != dict():
self._window._pymcaWindow.setParameters(self._pymcaSettings)
# signal / slot connection
_sig = self._window._pymcaWindow.sigPostEdgeParametersSignal
_sig.connect(self._updateProcess)
def _updateProcess(self):
self._update_settings()
if self._latest_xas_obj:
self.process(self._latest_xas_obj)
......@@ -146,3 +155,6 @@ class ExafsOW(OWWidget):
linestyle="",
symbol="o",
resetzoom=True)
def _update_settings(self):
self._pymcaSettings = self._window._pymcaWindow.getParameters()
......@@ -32,9 +32,10 @@ from silx.gui import qt
from silx.gui.plot import Plot2D, LegendSelector
from Orange.widgets import gui
from Orange.widgets.widget import OWWidget
from Orange.widgets.settings import Setting
from xas.core.types import XASBase
from PyMca5.PyMcaGui.physics.xas.XASFourierTransformParameters import XASFourierTransformParameters
import xas.core.process.ft
from PyMca5.PyMcaGui.physics.xas.XASFourierTransformParameters import XASFourierTransformParameters
import logging
import copy
_logger = logging.getLogger(__file__)
......@@ -84,6 +85,9 @@ class FTOW(OWWidget):
process_function = xas.core.process.ft.pymca_ft
_pymcaSettings = Setting(dict())
"""Store the configuration of the PyMca XASClass"""
def __init__(self):
super().__init__()
self._window = FTWindow(parent=self)
......@@ -91,10 +95,15 @@ class FTOW(OWWidget):
layout = gui.vBox(self.mainArea, 'fourier transform').layout()
layout.addWidget(self._window)
# manage settings
if self._pymcaSettings != dict():
self._window._pymcaWindow.setParameters(self._pymcaSettings)
# signal / slot connection
self._window._pymcaWindow.sigFTParametersSignal.connect(self._updateProcess)
def _updateProcess(self, *arv, **kwargs):
self._update_settings()
if self._latest_xas_obj:
self.process(xas_obj=self._latest_xas_obj)
......@@ -127,3 +136,6 @@ class FTOW(OWWidget):
ylabel="Arbitrary Units",
color="red")
self._window.plot.resetZoom()
def _update_settings(self):
self._pymcaSettings = self._window._pymcaWindow.getParameters()
......@@ -31,6 +31,7 @@ __date__ = "06/07/2019"
from silx.gui.plot import Plot2D, LegendSelector
from Orange.widgets import gui
from Orange.widgets.widget import OWWidget
from Orange.widgets.settings import Setting
from silx.gui import qt
from xas.core.types import XASBase
import xas.core.process.k_weight
......@@ -89,6 +90,9 @@ class KWeightOW(OWWidget):
process_function = xas.core.process.k_weight.pymca_k_weight
_kWeightSetting = Setting(int(3))
"""Store the configuration of the PyMca XASClass"""
def __init__(self):
super().__init__()
layout = gui.vBox(self.mainArea, 'fourier transform').layout()
......@@ -96,10 +100,15 @@ class KWeightOW(OWWidget):
layout.addWidget(self._window)
self._latest_xas_obj = None
# manage settings
if self._kWeightSetting != 3:
self._window._k_spin_box.setValue(self._kWeightSetting)
# signal / slot connection
self._window._k_spin_box.valueChanged.connect(self._updateProcess)
def _updateProcess(self, *arv, **kwargs):
self._update_settings()
if self._latest_xas_obj:
self.process(self._latest_xas_obj)
......@@ -152,3 +161,6 @@ class KWeightOW(OWWidget):
color="red",
replace=False)
plot.resetZoom()
def _update_settings(self):
self._kWeightSetting = self._window._k_spin_box.value()
......@@ -32,6 +32,7 @@ from silx.gui import qt
from silx.gui.plot import Plot2D, LegendSelector
from Orange.widgets import gui
from Orange.widgets.widget import OWWidget
from Orange.widgets.settings import Setting
from PyMca5.PyMcaGui.physics.xas.XASNormalizationParameters import XASNormalizationParameters
from PyMca5.PyMcaPhysics.xas.XASClass import XASClass
from xas.core.types import XASBase
......@@ -89,6 +90,9 @@ class NormalizationOW(OWWidget):
process_function = xas.core.process.normalization.pymca_normalization
_pymcaSettings = Setting(dict())
"""Store the configuration of the PyMca XASClass"""
def __init__(self):
super().__init__()
self._latest_xas_obj = None
......@@ -99,6 +103,10 @@ class NormalizationOW(OWWidget):
self.pymca_xas = XASClass()
# manage settings
if self._pymcaSettings != dict():
self._window._pymcaWindow.setParameters(self._pymcaSettings)
# connect signals / slots
if hasattr(self._window._pymcaWindow, 'sigNormalizationParametersSignal'):
_sig = self._window._pymcaWindow.sigNormalizationParametersSignal
......@@ -118,6 +126,7 @@ class NormalizationOW(OWWidget):
self.send("spectrum", xas_obj)
def _updateProcess(self):
self._update_settings()
if self._latest_xas_obj:
self.process(self._latest_xas_obj)
......@@ -157,3 +166,6 @@ class NormalizationOW(OWWidget):
legend='Pre',
resetzoom=False)
self._window.plot.resetZoom()
def _update_settings(self):
self._pymcaSettings = self._window._pymcaWindow.getParameters()
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