Menu

#394 more nice Jython features

Someday
open
nobody
None
5
2020-02-17
2014-10-11
No

A couple more jython features that would be nice, as I'm writing this polarScatter script for Bill:

  1. We have find usages, so it would be straight-forward to determine if a variable name is unassigned when it is dereferenced. This is to catch typos that aren't caught until runtime (e.g. fileParam instead of filtParm)
  2. find usages can probably be run automatically, showing usages when a symbol is the carot focus. Or show usages should have a keystroke to encourage its use.
  3. popup documentation for getDataSet can grab more metadata from uri completions, presenting doc strings. This is really handy, but it could be better.
  4. getDataSet can be run in the background until the variable is needed. For example, the jython wrapper for QDataSet could have an unresolved state until the data read is finished. This script I'm working on only uses about 30% of the CPU because it is I/O-bound. Also it would be nice to have iterators that are able to access the data as it comes in, but that is a huge new project.

Discussion

  • Jeremy Faden

    Jeremy Faden - 2014-10-14

    Regarding (4), I added getDataSets( list, monitor )-> list yesterday, after realizing this would be fairly easy to implement. For example,

    uri4= 'http://cdaweb.gsfc.nasa.gov/istp_public/data/ace/sis/level_2_cdaweb/sis_h1/2012/ac_h1_sis_20120117_v04.cdf?flux_He'
    uri5= 'http://cdaweb.gsfc.nasa.gov/istp_public/data/ace/mag/level_2_cdaweb/mfi_k0/2012/ac_k0_mfi_20120117_v01.cdf?Magnitude'
    ( ds4, ds5 ) = getDataSets( ( uri4,uri5 ), monitor.getSubtaskMonitor('getDataSets') )
    

    This loads all the given datasets in parallel.

     

    Last edit: Jeremy Faden 2016-06-23
  • Jeremy Faden

    Jeremy Faden - 2017-11-05

    The thing I'd like most (besides more consistent behavior) would be completions within callbacks, especially with a graphics argument.

    This provides completions to the graphics object "g":

    from java.awt import Graphics2D
    from java.awt.image import BufferedImage
    bi=BufferedImage(640,480,BufferedImage.TYPE_4BYTE_ABGR)
    g= bi.getGraphics()
    g.draw3DRect(200,200,100,100,True)
    from javax.imageio import ImageIO
    from java.io import File
    ImageIO.write(bi,'png',File('/tmp/file.png'))
    

    but this doesn't:

    from org.das2.graph import Painter
    class MyPainter(Painter):
        def paint(self,g):
            g.color= Color.PINK
            g.fillRect( 100,100,200,200 )
            g.color= Color.RED
            g.drawRect( 100,100,200,200 )
    
    dom.canvases[0].controller.getDasCanvas().addBottomDecorator(MyPainter())
    
     
  • Jeremy Faden

    Jeremy Faden - 2020-02-05

    A while ago I added a check for "paint" and "g" and use Graphics2D completions. This satisfies the 2017-11-05 message.

     
  • Jeremy Faden

    Jeremy Faden - 2020-02-17
     
MongoDB Logo MongoDB