Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a REPL widget that supports the SciJava ScriptREPL #265

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
3 changes: 0 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ on:
- main
tags:
- "*-[0-9]+.*"
pull_request:
branches:
- main

env:
NAPARI_IMAGEJ_TEST_TIMEOUT: 60000
Expand Down
9 changes: 9 additions & 0 deletions doc/Configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ One common use case for this feature is to increase the maximum heap space avail

Specifying 32GB of memory available to ImageJ ecosystem routines in the JVM.

Using the SciJava REPL
--------------------------------
Comment on lines +98 to +99
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if this would be better suited to the new Usage page of the ReadTheDocs...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or the Troubleshooting page...


You can use the SciJava REPL to interactively run SciJava code. This makes it possible to do things like paste existing SciJava scripts into the REPL. More information on scripting in SciJava can be found `here <https://imagej.net/scripting/>`_.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I played a little with the Script REPL, and I couldn't get anything beyond 2+4 to work. I was trying to print Hello World, but I couldn't even figure out how to do that.

So, as a result, I looked here, and I checked out imagej.net/scripting. As someone who is not intimately familiar with that page, I wasn't super sure where to go. I did find the ScriptInterpreter page from that page, which appears to me to be what this is, but I tried typing :help and I didn't get anything.

Then, I typed help, and my napari froze. I went back to my terminal, and I saw this:

(napari-imagej-dev) ➜  napari-imagej git:(scijava-repl) napari
hello
[java.lang.Enum.toString] hello[java.lang.Enum.toString] 
Hello World
[java.lang.Enum.toString] Hello World[java.lang.Enum.toString] 
Hello World
[java.lang.Enum.toString] Hello World[java.lang.Enum.toString] 
Hello World
[java.lang.Enum.toString] Hello World[java.lang.Enum.toString] 
Hello World
[java.lang.Enum.toString] Hello World[java.lang.Enum.toString] 

Welcome to Python 2.7!  This is the online help utility.

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://docs.python.org/2.7/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, or topics, type "modules",
"keywords", or "topics".  Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as "spam", type "modules spam".

help> [java.lang.Enum.toString] 
Welcome to Python 2.7!  This is the online help utility.

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://docs.python.org/2.7/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, or topics, type "modules",
"keywords", or "topics".  Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as "spam", type "modules spam".

help> 

So, long story short, it looks like the output is not being captured by the TextEdit, and also I'm wondering if we can link to documentation that is more specific to the SciJava REPL.

To solve the output not being captured by the TextEdit, is there an option in SciJava for this @ctrueden?


.. figure:: https://media.imagej.net/napari-imagej/scijava_repl.png

The REPL can be shown/hidden by clicking on the command prompt icon.


.. _Fiji: https://imagej.net/software/fiji/
.. _ImageJ2: https://imagej.net/software/imagej2/
Expand Down
4 changes: 4 additions & 0 deletions src/napari_imagej/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,9 @@

import scyjava as sj

from napari_imagej.model import NapariImageJ

__author__ = "ImageJ2 developers"
__version__ = sj.get_version("napari-imagej")

nij = NapariImageJ()
Loading