def _continue(self): # It's important that the databases are blocked on this thread, and not # on the main thread, otherwise the program would hang if some # occurrences are activated while the user is performing an action core_api.block_databases(block=True) search_old_occurrences_event.signal(filename=self.filename, last_search=self.exclmint) self.state = 0 while self.state < 1: self.search = organism_api.get_occurrences_range( mint=self.exclmint, maxt=self.whileago, filenames=(self.filename, )) self.state = 2 # Make sure to bind *after* self.search is instantiated and # self.state is set to 2, but *before* it's started core_api.bind_to_closing_database(self._handle_closing_database) self.search.start() if self.state == 1: self._abort() else: self._process_results() core_api.release_databases()