Commit fd9c53bf authored by Damien Naudet's avatar Damien Naudet

More work on the model.

parent 22b2b6a0
...@@ -7,9 +7,9 @@ from collections import namedtuple ...@@ -7,9 +7,9 @@ from collections import namedtuple
from ..util.id01_spec import Id01DataMerger from ..util.id01_spec import Id01DataMerger
from .Widgets import (AcqParamsWidget, from .Widgets import (AcqParamsWidget,
_AdjustedLabel, AdjustedLabel,
_AdjustedLineEdit, AdjustedLineEdit,
_AdjustedPushButton) AdjustedPushButton)
from silx.gui import qt as Qt from silx.gui import qt as Qt
...@@ -131,7 +131,7 @@ class _ScansSelectDialog(Qt.QDialog): ...@@ -131,7 +131,7 @@ class _ScansSelectDialog(Qt.QDialog):
table_widget.setColumnHidden(self.M1_END_COL, True) table_widget.setColumnHidden(self.M1_END_COL, True)
table_widget.setColumnHidden(self.M1_STEP_COL, True) table_widget.setColumnHidden(self.M1_STEP_COL, True)
more_bn = _AdjustedPushButton('More') more_bn = AdjustedPushButton('More')
layout.addWidget(more_bn, 1, 0, Qt.Qt.AlignRight) layout.addWidget(more_bn, 1, 0, Qt.Qt.AlignRight)
bn_box = Qt.QDialogButtonBox(Qt.QDialogButtonBox.Ok | bn_box = Qt.QDialogButtonBox(Qt.QDialogButtonBox.Ok |
...@@ -412,7 +412,7 @@ class MergeWidget(Qt.QDialog): ...@@ -412,7 +412,7 @@ class MergeWidget(Qt.QDialog):
spec_file_edit = Qt.QLineEdit() spec_file_edit = Qt.QLineEdit()
fm = spec_file_edit.fontMetrics() fm = spec_file_edit.fontMetrics()
spec_file_edit.setMinimumWidth(fm.width(' ' * 100)) spec_file_edit.setMinimumWidth(fm.width(' ' * 100))
spec_file_bn = _AdjustedPushButton('...') spec_file_bn = AdjustedPushButton('...')
layout.addWidget(lab, layout.addWidget(lab,
spec_row, label_col, spec_row, label_col,
Qt.Qt.AlignLeft) Qt.Qt.AlignLeft)
...@@ -429,7 +429,7 @@ class MergeWidget(Qt.QDialog): ...@@ -429,7 +429,7 @@ class MergeWidget(Qt.QDialog):
img_dir_edit = Qt.QLineEdit() img_dir_edit = Qt.QLineEdit()
fm = img_dir_edit.fontMetrics() fm = img_dir_edit.fontMetrics()
img_dir_edit.setMinimumWidth(fm.width(' ' * 100)) img_dir_edit.setMinimumWidth(fm.width(' ' * 100))
img_dir_bn = _AdjustedPushButton('...') img_dir_bn = AdjustedPushButton('...')
layout.addWidget(lab, layout.addWidget(lab,
img_path_row, label_col, img_path_row, label_col,
Qt.Qt.AlignLeft) Qt.Qt.AlignLeft)
...@@ -465,7 +465,7 @@ class MergeWidget(Qt.QDialog): ...@@ -465,7 +465,7 @@ class MergeWidget(Qt.QDialog):
Qt.QSizePolicy.Expanding)) Qt.QSizePolicy.Expanding))
# last row : apply button # last row : apply button
parse_bn = _AdjustedPushButton('Parse file') parse_bn = AdjustedPushButton('Parse file')
layout.addWidget(parse_bn, layout.addWidget(parse_bn,
apply_bn_row, 0, apply_bn_row, 0,
1, last_col - first_col, 1, last_col - first_col,
...@@ -490,7 +490,7 @@ class MergeWidget(Qt.QDialog): ...@@ -490,7 +490,7 @@ class MergeWidget(Qt.QDialog):
label = Qt.QLabel('<span style=" font-weight:600; color:#00916a;">' label = Qt.QLabel('<span style=" font-weight:600; color:#00916a;">'
'Matched scans</span>') 'Matched scans</span>')
label.setTextFormat(Qt.Qt.RichText) label.setTextFormat(Qt.Qt.RichText)
edit_scans_bn = _AdjustedPushButton('Edit') edit_scans_bn = AdjustedPushButton('Edit')
h_layout.addWidget(label) h_layout.addWidget(label)
h_layout.addWidget(edit_scans_bn) h_layout.addWidget(edit_scans_bn)
scan_layout.addLayout(h_layout, 0, 0, 1, 2) scan_layout.addLayout(h_layout, 0, 0, 1, 2)
...@@ -538,7 +538,7 @@ class MergeWidget(Qt.QDialog): ...@@ -538,7 +538,7 @@ class MergeWidget(Qt.QDialog):
h_layout = Qt.QHBoxLayout() h_layout = Qt.QHBoxLayout()
label = Qt.QLabel('<span style=" font-weight:600; color:#ff6600;">' label = Qt.QLabel('<span style=" font-weight:600; color:#ff6600;">'
'Other scans</span>') 'Other scans</span>')
other_scans_bn = _AdjustedPushButton('View') other_scans_bn = AdjustedPushButton('View')
h_layout.addWidget(label) h_layout.addWidget(label)
h_layout.addWidget(other_scans_bn) h_layout.addWidget(other_scans_bn)
...@@ -609,7 +609,7 @@ class MergeWidget(Qt.QDialog): ...@@ -609,7 +609,7 @@ class MergeWidget(Qt.QDialog):
master_edit.setMinimumWidth(fm.width(' ' * 50)) master_edit.setMinimumWidth(fm.width(' ' * 50))
h_layout = Qt.QHBoxLayout() h_layout = Qt.QHBoxLayout()
layout.addLayout(h_layout, 0, 1, Qt.Qt.AlignLeft) layout.addLayout(h_layout, 0, 1, Qt.Qt.AlignLeft)
reset_bn = _AdjustedPushButton('R') reset_bn = AdjustedPushButton('R')
layout.addWidget(lab, layout.addWidget(lab,
0, 0, 0, 0,
Qt.Qt.AlignLeft) Qt.Qt.AlignLeft)
...@@ -627,7 +627,7 @@ class MergeWidget(Qt.QDialog): ...@@ -627,7 +627,7 @@ class MergeWidget(Qt.QDialog):
outdir_edit = Qt.QLineEdit() outdir_edit = Qt.QLineEdit()
fm = outdir_edit.fontMetrics() fm = outdir_edit.fontMetrics()
outdir_edit.setMinimumWidth(fm.width(' ' * 100)) outdir_edit.setMinimumWidth(fm.width(' ' * 100))
outdir_bn = _AdjustedPushButton('...') outdir_bn = AdjustedPushButton('...')
layout.addWidget(lab, layout.addWidget(lab,
1, 0, 1, 0,
Qt.Qt.AlignLeft) Qt.Qt.AlignLeft)
......
# coding: utf-8
# /*##########################################################################
#
# Copyright (c) 2015-2016 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.
#
# ###########################################################################*/
from __future__ import absolute_import
__authors__ = ["D. Naudet"]
__license__ = "MIT"
__date__ = "15/09/2016"
import os
from .view.RealSpaceWidget import RealSpaceWidget, RealSpaceWidgetEvent
from .process.RecipSpaceWidget import RecipSpaceWidget
from .project.XsocsProject import XsocsProject
def viewWidgetFromProjectEvent(project, event):
item = event.item
index = event.index
processLevel = item.processLevel
widget = None
if processLevel == XsocsProject.XsocsInput:
# show raw data
plotData = event.plotData()
x, y, data = plotData
widget = RealSpaceWidget(index)
widget.setPlotData(x, y, data)
elif processLevel == XsocsProject.XsocsQSpace:
# show qspace data
pass
else:
raise ValueError('Unknown process level {0}.'.format(processLevel))
return widget
# TODO : something better!
def nextFileName(root, template, cntMax=10000):
template = os.path.join(root, template)
for fIdx in range(cntMax):
nextFile = template.format(fIdx)
if not os.path.exists(nextFile):
return nextFile
else:
raise ValueError('No available file names.')
# TODO : cache the widget to reuse previous parameters?
def processWidgetFromViewEvent(project, event, parent=None):
widget = None
index = event.index
if isinstance(event, RealSpaceWidgetEvent):
xsocsPrefix = os.path.basename(project.xsocsFile).rpartition('.')[0]
template = '{0}_qspace_{{0:>04}}.h5'.format(xsocsPrefix)
output_f = nextFileName(project.workdir, template)
widget = RecipSpaceWidget(parent=parent,
index=index,
data_h5f=project.xsocsFile,
output_f=output_f,
qspace_size=None,
image_binning=None,
rect_roi=event.data)
return widget
...@@ -5,6 +5,7 @@ _MU_LOWER = u'\u03BC' ...@@ -5,6 +5,7 @@ _MU_LOWER = u'\u03BC'
_PHI_LOWER = u'\u03C6' _PHI_LOWER = u'\u03C6'
_ETA_LOWER = u'\u03B7' _ETA_LOWER = u'\u03B7'
class AcqParamsWidget(Qt.QWidget): class AcqParamsWidget(Qt.QWidget):
def __init__(self, def __init__(self,
...@@ -33,12 +34,12 @@ class AcqParamsWidget(Qt.QWidget): ...@@ -33,12 +34,12 @@ class AcqParamsWidget(Qt.QWidget):
return super(DblValidator, self).validate(text, pos) return super(DblValidator, self).validate(text, pos)
def dblLineEditWidget(width): def dblLineEditWidget(width):
wid = _AdjustedLineEdit(width, wid = AdjustedLineEdit(width,
validator_cls=DblValidator, validator_cls=DblValidator,
read_only=read_only, read_only=read_only,
reset_on_empty=True, reset_on_empty=True,
highlight_change=highlight_change, highlight_change=highlight_change,
field_type=float) field_type=float)
wid.setReadOnly(read_only) wid.setReadOnly(read_only)
return wid return wid
...@@ -153,7 +154,7 @@ class AcqParamsWidget(Qt.QWidget): ...@@ -153,7 +154,7 @@ class AcqParamsWidget(Qt.QWidget):
det_mu_rb = Qt.QRadioButton(u'Width is {0}.'.format(_MU_LOWER)) det_mu_rb = Qt.QRadioButton(u'Width is {0}.'.format(_MU_LOWER))
h_layout.addWidget(det_mu_rb) h_layout.addWidget(det_mu_rb)
else: else:
det_orient_edit = _AdjustedLineEdit(5, read_only=True) det_orient_edit = AdjustedLineEdit(5, read_only=True)
det_orient_edit.setAlignment(Qt.Qt.AlignCenter) det_orient_edit.setAlignment(Qt.Qt.AlignCenter)
h_layout.addWidget(det_orient_edit, alignment=Qt.Qt.AlignLeft) h_layout.addWidget(det_orient_edit, alignment=Qt.Qt.AlignLeft)
layout.addLayout(h_layout, row, 1) layout.addLayout(h_layout, row, 1)
...@@ -304,14 +305,14 @@ class AcqParamsWidget(Qt.QWidget): ...@@ -304,14 +305,14 @@ class AcqParamsWidget(Qt.QWidget):
self.__detector_orient = detector_orient self.__detector_orient = detector_orient
class _AdjustedPushButton(Qt.QPushButton): class AdjustedPushButton(Qt.QPushButton):
""" """
It seems that by default QPushButtons minimum width is 75. It seems that by default QPushButtons minimum width is 75.
This is a workaround. This is a workaround.
For _AdjustedPushButton to work text has to be set at creation time. For _AdjustedPushButton to work text has to be set at creation time.
""" """
def __init__(self, text, padding=None, **kwargs): def __init__(self, text, parent=None, padding=None):
super(_AdjustedPushButton, self).__init__(text, **kwargs) super(AdjustedPushButton, self).__init__(text, parent)
fm = self.fontMetrics() fm = self.fontMetrics()
...@@ -322,27 +323,26 @@ class _AdjustedPushButton(Qt.QPushButton): ...@@ -322,27 +323,26 @@ class _AdjustedPushButton(Qt.QPushButton):
self.setMaximumWidth(width) self.setMaximumWidth(width)
class _AdjustedLineEdit(Qt.QLineEdit): class AdjustedLineEdit(Qt.QLineEdit):
""" """
""" """
def __init__(self, def __init__(self,
width=None, width=None,
parent=None,
padding=None, padding=None,
alignment=Qt.Qt.AlignRight, alignment=Qt.Qt.AlignRight,
validator_cls=None, validator_cls=None,
field_type=None, field_type=None,
read_only=False, read_only=False,
reset_on_empty=False, reset_on_empty=False,
highlight_change=False, highlight_change=False):
**kwargs): super(AdjustedLineEdit, self).__init__(parent)
super(_AdjustedLineEdit, self).__init__(**kwargs)
self.__defaultText = self.text() self.__defaultText = self.text()
self.__highlightChange = highlight_change self.__highlightChange = highlight_change
self.__resetOnEmpty = reset_on_empty self.__resetOnEmpty = reset_on_empty
self.__fieldType = field_type self.__fieldType = field_type
if width is not None: if width is not None:
fm = self.fontMetrics() fm = self.fontMetrics()
...@@ -385,6 +385,8 @@ class _AdjustedLineEdit(Qt.QLineEdit): ...@@ -385,6 +385,8 @@ class _AdjustedLineEdit(Qt.QLineEdit):
else: else:
pass pass
same_txt = False
if len(value) == 0: if len(value) == 0:
if len(self.__defaultText) == 0: if len(self.__defaultText) == 0:
same_txt = True same_txt = True
...@@ -398,6 +400,7 @@ class _AdjustedLineEdit(Qt.QLineEdit): ...@@ -398,6 +400,7 @@ class _AdjustedLineEdit(Qt.QLineEdit):
value = self.__fieldType(value) value = self.__fieldType(value)
default_value = self.__fieldType(self.__defaultText) default_value = self.__fieldType(self.__defaultText)
except: except:
# TODO : filter specific exception
same_txt = False same_txt = False
else: else:
default_value = self.__defaultText default_value = self.__defaultText
...@@ -439,10 +442,10 @@ class _AdjustedLineEdit(Qt.QLineEdit): ...@@ -439,10 +442,10 @@ class _AdjustedLineEdit(Qt.QLineEdit):
if ev.type() == Qt.QEvent.EnabledChange: if ev.type() == Qt.QEvent.EnabledChange:
self.style().unpolish(self) self.style().unpolish(self)
self.style().polish(self) self.style().polish(self)
return super(_AdjustedLineEdit, self).event(ev) return super(AdjustedLineEdit, self).event(ev)
class _AdjustedLabel(Qt.QLabel): class AdjustedLabel(Qt.QLabel):
""" """
""" """
def __init__(self, def __init__(self,
...@@ -450,7 +453,7 @@ class _AdjustedLabel(Qt.QLabel): ...@@ -450,7 +453,7 @@ class _AdjustedLabel(Qt.QLabel):
padding=None, padding=None,
alignment=Qt.Qt.AlignRight, alignment=Qt.Qt.AlignRight,
**kwargs): **kwargs):
super(_AdjustedLabel, self).__init__(**kwargs) super(AdjustedLabel, self).__init__(**kwargs)
self.setFrameStyle(Qt.QFrame.Panel | Qt.QFrame.Sunken) self.setFrameStyle(Qt.QFrame.Panel | Qt.QFrame.Sunken)
......
...@@ -27,20 +27,16 @@ from __future__ import absolute_import ...@@ -27,20 +27,16 @@ from __future__ import absolute_import
import os import os
import numpy as np
from matplotlib import cm
from silx.gui import qt as Qt from silx.gui import qt as Qt
from plot3d.IsosurfaceView import IsosurfaceView
from ..io import XsocsH5 from .Utils import (viewWidgetFromProjectEvent,
processWidgetFromViewEvent)
from .MergeWidget import MergeWidget from .MergeWidget import MergeWidget
from .RecipSpaceWidget import RecipSpaceWidget
from .Widgets import (AcqParamsWidget, from .Widgets import (AcqParamsWidget,
_AdjustedLineEdit, AdjustedLineEdit,
_AdjustedPushButton) AdjustedPushButton)
from .project.XsocsProject import XsocsProject from .project.XsocsProject import XsocsProject
from ..io import XsocsH5
from .PlotWidgets import IntensityWindow
_COMPANY_NAME = 'ESRF' _COMPANY_NAME = 'ESRF'
...@@ -71,58 +67,28 @@ class XsocsGui(Qt.QMainWindow): ...@@ -71,58 +67,28 @@ class XsocsGui(Qt.QMainWindow):
self.__greeterDiag = None self.__greeterDiag = None
self.__readSettings() self.__readSettings()
def __dataDockSlot(self, event): def __projectViewSlot(self, event):
# TODO : store the plot window in a dictionary + weakref w delete # TODO : store the plot window in a dictionary + weakref w delete
# callback when object is destroyed # callback when object is destroyed
type = event.type
plotData = event.plotData()
x, y, data = plotData
if type == 'scatter':
self.showScatterPlot(x, y, data)
elif type == 'image':
self.showImage(x, y, data)
def showScatterPlot(self, x, y, data):
mdi = self.centralWidget() mdi = self.centralWidget()
min_, max_ = data.min(), data.max() plotWin = viewWidgetFromProjectEvent(self.__project, event)
colormap = cm.jet
colors = colormap((data.astype(np.float64) - min_) / (max_ - min_))
plotWin = IntensityWindow(aspectRatio=True)
plotWin.setAttribute(Qt.Qt.WA_DeleteOnClose) plotWin.setAttribute(Qt.Qt.WA_DeleteOnClose)
plotWin.plot.addCurve(x, y, color=colors, symbol='s', linestyle='') plotWin.sigProcessApplied.connect(self.__processApplied)
plotWin.sigRoiApplied.connect(self.__roiApplied)
mdi.addSubWindow(plotWin) mdi.addSubWindow(plotWin)
plotWin.show() plotWin.show()
return plotWin
def showImage(self, x, y, data): def __processApplied(self, event):
mdi = self.centralWidget() mdi = self.centralWidget()
plotWin = IntensityWindow(aspectRatio=True) widget = processWidgetFromViewEvent(self.__project, event, parent=self)
plotWin.setAttribute(Qt.Qt.WA_DeleteOnClose) widget.setWindowFlags(Qt.Qt.Dialog)
min_, max_ = data.min(), data.max() widget.setWindowModality(Qt.Qt.WindowModal)
colormap = {'name': 'temperature', widget.sigProcessDone.connect(self.__processDone)
'normalization': 'linear', widget.setAttribute(Qt.Qt.WA_DeleteOnClose)
'autoscale':True, widget.show()
'vmin':min_,
'vmax':max_} def __processDone(self, event):
origin = x[0], y[0] print 'event', event
scale = (x[-1] - x[0]) / len(x), (y[-1] - y[0]) / len(y)
plotWin.plot.addImage(data, origin=origin, scale=scale,
colormap=colormap)
plotWin.sigRoiApplied.connect(self.__roiApplied)
mdi.addSubWindow(plotWin)
plotWin.show()
return plotWin
def __roiApplied(self, roiData):
widget = RecipSpaceWidget(data_h5f=self.__workspace.xsocsFile,
output_f=None,
qspace_size=None,
image_binning=None,
rect_roi=roiData)
widget.exec_()
if widget.result() == Qt.QDialog.Accepted:
self.__workspace.addQSpaceH5(widget.qspaceH5)
def showEvent(self, event): def showEvent(self, event):
super(XsocsGui, self).showEvent(event) super(XsocsGui, self).showEvent(event)
...@@ -187,7 +153,7 @@ class XsocsGui(Qt.QMainWindow): ...@@ -187,7 +153,7 @@ class XsocsGui(Qt.QMainWindow):
wkSpace.xsocsFile = xsocsH5 wkSpace.xsocsFile = xsocsH5
self.__sessionDock.widget().setXsocsWorkspace(wkSpace) self.__sessionDock.widget().setXsocsWorkspace(wkSpace)
self.__dataDock.widget().setXsocsWorkspace(wkSpace) self.__dataDock.widget().setXsocsWorkspace(wkSpace)
self.__workspace = wkSpace self.__project = wkSpace
self.__closeGreeter() self.__closeGreeter()
...@@ -292,7 +258,7 @@ class XsocsGui(Qt.QMainWindow): ...@@ -292,7 +258,7 @@ class XsocsGui(Qt.QMainWindow):
plotDataDock.setWidget(PlotDataWidget()) plotDataDock.setWidget(PlotDataWidget())
plotDataDock.setObjectName('DataDock') plotDataDock.setObjectName('DataDock')
self.addDockWidget(Qt.Qt.LeftDockWidgetArea, plotDataDock) self.addDockWidget(Qt.Qt.LeftDockWidgetArea, plotDataDock)
plotDataDock.widget().sigItemEvent.connect(self.__dataDockSlot, plotDataDock.widget().sigViewEvent.connect(self.__projectViewSlot,
Qt.Qt.QueuedConnection) Qt.Qt.QueuedConnection)
def __writeSettings(self): def __writeSettings(self):
...@@ -347,7 +313,7 @@ class XsocsGui(Qt.QMainWindow): ...@@ -347,7 +313,7 @@ class XsocsGui(Qt.QMainWindow):
class PlotDataWidget(Qt.QWidget): class PlotDataWidget(Qt.QWidget):
sigItemEvent = Qt.Signal(object) sigViewEvent = Qt.Signal(object)
def __init__(self, parent=None): def __init__(self, parent=None):
super(PlotDataWidget, self).__init__(parent) super(PlotDataWidget, self).__init__(parent)
...@@ -369,7 +335,7 @@ class PlotDataWidget(Qt.QWidget): ...@@ -369,7 +335,7 @@ class PlotDataWidget(Qt.QWidget):
self.__treeView.deleteLater() self.__treeView.deleteLater()
self.__treeView = None self.__treeView = None
view = self.__xsocsProject.view(parent=self) view = self.__xsocsProject.view(parent=self)
view.sigItemEvent.connect(self.sigItemEvent) view.sigItemEvent.connect(self.sigViewEvent)
self.layout().addWidget(view) self.layout().addWidget(view)
self.__treeView = view self.__treeView = view
...@@ -392,7 +358,7 @@ class SessionWidget(Qt.QWidget): ...@@ -392,7 +358,7 @@ class SessionWidget(Qt.QWidget):
# ######### # #########
gbox = Qt.QGroupBox('XSocs file') gbox = Qt.QGroupBox('XSocs file')
boxLayout = Qt.QVBoxLayout(gbox) boxLayout = Qt.QVBoxLayout(gbox)
self.__fileLabel = fileLabel = _AdjustedLineEdit(read_only=True) self.__fileLabel = fileLabel = AdjustedLineEdit(read_only=True)
fileLabel.setAlignment(Qt.Qt.AlignLeft) fileLabel.setAlignment(Qt.Qt.AlignLeft)
boxLayout.addWidget(fileLabel) boxLayout.addWidget(fileLabel)
...@@ -406,18 +372,18 @@ class SessionWidget(Qt.QWidget): ...@@ -406,18 +372,18 @@ class SessionWidget(Qt.QWidget):
# number of angles # number of angles
rowIdx = 0 rowIdx = 0
self.__anglesText = anglesText = _AdjustedLineEdit(3, read_only=True) self.__anglesText = anglesText = AdjustedLineEdit(3, read_only=True)
gridLayout.addWidget(Qt.QLabel('# angles :'), gridLayout.addWidget(Qt.QLabel('# angles :'),
rowIdx, 0, alignment=Qt.Qt.AlignLeft) rowIdx, 0, alignment=Qt.Qt.AlignLeft)
gridLayout.addWidget(anglesText, gridLayout.addWidget(anglesText,
rowIdx, 1, alignment=Qt.Qt.AlignLeft) rowIdx, 1, alignment=Qt.Qt.AlignLeft)
rowIdx += 1 rowIdx += 1
self.__nImgText = nImgText = _AdjustedLineEdit(5, read_only=True) self.__nImgText = nImgText = AdjustedLineEdit(5, read_only=True)
gridLayout.addWidget(Qt.QLabel('Images :'), gridLayout.addWidget(Qt.QLabel('Images :'),
rowIdx, 0, alignment=Qt.Qt.AlignLeft) rowIdx, 0, alignment=Qt.Qt.AlignLeft)
gridLayout.addWidget(nImgText, rowIdx, 1, alignment=Qt.Qt.AlignLeft) gridLayout.addWidget(nImgText, rowIdx, 1, alignment=Qt.Qt.AlignLeft)
self.__imgSizeText = imgSizeText = _AdjustedLineEdit(10, read_only=True) self.__imgSizeText = imgSizeText = AdjustedLineEdit(10, read_only=True)
gridLayout.addWidget(Qt.QLabel('Size :'), gridLayout.addWidget(Qt.QLabel('Size :'),
rowIdx, 2, alignment=Qt.Qt.AlignLeft) rowIdx, 2, alignment=Qt.Qt.AlignLeft)
gridLayout.addWidget(imgSizeText, rowIdx, 3, alignment=Qt.Qt.AlignLeft) gridLayout.addWidget(imgSizeText, rowIdx, 3, alignment=Qt.Qt.AlignLeft)
...@@ -528,9 +494,9 @@ class _WorkspaceDirDialog(Qt.QDialog): ...@@ -528,9 +494,9 @@ class _WorkspaceDirDialog(Qt.QDialog):
layout = Qt.QGridLayout(self) layout = Qt.QGridLayout(self)
label = Qt.QLabel('Workspace :') label = Qt.QLabel('Workspace :')
lineEdit = _AdjustedLineEdit(40) lineEdit = AdjustedLineEdit(40)
lineEdit.setAlignment(Qt.Qt.AlignLeft) lineEdit.setAlignment(Qt.Qt.AlignLeft)
pickButton = _AdjustedPushButton('...') pickButton = AdjustedPushButton('...')
layout.addWidget(label, layout.addWidget(label,
0, 0, 0, 0,
Qt.Qt.AlignLeft) Qt.Qt.AlignLeft)
......
# coding: utf-8
# /*##########################################################################
#
# Copyright (c) 2015-2016 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.
#
# ###########################################################################*/
from __future__ import absolute_import
__authors__ = ["D. Naudet"]
__license__ = "MIT"
__date__ = "15/09/2016"
import sys import sys
from silx.gui import qt as Qt from silx.gui import qt as Qt
print('Using Qt {0}'.format(Qt.qVersion())) print('Using Qt {0}'.format(Qt.qVersion()))
from XsocsGui import XsocsGui from .XsocsGui import XsocsGui
from .MergeWidget import MergeWidget from .MergeWidget import MergeWidget
from .RecipSpaceWidget import RecipSpaceWidget from .process.RecipSpaceWidget import RecipSpaceWidget
def merge_window(*args, **kwargs): def merge_window(*args, **kwargs):
app = Qt.QApplication(sys.argv) app = Qt.QApplication(sys.argv)
...@@ -13,12 +45,14 @@ def merge_window(*args, **kwargs): ...@@ -13,12 +45,14 @@ def merge_window(*args, **kwargs):
mw.show() mw.show()
app.exec_() app.exec_()
def conversion_window(*args, **kwargs): def conversion_window(*args, **kwargs):
app = Qt.QApplication(sys.argv) app = Qt.QApplication(sys.argv)
mw = RecipSpaceWidget(*args, **kwargs) mw = RecipSpaceWidget(*args, **kwargs)
mw.show() mw.show()
app.exec_() app.exec_()
def xsocs_main(*args, **kwargs): def xsocs_main(*args, **kwargs):
app = Qt.QApplication(sys.argv) app = Qt.QApplication(sys.argv)
mw = XsocsGui(*args, **kwargs) mw = XsocsGui(*args, **kwargs)
......
# coding: utf-8
# /*##########################################################################
#
# Copyright (c) 2015-2016 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.
#
# ###########################################################################*/
from __future__ import absolute_import