[WIP] Explore ways to make napari-animation work with async prototype
See original GitHub issueThis task is motivated by a comment in the NAP’s first PR.
The napari-animation plugin is an example of a plugin that relies on the mutation of Dims.current_step
being synchronous (both with an active viewer and headless). There are likely others too, but it should serve as a good example that we know is well used.
Here are some possible solutions/ideas, but others likely exist.
- Define new async entry points in the API and leave the existing sync ones alone (e.g.
Dims.set_current_step_async
). - Define a context manager that forces synchronous (or maybe asynchronous?) slicing.
- Define functions like
LayerSlicer.waitUntilIdle
to wait for any pending slicing tasks to be done.
The output of this task should describe a solution with working prototype code. We should probably cover the examples in the napari-animation repo. We should incorporate the description into the NAP to address the questions and feedback in the original comment and replies.
Edit: Initial text comes from @andy-sweet. Github didn’t seem to track the attribution.
Issue Analytics
- State:
- Created a year ago
- Comments:30 (30 by maintainers)
Top Results From Across the Web
Override function prototype with async method, keeping this ...
Option 1 (Not executed in order): Person.prototype.asyncFunction1 = function () { someApiCall() .then((e) => console.log(e)) .catch() return ...
Read more >animation with canvas becomes grayscale due to screenshot ...
I noticed that for some image sequences (especially large images) the animation grayes out when using the "with Canvas" capture mode on the ......
Read more >async function - JavaScript - MDN Web Docs - Mozilla
The async function declaration declares an async function where the await keyword is permitted within the function body. The async and await ...
Read more >Exploring Async/Await Functions in JavaScript - DigitalOcean
In this post we're quickly going over the ins and outs of async/await functions; introduced with ES2017 to help write synchronous-looking ...
Read more >async - C# Reference - Microsoft Learn
An async method runs synchronously until it reaches its first await expression, at which point the method is suspended until the awaited task...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
loving watching this from afar @kephale and @andy-sweet !
I think I like this option the most 😃
Great. I’m happy to close this one now.