Commit 473ef09b authored by Thomas Vincent's avatar Thomas Vincent

remove unused snap check box widget

parent f47d334e
......@@ -416,9 +416,7 @@ class ShiftPlotWidget(Qt.QWidget):
:param mdlIndex:
"""
plot = self.__plot
plot.clear()
self.__plot.clear()
if not mdlIndex.isValid():
raise ValueError('Invalid index.')
......@@ -509,10 +507,7 @@ class ShiftAreaSelectorWidget(Qt.QWidget):
Args are : the roi, and the node on which the ROI was applied.
"""
def __init__(self,
shiftModel,
rootIndex,
**kwargs):
def __init__(self, shiftModel, rootIndex, **kwargs):
super(ShiftAreaSelectorWidget, self).__init__(**kwargs)
layout = Qt.QGridLayout(self)
......@@ -674,7 +669,6 @@ class ShiftWidget(Qt.QMainWindow):
self.setCentralWidget(centralWidget)
self.__shiftSubject = ShiftSubject(intensityGroup, shiftItem)
# xsocsH5 = intensityGroup.xsocsH5
# Preview panel
self.__selector = ShiftSelectorPanel(self.__shiftSubject)
......@@ -709,22 +703,12 @@ class ShiftWidget(Qt.QMainWindow):
self.setTabPosition(
Qt.Qt.AllDockWidgetAreas, Qt.QTabWidget.North)
# options
isRegular = True
# optionsSubGroup = GroupBox('Options')
# layout = Qt.QVBoxLayout(optionsSubGroup)
self.__snapBn = snapBn = Qt.QCheckBox('Grid shift.')
# layout.addWidget(snapBn)
# isRegular = xsocsH5.is_regular_grid(xsocsH5.entries()[0])
# snapBn.setEnabled(isRegular)
snapBn.setChecked(isRegular)
# "Ref" panel
self.__refPanel = ShiftPlotWidget(treeView.model(),
treeView.rootIndex(),
applyRoi=True,
showSelection=True)
self.__refPanel.setSnapToPoint(isRegular)
self.__refPanel.setSnapToPoint(True)
self.__refPanel.lockEntry(True)
refSubGroup = GroupBox('Reference')
layout = Qt.QVBoxLayout(refSubGroup)
......@@ -736,7 +720,7 @@ class ShiftWidget(Qt.QMainWindow):
treeView.rootIndex(),
applyRoi=True,
showSelection=True)
self.__setPanel.setSnapToPoint(isRegular)
self.__setPanel.setSnapToPoint(True)
self.__setPanel.plot().setPointSelectionEnabled(True)
linearShiftBn = Qt.QPushButton('Apply linear shift')
......@@ -827,8 +811,6 @@ class ShiftWidget(Qt.QMainWindow):
resetShiftBn.clicked.connect(self.__slotResetShiftClicked)
resetAllShiftBn.clicked.connect(self.__slotResetAllShiftClicked)
snapBn.toggled.connect(self.__slotSnapBnToggled)
bottomBnGrp.rejected.connect(self.close)
bottomBnGrp.accepted.connect(self.__slotAccepted)
......@@ -842,7 +824,7 @@ class ShiftWidget(Qt.QMainWindow):
def __slotAccepted(self):
"""Slot called when the "save" button is clicked"""
self.__shiftSubject.writeToShiftH5(
isSnapped=self.__snapBn.isChecked(),
isSnapped=True,
progressCb=self.__saveProgBar.setValue)
self.close()
......@@ -917,46 +899,35 @@ class ShiftWidget(Qt.QMainWindow):
def __slotLinearShiftWholeRangeClicked(self):
return self.__slotLinearShiftClicked(wholeRange=True)
def __slotSnapBnToggled(self, checked):
"""Slot called when the "snap to grid" checkbox is toggled.
:param checked:
"""
self.__setPanel.setSnapToPoint(checked)
self.__refPanel.setSnapToPoint(checked)
self.__previewPanel.setSnapToGrid(checked)
self.__updateShiftPlot()
def __updateShiftPlot(self):
"""Updates the shift plot"""
shifts = self.__shiftSubject.getShifts()
nShifts = len(shifts)
if self.__snapBn.isChecked():
dx = np.ndarray(nShifts, dtype=np.int32)
dy = np.ndarray(nShifts, dtype=np.int32)
for iShift, shift in enumerate(shifts):
grid_shift = shift.grid_shift
if grid_shift is None:
grid_shift = [0, 0]
dx[iShift] = grid_shift[0]
dy[iShift] = grid_shift[1]
self.__xShiftPlot.addCurve(np.arange(dx.size),
dx,
color='red',
legend='gridshift_dx',
yaxis='right',
linestyle=' ',
symbol='s')
self.__yShiftPlot.addCurve(np.arange(dy.size),
dy,
color='red',
legend='gridshift_dy',
yaxis='right',
linestyle=' ',
symbol='s')
dx = np.ndarray(nShifts, dtype=np.int32)
dy = np.ndarray(nShifts, dtype=np.int32)
for iShift, shift in enumerate(shifts):
grid_shift = shift.grid_shift
if grid_shift is None:
grid_shift = [0, 0]
dx[iShift] = grid_shift[0]
dy[iShift] = grid_shift[1]
self.__xShiftPlot.addCurve(np.arange(dx.size),
dx,
color='red',
legend='gridshift_dx',
yaxis='right',
linestyle=' ',
symbol='s')
self.__yShiftPlot.addCurve(np.arange(dy.size),
dy,
color='red',
legend='gridshift_dy',
yaxis='right',
linestyle=' ',
symbol='s')
dx = np.ndarray(nShifts, dtype=np.double)
dy = np.ndarray(nShifts, dtype=np.double)
......
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