Vector35 / snippets

plugin for storing and using snippets of useful Binja script
MIT License
22 stars 9 forks source link

Snippets hang UI #4

Open yrp604 opened 4 years ago

yrp604 commented 4 years ago

2144-dev Personal, Windows

import time
time.sleep(20)

Will render the UI entirely unresponsive. Obviously sleeping in a snippet like this is stupid, but it's the same behavior as iterating over a bunch of data.

psifertex commented 4 years ago

I've been experimenting with background threads, but iirc there's a reason it intentionally does not background right now. We'll see how the testing goes.

yrp604 commented 4 years ago

Sounds good.

An idea I had that might be more generally useful, have you used click or other progress bar things apis? https://click.palletsprojects.com/en/7.x/utils/#showing-progress-bars

Something like that when iterating over bbs that was blessed in some way to update the UI would be really slick.

psifertex commented 4 years ago

Oh, that's a neat idea. I dunno if it would be easy to generically add though. There's probably too many things with iterators to try to hook/check/update.

But maybe some better snippet samples showing how to leverage that for better feedback would be helpful if the background thread doesn't work out (background thread can do a similar thing with the status bar if it works)

And also has a cancel button which is great.

psifertex commented 3 years ago

I've just pushed a background thread version of snippets execution. I still can't figure out a way to make them interruptible but in the meantime this at least lets you close down more gracefully and or otherwise still interact with the UI. Could use some more testing before I push it to the plugin manager, feedback welcome.