I have a small "options" UI which I want to display as a popover window when the user taps a certain place in the main interface.
It's working the first time I tap, the popover shows up in the place specified by popover_location in the call to view.present(). But after dismissing it the first time, trying to show it again produces this traceback:
Traceback (most recent call last):
File "/private/var/mobile/Library/Mobile Documents.../Gestures.py", line 443, in _general_action
action(data)
File "/private/var/mobile/Library/Mobile Documents.../controls.py", line 1578, in _handleSingleTap
picker.present(style="popover", animated=False, popover_location=(x,y))
ValueError: View is already being presented or animation is in progress
I removed everything from the ui.View subclass which defines the popover so it is an empty shell:
class Popover(ui.View):
def __init__(self, func, *args, **kws):
views.PyUiView.__init__(self, *args, **kws)
print "popover initialized"
def will_close(self):
print "popover closing"
and I still get the traceback the second time I try to call present() from the code which handles displaying the view, or any time thereafter.
Is calling present() on the same view more than once not allowed (I don't see anything indicating that in the docs)? I'm not explicitly calling view.close(), but I thought that once the popover was dismissed, that was automatic, which is why I do see will_close() being called. Even if I attach a callback which is called from will_close() and tries calling view.close() on the popover from the outside, it still doesn't prevent the traceback.