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 callback mechanism for GUI mode #301

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Add callback mechanism for GUI mode #301

wants to merge 12 commits into from

Commits on Jul 15, 2024

  1. In GUI mode, stash ImageJ gateway in a global var

    Otherwise, there is no way to access it from other threads.
    
    This may be useful for scenarios like napari-imagej, where access to
    Python scripting is available from threads other than the blocked one.
    ctrueden authored and elevans committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    fec5cee View commit details
    Browse the repository at this point in the history
  2. Make rai_lock property private

    This is an internal variable, not intended as public API.
    ctrueden authored and elevans committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    bd2e4d3 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    f38b200 View commit details
    Browse the repository at this point in the history
  4. Simplify name of ImageJ2 gateway fixture

    It doesn't need to be "ij_wrapper" or "ij_fixture".
    It's OK to be ij!
    elevans committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    29c2f9e View commit details
    Browse the repository at this point in the history
  5. Add a simple test of when_imagej_starts callback

    This test checks that functions registered via
    when_imagej_starts get called as part of imagej.init.
    ctrueden authored and elevans committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    ccb0e81 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    221da1e View commit details
    Browse the repository at this point in the history
  7. Add docs section on how to use when_imagej_starts

    This commit adds section 5.2 to the "Convenience methods of
    PyImageJ" that describes how to use the when_image_starts
    callback mechanism.
    elevans committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    3bae68b View commit details
    Browse the repository at this point in the history
  8. Add check to determine if current thread is main

    This commit introduces a check to determine if the current
    running thread is the main thread. If True, then we continue to block
    interactive mode on macOS (it is not possible to share the main thread
    with GUI event loop needed for the ImageJ GUI). If False, then the
    current thread is *not* the main thread (e.g. a jaunched session) and
    interactive mode for macOS can proceed.
    elevans committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    735304b View commit details
    Browse the repository at this point in the history

Commits on Jul 19, 2024

  1. Use descriptive attribute name for callback test

    Use a more descriptive attribute name and value for
    when_imagej_starts() test.
    elevans committed Jul 19, 2024
    Configuration menu
    Copy the full SHA
    7667a09 View commit details
    Browse the repository at this point in the history
  2. Improve macOS pthread detection exception handling

    This commit adds the pthread library loading exception to
    the logger and assumes that the current thread is the main
    thread if no pthread library is found.
    elevans committed Jul 19, 2024
    Configuration menu
    Copy the full SHA
    972592d View commit details
    Browse the repository at this point in the history

Commits on Oct 14, 2024

  1. Use None as the getattr default, not True

    The default here should be None, not True, otherwise
    this test does not actually test for the `_testing`
    attribute value.
    elevans committed Oct 14, 2024
    Configuration menu
    Copy the full SHA
    b2ce4cb View commit details
    Browse the repository at this point in the history

Commits on Oct 15, 2024

  1. Improve gui mode gateway clean up

    This commit improves how we clean up the gateway once the UI
    is closed in gui mode. Although it is highly unlikely, it is possible
    for a user to run into a NameError when deleting the gateway if a user
    enters gui mode but is NOT on macos and successfully exits the gui
    without crashing the session (see next below, this requires some playing
    around). This is resolved by assigning the gateway to None, ensuring
    there is *something* to delete if no gateway object is assigned.
    
    This commit also adds an additional check for a running JVM instance
    when in gui mode on non-macos systems. This prevents a
    `jpype._core.JVMNotRunning: Java Virtual Machine is not running`
    error that is produced when the imagej ui visbility is polled but
    is no longer available because the JVM has been shut down via
    gui interactions.
    elevans committed Oct 15, 2024
    Configuration menu
    Copy the full SHA
    45c1448 View commit details
    Browse the repository at this point in the history