Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
How to create stash like panel ui?
-
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?
-
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
threading
module. (I think Stash runs all of its code in background threads.) -
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.