print '*** simpleSlice ***' #/usr/local/jdk1.8/bin/java -Djava.awt.headless=true -cp /home/jbf/local/autoplot/autoplot.jar org.autoplot.AutoplotUI --testPngFilename=test_071_001 --script=/home/jbf/ct/hudson/script/test071//testJunoPolarPlotEvents.jy from org.netbeans.jemmy.operators import JFrameOperator, JLabelOperator, JTextFieldOperator, JButtonOperator, DialogOperator import org.netbeans.jemmy.TimeoutExpiredException from org.netbeans.jemmy import QueueTool from org.autoplot.util.jemmy import RegexComponentChooser from org.autoplot import AutoplotUI from java.io import File print 'write file to ', File('.').getAbsolutePath() def sleeping(d,msg=''): setStatus( 'busy: sleeping...%d %s' % ( d, msg ) ) for i in xrange(d/100): sleep(100) setStatus( 'busy: sleeping...%d %s' % (d-i*100,msg) ) setStatus( 'done sleeping... %s' % msg ) sleep(100) app= getViewWindow() mainFrame = JFrameOperator(app) mm= dom.plots[0].controller.dasPlot.getDasMouseInputAdapter().getModuleByLabel("Display Data") dom.plots[0].controller.dasPlot.getDasMouseInputAdapter().setPrimaryModule(mm) randomSeed(0) reset() uri= "vap+inline:x=randomSeed(0)&ripples(40,40)+rand(40,40)*(exp(-distance(40,40,20,20,10,10)/0.3)+exp(-distance(40,40,5,5,10,10)/0.2))" JTextFieldOperator( app.getDataSetSelector().getEditor() ).setText(uri) JButtonOperator( app.getDataSetSelector().getGoButton() ).push() sleeping(200,'wait for data to load') waitUntilIdle() from java.awt import Robot from java.awt.event import InputEvent c= dom.canvases[0].controller.dasCanvas canvasPos= { 'x':c.getLocationOnScreen().x, 'y':c.getLocationOnScreen().y } print canvasPos print 'pe0: ', dom.plotElements[0].controller.renderer.dataSet sleeping(2000,'get ready to click and drag') r= Robot() for i in xrange(70): xx= int( canvasPos['x'] +130 + (70-i) ) yy= int( canvasPos['y'] +130 + 2*(70-i )) r.mouseMove(xx,yy) sleep(10) r.mouseMove(canvasPos['x']+130,canvasPos['y']+130) sleep(500) r.mousePress(InputEvent.BUTTON1_MASK) sleep(500) count=3 while ( dom.plots[0].controller.dasPlot.getDasMouseInputAdapter().getActive()==None and count>0 ): print 'huh line77' r.mouseRelease(InputEvent.BUTTON1_MASK) sleep(500) r.mousePress(InputEvent.BUTTON1_MASK) sleep(500) count= count-1 for i in xrange(0,100,2): r.mouseMove(canvasPos['x']+130+i,canvasPos['y']+130+i) sleep(10) sleep(100) r.mouseRelease(InputEvent.BUTTON1_MASK) sleeping(1000,'get ready for popup') waitUntilIdle() r.mouseMove(canvasPos['x']+400,canvasPos['y']+400) sleep(100) r.mousePress(InputEvent.BUTTON1_MASK) sleep(100) dom.canvases[0].controller.dasCanvas.writeToPng('simpleSlice.png') #writeToPng('testJunoPolarPlotEvents_Alt.png') sleep(100) r.mouseRelease(InputEvent.BUTTON1_MASK) from org.autoplot import ScreenshotsTool from javax.imageio import ImageIO img= ScreenshotsTool.getScreenShot() ImageIO.write(img, "png", File('test071_SimpleSlice.png')); print 'okay' sleeping(1000) from java.lang import System System.exit(0)