You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's add scyjava.awt.invoke(python_function) as a shortcut for EventQueue.invokeAndWait(java_runnable_object), and scyjava.awt.queue(python_function) as a shortcut for EventQueue.invokeLater(java_runnable_object). Internally it would work like this:
We could even provide convenience classes like this for all classes in the java.util.function package that would live at the top level of scijava, or maybe we could just put it at scijava.function. Unfortunately, we cannot auto map python functions/lambdas because we can only check the number of arguments but not the types, e.g. Function vs LongFunction and we do not know if anything is being returned (Consumer vs Function).
That would be quite a bit of work but is something that is probably very suitable for a student.
Let's add
scyjava.awt.invoke(python_function)
as a shortcut forEventQueue.invokeAndWait(java_runnable_object)
, andscyjava.awt.queue(python_function)
as a shortcut forEventQueue.invokeLater(java_runnable_object)
. Internally it would work like this:Where
ij.ui().showDialog('hello')
is something that—at least on macOS—hangs the Python process when run from the wrong native thread.As part of this work, we may want to enhance the
to_java
method to accept Python functions and have it wrap them asRunnable
s.The text was updated successfully, but these errors were encountered: