Commit 8f869784 authored by Julia Garriga Ferrer's avatar Julia Garriga Ferrer
Browse files

[orangecontrib] Some docs

parent 96a4b169
Pipeline #13431 passed with stage
in 30 seconds
......@@ -26,7 +26,7 @@
__authors__ = ["J. Garriga"]
__license__ = "MIT"
__date__ = "02/08/2019"
__date__ = "08/08/2019"
# import os
......
......@@ -41,14 +41,19 @@ from linkdick06.gui.dataSelectionWidget import DatasetSelectionWidget
class DataSelectionWidgetOW(OWWidget):
"""
Widget to select the data to be used in the dataset.
"""
name = "data selection"
icon = "icons/upload.svg"
want_main_area = False
# Outputs
class Outputs:
dataset = Output("dataset", Dataset)
# Settings
filenames = Setting(list(), schema_only=True)
raw_filename = Setting(str())
dark_filename = Setting(str())
......@@ -57,19 +62,18 @@ class DataSelectionWidgetOW(OWWidget):
super().__init__()
self._widget = DatasetSelectionWidget()
# buttons
types = qt.QDialogButtonBox.Ok
_buttons = qt.QDialogButtonBox(parent=self)
_buttons.setStandardButtons(types)
self._progressBar = gui.ProgressBar(self, 100)
self._widget.signalProgress.connect(self._updateProgress)
self.controlArea.layout().addWidget(self._widget)
self.controlArea.layout().addWidget(_buttons)
self._progressBar = gui.ProgressBar(self, 100)
self._widget.signalProgress.connect(self._updateProgress)
_buttons.accepted.connect(self._getDataset)
self.__updatingData = False
self.setDataset()
def setDataset(self):
......@@ -77,9 +81,6 @@ class DataSelectionWidgetOW(OWWidget):
self._widget.setRawFilename(self.raw_filename)
self._widget.setDarkFilename(self.dark_filename)
def _showFileDialog(self):
self._fileDialog.exec_()
def _getDataset(self):
assert not self.__updatingData, "Another dataset is being loaded, please wait " \
"until it has finished"
......@@ -89,15 +90,25 @@ class DataSelectionWidgetOW(OWWidget):
self._thread = OperationThread(self._widget.startDataset)
self._thread.finished.connect(self._sendSignal)
self._thread.start()
self.updateSettings()
self.__updatingData = True
self.information("Downloading dataset")
self.close()
def _updateProgress(self, progress):
"""
Updates the progress bar
:param int progress: the new value that should appear
"""
self._progressBar.widget.progressBarSet(progress)
def _sendSignal(self):
"""
Function to emit the new dataset.
Finishes the `downloading` state.
"""
self._thread.finished.disconnect(self._sendSignal)
self.__updatingData = False
self.information()
......@@ -106,7 +117,9 @@ class DataSelectionWidgetOW(OWWidget):
self.close()
def updateSettings(self):
"""
Function to update the settings saved into the widget.
"""
self.filenames = self._widget.getRawFilenames()
self.raw_filename = self._widget.getRawFilename()
self.dark_filename = self._widget.getDarkFilename()
# coding: utf-8
# /*##########################################################################
#
# Copyright (c) 2016-2017 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
# ###########################################################################*/
__authors__ = ["J. Garriga"]
__license__ = "MIT"
__date__ = "08/08/2019"
from Orange.widgets.widget import OWWidget, Input, Output
from linkdick06.gui.backgroundSubstractionWidget import BackgroundSubstractionWidget
from linkdick06.core.dataset import Dataset
class BackgroundSubstractionWidgetOW(OWWidget):
"""
Widget that computes the background substraction from a dataset
"""
name = "noise reduction"
icon = "icons/noise_removal.svg"
want_main_area = False
# Inputs
class Inputs:
dataset = Input("dataset", Dataset)
# Outputs
class Outputs:
dataset = Output("dataset", Dataset)
......@@ -35,4 +71,7 @@ class BackgroundSubstractionWidgetOW(OWWidget):
self.Outputs.dataset.send(dataset)
def _sendSignal(self):
"""
Function to emit the new dataset.
"""
self.Outputs.dataset.send(self._widget.dataset)
......@@ -84,7 +84,10 @@ class RoiSelectionWidgetOW(OWWidget):
self._widget.setRoi(origin=self.roi_origin, size=self.roi_size)
def _createRoi(self):
"""
Function that applies a roi into the 3d stack and emits the signal with
the new dataset.
"""
roi = self._widget.getRoi()
# Save roi attributes
self.roi_origin = roi.getOrigin().tolist()
......
# coding: utf-8
# /*##########################################################################
#
# Copyright (c) 2016-2017 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
# ###########################################################################*/
__authors__ = ["J. Garriga"]
__license__ = "MIT"
__date__ = "08/08/2019"
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from Orange.widgets.widget import OWWidget, Input, Output
......@@ -6,17 +37,23 @@ from linkdick06.core.dataset import Dataset
class ShiftCorrectionWidgetOW(OWWidget):
"""
Widget to make the shift correction of a dataset.
"""
name = "shift correction"
icon = "icons/shift_correction.svg"
want_main_area = False
# Inputs
class Inputs:
dataset = Input("dataset", Dataset)
# Outputs
class Outputs:
dataset = Output("dataset", Dataset)
# Settings
shift = Setting(list(), scheme_only=True)
def __init__(self):
......@@ -41,8 +78,17 @@ class ShiftCorrectionWidgetOW(OWWidget):
self.Outputs.dataset.send(dataset)
def _sendSignal(self):
"""
Function to emit the new dataset.
"""
self.shift = self._widget.shift
self.Outputs.dataset.send(self._widget.dataset)
self._progressBar.finish()
def _updateProgress(self, progress):
"""
Updates the progress bar
:param int progress: the new value that should appear
"""
self._progressBar.widget.progressBarSet(progress)
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