Hi all,
I am working on a way to draw a line on an intensity graph in CSS BOY. I have a Jython script which can track the image co-ordinates.
Now, I need to have a way by which I can capture the mouse events on the intensity graph like click and release.
I am a novice in writing Jython scripts. I came across
this thread (https://epics.anl.gov/tech-talk/2017/msg00775.php) and dropped the idea of using pynput package.
I have created a MouseListener to listen to pressed event, but it seems I cannot get the mouse events. Have I missed anything?
This is my script:
from org.csstudio.opibuilder.scriptUtil import PVUtil, ConsoleUtil
from org.csstudio.swt.widgets.figures.IntensityGraphFigure import IPixelInfoProvider
from org.eclipse.draw2d import MouseEvent
from org.eclipse.draw2d import MouseListener
from org.eclipse.ui import PlatformUI
from org.eclipse.swt.events import MouseWheelListener
class MyPixelInfoProvider(IPixelInfoProvider):
#### Provide custom information for each pixel.
def getPixelInfo(self, xIndex, yIndex, xCoordinate, yCoordinate, pixelValue):
result = "My index is (" + str(xIndex) + ", " + str(yIndex) + " )"
ConsoleUtil.writeInfo(result)
return result
widget.getFigure().addPixelInfoProvider(MyPixelInfoProvider())
class MyListener2(MouseListener):
def mousePressed(self, event):
ConsoleUtil.writeInfo("down")
my_listener2 = MyListener2()
widget.getFigure().addMouseListener(my_listener2)
Many thanks in advance.
Kind Regards,
Apeksha Chipade