Title: Add convenience functions for running Python code on the EDT · Issue #12 · scijava/scyjava · GitHub
Open Graph Title: Add convenience functions for running Python code on the EDT · Issue #12 · scijava/scyjava
X Title: Add convenience functions for running Python code on the EDT · Issue #12 · scijava/scyjava
Description: 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 wo...
Open Graph Description: 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_...
X Description: 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(j...
Opengraph URL: https://github.com/scijava/scyjava/issues/12
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add convenience functions for running Python code on the EDT","articleBody":"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:\r\n```python\r\nfrom jnius import PythonJavaClass, java_method\r\n\r\nclass JavaRunnable(PythonJavaClass):\r\n __javainterfaces__ = ['java/lang/Runnable']\r\n\r\n def __init__(self, f):\r\n super(JavaRunnable, self).__init__()\r\n self._f = f\r\n\r\n @java_method('()V')\r\n def run(self):\r\n _f()\r\n\r\nEventQueue = autoclass('java.awt.EventQueue')\r\nEventQueue.invokeLater(JavaRunnable(lambda: ij.ui().showDialog('hello')))\r\n```\r\nWhere `ij.ui().showDialog('hello')` is something that—at least on macOS—hangs the Python process when run from the wrong native thread.\r\n\r\nAs part of this work, we may want to enhance the `to_java` method to accept Python functions and have it wrap them as `Runnable`s.","author":{"url":"https://github.com/ctrueden","@type":"Person","name":"ctrueden"},"datePublished":"2019-12-16T22:29:15.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/12/scyjava/issues/12"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:40c5234c-9bb4-dde8-e01b-ac3dae418643 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 95F8:28D973:D7B9A9:12FF77A:696A674C |
| html-safe-nonce | 18ca0b7eb18aaddd52cddaa5a34ab509050d92984a291e67183a236eeb18458e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NUY4OjI4RDk3MzpEN0I5QTk6MTJGRjc3QTo2OTZBNjc0QyIsInZpc2l0b3JfaWQiOiI2MjA3NTgxNDM2NTc1OTAxNTE2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 5ffab74289a092e90a46ba177210763a748c4f7ca8434aced1b527583f5458e0 |
| hovercard-subject-tag | issue:538710053 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/scijava/scyjava/12/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1c9a666be95e726b19ebf82cdbab548d43e035d910964509d4725947bf9454dd/scijava/scyjava/issues/12 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1c9a666be95e726b19ebf82cdbab548d43e035d910964509d4725947bf9454dd/scijava/scyjava/issues/12 |
| og:image:alt | 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_... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ctrueden |
| hostname | github.com |
| expected-hostname | github.com |
| None | 6fea32d5b7276b841b7a803796d9715bc6cfb31ed549fdf9de2948ac25d12ba6 |
| turbo-cache-control | no-preview |
| go-import | github.com/scijava/scyjava git https://github.com/scijava/scyjava.git |
| octolytics-dimension-user_id | 1262770 |
| octolytics-dimension-user_login | scijava |
| octolytics-dimension-repository_id | 113442144 |
| octolytics-dimension-repository_nwo | scijava/scyjava |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 113442144 |
| octolytics-dimension-repository_network_root_nwo | scijava/scyjava |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f2d9f6432a5a115ec709295ae70623f33bb80aee |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width