Class JythonManager

java.lang.Object
ucar.unidata.ui.WindowHolder
ucar.unidata.idv.IdvManager
ucar.unidata.idv.JythonManager
edu.wisc.ssec.mcidasv.JythonManager
All Implemented Interfaces:
OnFileChangeListener, ActionListener, EventListener, ucar.unidata.idv.IdvConstants

public class JythonManager extends ucar.unidata.idv.JythonManager
Overrides the IDV's JythonManager to associate a JythonShell with a given JythonManager.
  • Nested Class Summary

    Nested classes/interfaces inherited from class ucar.unidata.idv.JythonManager

    ucar.unidata.idv.JythonManager.LibHolder
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private ucar.unidata.idv.ui.JythonShell
    Associated Jython Shell.
    private static final Logger
     

    Fields inherited from class ucar.unidata.idv.JythonManager

    CONSOLE_INIT, jythonLogger, PROP_JYTHON_EDITOR

    Fields inherited from class ucar.unidata.ui.WindowHolder

    contents, dialog, frame, window

    Fields inherited from interface ucar.unidata.idv.IdvConstants

    ARG_B64BUNDLE, ARG_B64ISL, ARG_BUNDLE, ARG_CATALOG, ARG_CHOOSER, ARG_CLEARDEFAULT, ARG_CODE, ARG_CONNECT, ARG_CURRENTTIME, ARG_DATA, ARG_DEBUG, ARG_DEFAULT, ARG_DISPLAY, ARG_DXML, ARG_FIXEDTIME, ARG_HELP, ARG_IMAGE, ARG_IMAGESERVER, ARG_INSTALLPLUGIN, ARG_ISLFILE, ARG_ISLINTERACTIVE, ARG_LISTRESOURCES, ARG_MAINCLASS, ARG_MOVIE, ARG_MSG_DEBUG, ARG_MSG_RECORD, ARG_NODEFAULT, ARG_NOERRORSINGUI, ARG_NOGUI, ARG_NOONEINSTANCE, ARG_NOPLUGINS, ARG_NOPREF, ARG_ONEINSTANCEPORT, ARG_PLUGIN, ARG_PORT, ARG_PRINTJNLP, ARG_PROPERTIES, ARG_SCRIPT, ARG_SERVER, ARG_SETFILES, ARG_SITEPATH, ARG_TEMPLATE, ARG_TEST, ARG_TESTEVAL, ARG_TRACE, ARG_TRACEONLY, ARG_USERPATH, DEFAULT_DATE_FORMAT, DEFAULT_DOCPATH, DEFAULT_TIMEZONE, FILTER_CPT, FILTER_ISL, FILTER_JNLP, FILTER_XIDV, FILTER_XIDVZIDV, FILTER_XML, FILTER_ZIDV, ID_COMMANDSTORUN, ID_DATASOURCES, ID_DISPLAYCONTROLS, ID_IDV, ID_JYTHON, ID_MESSAGE, ID_MISCHASHTABLE, ID_NCIDV_VERSION, ID_VERSION, ID_VIEWMANAGERS, ID_WINDOWS, INITIAL_PROBE_EARTHLOCATION, NULL_DATA_SELECTION, NULL_STRING, PREF_APPEARANCEMODE, PREF_ARCHIVEDIR, PREF_ARCHIVENAME, PREF_AUTODISPLAYS_ENABLE, PREF_AUTODISPLAYS_SHOWGUI, PREF_AUTOSELECTDATA, PREF_CACHESIZE, PREF_CONTROLSINTABS, PREF_DATAPREFIX, PREF_DATE_FORMAT, PREF_DISTANCEUNIT, PREF_DOCACHE, PREF_EMBEDDATACHOOSERINDASHBOARD, PREF_EMBEDFIELDSELECTORINDASHBOARD, PREF_EMBEDLEGENDINDASHBOARD, PREF_EMBEDQUICKLINKSINDASHBOARD, PREF_EVENT_KEYBOARDMAP, PREF_EVENT_MOUSEMAP, PREF_EVENT_WHEELMAP, PREF_FAST_RENDER, PREF_FIELD_CACHETHRESHOLD, PREF_FILEREADDIR, PREF_FILEWRITEDIR, PREF_GEOMETRY_BY_REF, PREF_HISTORY, PREF_IMAGE_BY_REF, PREF_LARGE_REMOTE_DATA_WARN, PREF_LASTVERSION, PREF_LATLON_FORMAT, PREF_LEGEND_SHOWICONS, PREF_LOCALE, PREF_LOOKANDFEEL, PREF_MAXIMAGESIZE, PREF_MEMORY, PREF_NPOT_IMAGE, PREF_OPEN_ASK, PREF_OPEN_MERGE, PREF_OPEN_REMOVE, PREF_PROJ_LIST, PREF_SAMPLINGMODE, PREF_SHOWCONTROLWINDOW, PREF_SHOWDASHBOARD, PREF_SHOWDECODEDIALOG, PREF_SHOWHIDDENFILES, PREF_SHOWQUITCONFIRM, PREF_SITEPATH, PREF_THREADS_DATA, PREF_THREADS_RENDER, PREF_TIMEZONE, PREF_VERTICALCS, PREF_VERTICALUNIT, PREF_WINDOW_SHOWTOOLBAR, PREF_ZIDV_ASK, PREF_ZIDV_DIRECTORY, PREF_ZIDV_SAVETOTMP, PROP_3DMODE, PROP_ABOUTTEXT, PROP_APPRESOURCEPATH, PROP_CHOOSERS, PROP_CHOOSERS_ALL, PROP_CONTROLDESCRIPTORS, PROP_CONTROLDESCRIPTORS_ALL, PROP_DATAHOLDERBOUNDS, PROP_DEFAULTLOCATIONS, PROP_DISPLAYLIST_GROUP, PROP_FIXFILELOCKUP, PROP_JNLPCODEBASE, PROP_JNLPTEMPLATE, PROP_JNLPTITLE, PROP_LOADINGXML, PROP_MAP_GLOBE_LEVEL, PROP_MAP_MAP_LEVEL, PROP_MINIMUMFRAMECYCLETIME, PROP_MONITORPORT, PROP_OLDCONTROLDESCRIPTORS, PROP_ONEINSTANCEPORT, PROP_PREFERENCES, PROP_PROJ_NAME, PROP_RESOURCEFILES, PROP_SHOWCLOCK_DASH, PROP_SHOWCLOCK_VIEW, PROP_SHOWDASHBOARD, PROP_SHOWDATATREE, PROP_SHOWFORMULAS, PROP_SHOWSPLASH, PROP_SPLASHICON, PROP_UI_DESKTOP, PROP_USE_DISPLAYAREA, PROP_USE_TIMEDRIVER, PROP_VERSIONFILE, PROP_WINDOW_SCREENSIZEOFFSET, PROP_WINDOW_SIZEHEIGHT, PROP_WINDOW_SIZEWIDTH, PROP_WINDOW_USESCREENSIZE, SUFFIX_BAT, SUFFIX_CPT, SUFFIX_ISL, SUFFIX_JNLP, SUFFIX_RBI, SUFFIX_SH, SUFFIX_XIDV, SUFFIX_XML, SUFFIX_ZIDV
  • Constructor Summary

    Constructors
    Constructor
    Description
    JythonManager(ucar.unidata.idv.IntegratedDataViewer idv)
    Create the manager and call initPython.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.python.util.PythonInterpreter
    Create and initialize a Jython interpreter.
    ucar.unidata.idv.ui.JythonShell
    Create a Jython shell, if one doesn't already exist.
    doMakeFormulaDataSourceMenuItems(ucar.unidata.data.DataSource dataSource)
    Return the list of menu items to use when the user has clicked on a formula DataSource.
    void
    evaluateTrusted(String code, Map<String,Object> properties)
    Overridden so that McIDAS-V can add an islInterpreter object to the interpreter's locals (before executing the contents of .
    ucar.unidata.idv.ui.JythonShell
    Returns the Jython Shell associated with this JythonManager.
    void
    removeInterpreter(org.python.util.PythonInterpreter interpreter)
    Removes the given interpreter from the list of active interpreters.
    static boolean
    Determine if the user should be warned about a potential bug that we've been unable to resolve.
    private void
    sortMenuItems(List<?> items)
     

    Methods inherited from class ucar.unidata.idv.JythonManager

    addFormula, appendJython, appendJythonFromBundle, appendTmpJython, applicationClosing, checkUntrustedJython, createNewLibrary, dataGroupsChanged, deleteKeyPressed, descriptorChanged, doMakeContents, doMakeDataChoiceMenuItems, doMakeEditMenuItems, doMakeEditMenuItems, editInExternalEditor, editInExternalEditorInner, evaluateAction, evaluateDataChoice, evaluateTrusted, evaluateUntrusted, evaluateUntrusted, exportFormulas, exportFormulasToPlugin, exportSelectedToPlugin, exportToPlugin, findJythonMethods, findJythonMethods, getDefaultDescriptors, getDerivedDataInterpreter, getDerivedDataInterpreter, getDescriptorDataSource, getDescriptors, getElapsedInterpreterInit, getEndUserDescriptors, getInError, getLibHolders, getLocalDescriptors, getUiInterpreter, getUsersJythonText, getWindowTitle, handleApplicationExit, importFormulas, initJythonEnvironment, initUserFormulas, isFileInJythonLibrary, makeFileMenu, makeFormula, makeNewLibrary, makeProcedureMenu, onFileCreate, onFileDelete, onFileModify, quietRemoveLibrary, removeFormula, removeFormula, removeLibrary, saveOnExit, selectFormulas, showFormulaDialog, showFormulaDialog, showFormulaDialog, showHelp, showHelp, showJythonEditor, updateLibrary, writeJythonLib, writeUserFormulas

    Methods inherited from class ucar.unidata.idv.IdvManager

    getArgsManager, getCollabManager, getColorTableManager, getDataManager, getIdv, getIdvChooserManager, getIdvClass, getIdvProjectionManager, getIdvUIManager, getImageGenerator, getInstallManager, getJythonManager, getPersistenceManager, getPreferenceManager, getProperty, getProperty, getProperty, getPublishManager, getResourceManager, getStateManager, getStationModelManager, getStore, getVMManager, logException, showNormalCursor, showWaitCursor, waitUntilDisplaysAreDone, waitUntilDisplaysAreDone

    Methods inherited from class ucar.unidata.ui.WindowHolder

    actionPerformed, close, getContents, getDialog, getFrame, getWindow, isShowing, removeAll, setMenuBar, setWindowTitle, shouldMakeDialog, show, show, showModal, toFront, windowIsClosing

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.awt.event.ActionListener

    actionPerformed

    Methods inherited from interface edu.wisc.ssec.mcidasv.util.pathwatcher.OnFileChangeListener

    onWatchInvalidation
  • Field Details

    • jythonShell

      private ucar.unidata.idv.ui.JythonShell jythonShell
      Associated Jython Shell. May be null.
    • logger

      private static final Logger logger
  • Constructor Details

    • JythonManager

      public JythonManager(ucar.unidata.idv.IntegratedDataViewer idv)
      Create the manager and call initPython.
      Parameters:
      idv - The IDV.
  • Method Details

    • createShell

      public ucar.unidata.idv.ui.JythonShell createShell()
      Create a Jython shell, if one doesn't already exist. This will also bring the window "to the front" of the rest of the McIDAS-V session.
      Overrides:
      createShell in class ucar.unidata.idv.JythonManager
      Returns:
      JythonShell object for interactive Jython usage.
    • getShell

      public ucar.unidata.idv.ui.JythonShell getShell()
      Returns the Jython Shell associated with this JythonManager.
      Returns:
      Jython Shell being used by this manager. May be null.
    • createInterpreter

      public org.python.util.PythonInterpreter createInterpreter()
      Create and initialize a Jython interpreter.
      Overrides:
      createInterpreter in class ucar.unidata.idv.JythonManager
      Returns:
      Newly created Jython interpreter.
    • removeInterpreter

      public void removeInterpreter(org.python.util.PythonInterpreter interpreter)
      Removes the given interpreter from the list of active interpreters.

      Also attempts to close any Jython Shell associated with the interpreter.

      Overrides:
      removeInterpreter in class ucar.unidata.idv.JythonManager
      Parameters:
      interpreter - Interpreter to remove. Should not be null.
    • evaluateTrusted

      public void evaluateTrusted(String code, Map<String,Object> properties)
      Overridden so that McIDAS-V can add an islInterpreter object to the interpreter's locals (before executing the contents of .
      Overrides:
      evaluateTrusted in class ucar.unidata.idv.JythonManager
      Parameters:
      code - Jython code to evaluate. null is probably a bad idea.
      properties - String->Object pairs to insert into the locals. Parameter may be null.
    • doMakeFormulaDataSourceMenuItems

      public List doMakeFormulaDataSourceMenuItems(ucar.unidata.data.DataSource dataSource)
      Return the list of menu items to use when the user has clicked on a formula DataSource.
      Overrides:
      doMakeFormulaDataSourceMenuItems in class ucar.unidata.idv.JythonManager
      Parameters:
      dataSource - The data source clicked on.
      Returns:
      List of menu items.
    • sortMenuItems

      private void sortMenuItems(List<?> items)
    • shouldWarnImageCapturing

      public static boolean shouldWarnImageCapturing()
      Determine if the user should be warned about a potential bug that we've been unable to resolve.

      The conditions for the bug to appear are:

      • In background mode (i.e. running a script).
      • Geometry by reference is disabled.
      • New font rendering is enabled.
      Returns:
      true if the user's configuration has made it possible for bug to manifest.