How to create stash like panel ui?
yas last edited by
I want to create stash like panel ui and when running stash it does not affect the interpreter and can run other codes , how do I do that?
dgelessus last edited by
If you want to show a view as a panel tab, use
v.present("panel"). There can be multiple "panel" views at once, so if you present your own view as a panel it will not affect Stash (or the other way around).
If you want to run your code so it doesn't block the main Python console, you need to run it in a background thread using the
threadingmodule. (I think Stash runs all of its code in background threads.)
JonB last edited by
the other trick, if you plan in being able to run other scripts, is you need to bypass global clearing for your code.
there are a few ways to do this. the best way is to have all of your code in a module that is in site-packages, import the module, then call some main() to show the ui. modules in site-packages don't get cleared when running other code. Other approaches are to ensure everything you need is in a single custom view class, with no use of globals (callbacks should use self, or sender). all methods should explictly import anything that is needed, since imports might dissappear from globals. when you present the custom view, the object won't be cleared until it is explictly closed.