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.
NavigationView on screen
-
I didn't see anything in the documentation. I have a NavigationView with a TableView. If I push a new TableView, how can I tell when the view on screen changes? More clarification: I have a custom refresh button that disappears when I push a new view, how do I bring it back when the user returns to the initial view in the NavigationView hierarchy?
-
Ok, this was a tricky one. I suspect there might be an undocumented set of navigationview delegate methods, like
navigationview_will_show_view
or something, but since delegates don't have to implement any or all methods, I can't think of a way, short of omz piping in, to figure out what the name might be.As a workaround, it is possible using a thread that polls the root view of the navigation view to see if it is onscreen.
[Here][1] is such a propertyListener. Your provide the view (well any object really) and a list of properties to watch, and it will poll it and call a callback you define whenever one of the watched properties change. The example I have at the bottom, if you run like a script shows an example using a navigationview. I'd be a little nervous of something crashing when doing some long animation, but I haven't found a case that breaks this.
I've been meaning to write something like this for a while, I can think of several applications, for example interactions with the editor (poll for newly opened files, or periodic auto backup, etc)
[1]: https://gist.github.com/jsbain/87cf25db0d3f1b16c512 -
Very cool. I will look into implementing this a little later today. Thank you for your help!
-
Yeah. I am currently having this same issue. Wondering if there are delegates that are I documented.