Commit 4cfda5e0 authored by Valentin Valls's avatar Valentin Valls

Create a signal with plot item selection (and not legends)

parent 2d405ba8
...@@ -233,10 +233,14 @@ class FlintPlot(PlotWindow): ...@@ -233,10 +233,14 @@ class FlintPlot(PlotWindow):
sigMouseLeft = qt.Signal() sigMouseLeft = qt.Signal()
sigSelectionChanged = qt.Signal(object, object)
# FIXME: It have to be provided by silx
def __init__(self, parent=None, backend=None): def __init__(self, parent=None, backend=None):
super(FlintPlot, self).__init__(parent=parent, backend=backend) super(FlintPlot, self).__init__(parent=parent, backend=backend)
self.sigPlotSignal.connect(self.__limitsChanged) self.sigPlotSignal.connect(self.__plotEvents)
self.__userInteraction = False self.__userInteraction = False
toolbars = self.findChildren(qt.QToolBar) toolbars = self.findChildren(qt.QToolBar)
for tb in toolbars: for tb in toolbars:
...@@ -262,7 +266,7 @@ class FlintPlot(PlotWindow): ...@@ -262,7 +266,7 @@ class FlintPlot(PlotWindow):
def __mouseLeft(self): def __mouseLeft(self):
self.sigMouseLeft.emit() self.sigMouseLeft.emit()
def __limitsChanged(self, eventDict): def __plotEvents(self, eventDict):
if eventDict["event"] == "limitsChanged": if eventDict["event"] == "limitsChanged":
event1 = ViewChangedEvent(self.__userInteraction) event1 = ViewChangedEvent(self.__userInteraction)
self.sigViewChanged.emit(event1) self.sigViewChanged.emit(event1)
...@@ -272,6 +276,15 @@ class FlintPlot(PlotWindow): ...@@ -272,6 +276,15 @@ class FlintPlot(PlotWindow):
) )
self.sigMouseMoved.emit(event2) self.sigMouseMoved.emit(event2)
def __activeCurveChanged(self, previous, current):
# FIXME: This have to be provided by silx in a much better way
if previous is not None:
previous = self.getCurve(previous)
if current is not None:
current = self.getCurve(current)
# NOTE: previous and current was swapped
self.sigSelectionChanged.emit(current, previous)
def keyPressEvent(self, event): def keyPressEvent(self, event):
with self.userInteraction(): with self.userInteraction():
super(FlintPlot, self).keyPressEvent(event) super(FlintPlot, self).keyPressEvent(event)
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