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