Forum Archive

ValueErrorr: Animation is in progress

robinsiebler112

In the below code, I have a form open. Clicking on the 'search' button loads another form in the 'prompt_search' function. Interacting with that form triggers the 'search_tasks' function. If the results of the search are negative, I want to close the search dialog and display a popover stating as much. However, I get a ValueError when I try to load the last screen. How do I fix this?


    def prompt_search(self, sender):
        """Prompt the user for a search string."""

        self.search_dialog = ui.load_view('dialogs/search_dialog')
        self.search_dialog.present('sheet')

    def search_tasks(self, sender):
        """Search the task list for a task whose note or tag contains the user provided search string."""

        search_string = self.search_dialog['textfield1'].text.lower()
        tasks = self.tasklist.search(search_string)
        if tasks:
            self.search_dialog.close()
            self.show_tasks(sender,tasks=tasks)
        else:
            self.search_dialog.close()
            self.message_dialog = ui.load_view('dialogs/message_dialog')
            self.message_dialog['label1'].text = 'There were no tasks containing "{}".'.format(search_string)
            self.message_dialog.present('popover', popover_location = (500,500))
ccc

Could you please put a try / except block around the code and let us know what gets printed...

try:
    <your code here>
except ValueError as err:
    print(type(err), err)
robinsiebler112

'View is already being presented or animation is in progress"

robinsiebler112

I commented out the 2nd self.search_dialog.close() and I no longer get the error.