Commit 9993d40f authored by Damien Naudet's avatar Damien Naudet

Refactoring of the qspace conversion.

parent 735221e6
......@@ -43,7 +43,7 @@ from .model.TreeView import TreeView
from .model.ModelDef import ModelRoles
from .model.Model import Model, RootNode
from .process.RecipSpaceWidget import RecipSpaceWidget
from .process.QSpaceWidget import QSpaceWidget
from .project.FitGroup import FitItem
from .project.QSpaceGroup import QSpaceItem
......@@ -191,14 +191,14 @@ class XsocsGui(Qt.QMainWindow):
xsocsPrefix = xsocsFile.rpartition('.')[0]
template = '{0}_qspace_{{0:>04}}.h5'.format(xsocsPrefix)
output_f = nextFileName(self.__project.workdir, template)
widget = RecipSpaceWidget(parent=self.sender(),
data_h5f=self.__project.xsocsFile,
output_f=output_f,
qspace_size=None,
image_binning=None,
rect_roi=event)
widget = QSpaceWidget(self.__project.xsocsFile,
outQSpaceH5=output_f,
qspaceDims=None,
imageBinning=None,
rectRoi=event,
parent=self.sender())
widget.exec_()
if widget.status == RecipSpaceWidget.StatusCompleted:
if widget.status == QSpaceWidget.StatusCompleted:
qspaceF = widget.qspaceH5
qspaceGroup = self.__project.qspaceGroup()
qspaceItem = qspaceGroup.addQSpace(qspaceF)
......
......@@ -36,7 +36,7 @@ print('Using Qt {0}'.format(Qt.qVersion()))
from .XsocsGui import XsocsGui
from .process.MergeWidget import MergeWidget
from .process.RecipSpaceWidget import RecipSpaceWidget
from .process.QSpaceWidget import QSpaceWidget
def merge_window(*args, **kwargs):
......@@ -50,7 +50,7 @@ def merge_window(*args, **kwargs):
def conversion_window(*args, **kwargs):
app = Qt.QApplication(sys.argv)
app.setQuitOnLastWindowClosed(True)
mw = RecipSpaceWidget(*args, **kwargs)
mw = QSpaceWidget(*args, **kwargs)
mw.show()
app.exec_()
......
......@@ -188,8 +188,6 @@ class KmapMerger(object):
if blocking:
self.__run_merge()
if self.__callback:
self.__callback()
else:
thread = self.__thread = Thread(target=self.__run_merge)
thread.start()
......
......@@ -155,8 +155,6 @@ class KmapSpecParser(object):
if blocking:
self.__run_parse()
if self.__callback:
self.__callback()
else:
thread = self.__thread = Thread(target=self.__run_parse)
thread.start()
......
......@@ -23,59 +23,6 @@
#
# ###########################################################################*/
from __future__ import absolute_import
__authors__ = ["D. Naudet"]
__license__ = "MIT"
__date__ = "15/09/2016"
from collections import namedtuple
from silx.gui import qt as Qt
ProcessResult = namedtuple('ProcessResult', ['status', 'data'])
class ProcessWidget(Qt.QMainWindow):
sigProcessDone = Qt.Signal(object)
(StatusUnknown, StatusInit, StatusRunning, StatusCompleted, StatusAborted,
StatusCanceled) = StatusList = range(6)
def __init__(self, index=None, parent=None, **kwargs):
super(ProcessWidget, self).__init__(parent, **kwargs)
self.__index = index
self.__status = ProcessWidget.StatusInit
status = property(lambda self: self.__status)
def _setStatus(self, status):
if status not in ProcessWidget.StatusList:
raise ValueError('Unknown status value : {0}.'
''.format(status))
self.__status = status
def processResult(self):
return ProcessResult(status=self.status, data=self._processData())
def _processData(self):
return None
def _emitEvent(self, event):
self.sigProcessDone.emit(event)
index = property(lambda self: self.__index)
class ProcessWidgetEvent(object):
def __init__(self, widget, data=None):
super(ProcessWidgetEvent, self).__init__()
self.__index = widget.index
self.__data = data
data = property(lambda self: self.__data)
index = property(lambda self: self.__index)
__date__ = "01/03/2016"
......@@ -33,6 +33,7 @@ def configuration(parent_package='', top_path=None):
config = Configuration('process', parent_package, top_path)
config.add_subpackage('merge')
config.add_subpackage('qspace')
return config
......
Markdown is supported
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