Skip to content

Script Editor keeps falling back to Python (jython) #17

Open

Description

@hinerm

When I open a python script that was saved in Python (pyimagej) mode, or switch between tabs in the editor, the language keeps switching back to Python (jython)

I don't have any ideas off the top of my head on how to fix this... except that if we are in python mode, then the pyimagej language should be the "preferred" implementation.

However this is fundamentally going to be annoying one way or another, in or out of Python mode or if the user ever wants to use whichever isn't higher priority.

Activity

  1. changed the title [-]Opening python scripts defaults to Python (jython)[/-] [+]Script Editor keeps falling back to Python (jython)[/+] on Aug 24, 2025
  2. hinerm commented on Aug 25, 2025

    @hinerm
    MemberAuthor

    One idea for how this could work:

    • ScriptLanguages get an "active" flag or something to tell if they're ready
    • ScriptLanguageIndex needs to store languages in a multimap or equivalent
    • The index.by[name/extension] methods find the highest priority language that is active
    • The PyImageJ language is set to high priority with an active flag that checks if we're Launching in python mode
  3. hinerm commented on Aug 25, 2025

    @hinerm
    MemberAuthor

    A less invasive idea that I mostly hate:

    • Ship a non-functional PyImageJ script language on Fiji that just exists to notify users of its awareness and guides them to activating Python mode
    • Activating python mode.. swaps the jars? Or adds another, functional script language with high priority and maybe that just supersedes the low-priority broken one?
  4. hinerm commented on Aug 25, 2025

    @hinerm
    MemberAuthor

    I have a working prototype that requires refactoring to scijava-common:

    It seems to work as intended in that when we're in Java mode, the Jython language takes priority and handles python scripts. When we're in Python mode, the PyImageJ script language takes over. (one minor oddness is that the first time I open the script editor, it picks Jython even in Python mode.. but if I open a python script or swap tabs in the editor, it goes back to PyImageJ as I wanted)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions