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.


    ValueErrorr: Animation is in progress

    Pythonista
    2
    4
    2523
    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.
    • robinsiebler112
      robinsiebler112 last edited by

      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))
      
      1 Reply Last reply Reply Quote 0
      • ccc
        ccc last edited by

        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)
        
        1 Reply Last reply Reply Quote 0
        • robinsiebler112
          robinsiebler112 last edited by

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

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

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

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