Forum Archive

c.view.present('sheet') ValueError: View is already being presented

halloleooo

I'm using the dialogs module for a share extension. When the extension runs it calls the line

ans = dialogs.list_dialog("Go to another app?", [k for k in apps_list])

to show a choice dialog. This did work for a while, but now I get the following error:

line 417, in list_dialog
    c.view.present('sheet') 
ValueError: View is already being presented or animation is in progress 

Why's that and how can I avoid this?

ps: I remember I experimented with appex.finish() (to close the share sheet before the dialog is displayed), but this did not work as I hoped for. So I have eliminated all calls to appex.finish(), but now I get above error.

cvp

@halloleooo try to call the dialog in a def running in background thread

@ui.in_background
def ...():
    ans = dialogs.list_dialog("Go to another app?", [k for k in apps_list]) 
halloleooo

Thanks @cvp!

So can I decorate my whole main() of the share extension (which includes the ans = dialogs.list_dialog call) with @ui.in_background?

cvp

@halloleooo i would not do that but I would call a function containing only the dialog and only the function would be decorated