omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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.


    Any way to hook into the Close Button of a Share extension?

    Pythonista
    uikit appex share sheet
    2
    4
    1508
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • halloleooo
      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?

      Any idea?

      cvp 2 Replies Last reply Reply Quote 0
      • cvp
        cvp @halloleooo 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()
        
        1 Reply Last reply Reply Quote 0
        • cvp
          cvp @halloleooo last edited by

          @halloleooo is it ok?

          1 Reply Last reply Reply Quote 0
          • halloleooo
            halloleooo last edited by

            Thanks @cvp. Works a treat! That's exactly what I want.

            I wasn't aware of will_close but, of course, I found it now in the doco.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB Forums | Contributors