Commit 0b029764 authored by Thomas Vincent's avatar Thomas Vincent

update QSpace dialog selected scans table to add phi and energy

parent 8a59451d
......@@ -559,8 +559,7 @@ class QSpaceWidget(Qt.QDialog):
self.__nAnglesLabel, line, 1, alignment=Qt.Qt.AlignLeft)
infoLayout.setColumnStretch(2, 1)
self.__scansTable = Qt.QTableWidget(0, 2)
self.__scansTable.verticalHeader().hide()
self.__scansTable = Qt.QTableWidget(0, 4)
grpLayout.addWidget(self.__scansTable, alignment=Qt.Qt.AlignLeft)
# ################
......@@ -790,26 +789,36 @@ class QSpaceWidget(Qt.QDialog):
def __fillScansInfo(self):
"""Fills the QTableWidget with info found in the input file"""
converter = self.__converter
if converter is None:
if self.__converter is None:
return
scans = converter.scans
scans = self.__converter.scans
self.__scansTable.verticalHeader().hide()
self.__scansTable.setHorizontalHeaderLabels(
['scan', 'eta (°)', 'phi (°)', 'energy (eV)'])
self.__scansTable.setSelectionMode(self.__scansTable.NoSelection)
self.__scansTable.setRowCount(len(scans))
for row, scan in enumerate(scans):
params = converter.scan_params(scan)
item = Qt.QTableWidgetItem(scan)
item.setFlags(item.flags() ^ Qt.Qt.ItemIsEditable)
self.__scansTable.setItem(row, 0, item)
item = Qt.QTableWidgetItem(str(params['angle']))
item.setFlags(item.flags() ^ Qt.Qt.ItemIsEditable)
self.__scansTable.setItem(row, 1, item)
with XsocsH5(self.__converter.xsocsH5_f, mode='r') as h5f:
for row, scan in enumerate(scans):
eta = h5f.positioner(scan, 'eta')
phi = h5f.positioner(scan, 'phi')
beam_energy = h5f.beam_energy(entry=scan)
for column, value in enumerate(
(scan, '%g' % eta, '%g' % phi, '%g' % beam_energy)):
item = Qt.QTableWidgetItem(value)
self.__scansTable.setItem(row, column, item)
self.__scansTable.resizeColumnsToContents()
width = (sum([self.__scansTable.columnWidth(i)
for i in range(self.__scansTable.columnCount())]) +
self.__scansTable.verticalHeader().width() +
20)
# TODO : the size is wrong when the
# verticalScrollBar is not displayed yet
# scans_table.verticalScrollBar().width())
......@@ -818,8 +827,8 @@ class QSpaceWidget(Qt.QDialog):
self.__scansTable.setMinimumSize(size)
# TODO : warning if the ROI is empty (too small to contain images)
params = converter.scan_params(scans[0])
roi = converter.roi
params = self.__converter.scan_params(scans[0])
roi = self.__converter.roi
if roi is None:
xMin = xMax = yMin = yMax = 'ns'
else:
......@@ -830,7 +839,7 @@ class QSpaceWidget(Qt.QDialog):
self.__roiYMinEdit.setText(str(yMin))
self.__roiYMaxEdit.setText(str(yMax))
indices = converter.sample_indices
indices = self.__converter.sample_indices
nImgTxt = '{0} / {1}'.format(len(indices),
params['n_images'])
self.__nImgLabel.setText(nImgTxt)
......
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