Fix: ImageView sigTimeChanged was only emitted on mouse interaction

This commit is contained in:
2xB 2019-08-08 17:39:11 +02:00
parent ad7453c781
commit 4e6629f352

View File

@ -131,7 +131,7 @@ class ImageView(QtGui.QWidget):
self.scene = self.ui.graphicsView.scene() self.scene = self.ui.graphicsView.scene()
self.ui.histogram.setLevelMode(levelMode) self.ui.histogram.setLevelMode(levelMode)
self.ignoreTimeLine = False self.ignorePlaying = False
if view is None: if view is None:
self.view = ViewBox() self.view = ViewBox()
@ -498,11 +498,11 @@ class ImageView(QtGui.QWidget):
def setCurrentIndex(self, ind): def setCurrentIndex(self, ind):
"""Set the currently displayed frame index.""" """Set the currently displayed frame index."""
self.currentIndex = np.clip(ind, 0, self.getProcessedImage().shape[self.axes['t']]-1) index = np.clip(ind, 0, self.getProcessedImage().shape[self.axes['t']]-1)
self.updateImage() self.ignorePlaying = True
self.ignoreTimeLine = True # Implicitly call timeLineChanged
self.timeLine.setValue(self.tVals[self.currentIndex]) self.timeLine.setValue(self.tVals[index])
self.ignoreTimeLine = False self.ignorePlaying = False
def jumpFrames(self, n): def jumpFrames(self, n):
"""Move video frame ahead n frames (may be negative)""" """Move video frame ahead n frames (may be negative)"""
@ -696,16 +696,13 @@ class ImageView(QtGui.QWidget):
return norm return norm
def timeLineChanged(self): def timeLineChanged(self):
#(ind, time) = self.timeIndex(self.ui.timeSlider) if not self.ignorePlaying:
if self.ignoreTimeLine: self.play(0)
return
self.play(0)
(ind, time) = self.timeIndex(self.timeLine) (ind, time) = self.timeIndex(self.timeLine)
if ind != self.currentIndex: if ind != self.currentIndex:
self.currentIndex = ind self.currentIndex = ind
self.updateImage() self.updateImage()
#self.timeLine.setPos(time)
#self.emit(QtCore.SIGNAL('timeChanged'), ind, time)
self.sigTimeChanged.emit(ind, time) self.sigTimeChanged.emit(ind, time)
def updateImage(self, autoHistogramRange=True): def updateImage(self, autoHistogramRange=True):