Any way to hook into the Close Button of a Share extension?
halloleooo last edited by halloleooo
With the help of the generous advice of the people on this forum I have written a image extension. So far, so good, so happy.
Let's look at the work flow: Say, in the Files app I have selected some images, then go to Share --> Pyhonista --> My Script and then the Image UI opens:
Now when I decide I want close the UI I do this via the Close button (circled in the screenshot). However the Pyhonista script selector stays visible then. Programmatically I know I can dismiss it with
appex.finish(), but how can I hook this call up to the Close button?
cvp last edited by cvp
@halloleooo so easy 😀 (or I didn't understand the question)
import ui import appex class MyView(ui.View): def __init__(self): pass def will_close(self): appex.finish() def main(): v = MyView() v.present() if __name__ == '__main__': main()
cvp last edited by
@halloleooo is it ok?
halloleooo last edited by
Thanks @cvp. Works a treat! That's exactly what I want.
I wasn't aware of
will_closebut, of course, I found it now in the doco.