1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 <2019> 2020 2021 2022 2023 2024 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 <2019> 2020 2021 2022 2023 2024 |
<== Date ==> | <== Thread ==> |
---|
Subject: | MouseListener and MouseEvent on Intensity Graph in CSS |
From: | Apeksha Chipade - UKRI STFC via Tech-talk <[email protected]> |
To: | "[email protected]" <[email protected]> |
Date: | Wed, 11 Sep 2019 14:09:47 +0000 |
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 |