def __init__(self, options, db, initial_filter=None): self._filter_text = "" if initial_filter: self._filter_text = initial_filter self._db = db self._frontend_status = None self._backend_status = DBStatus() self._can_process_queries = False self._db_is_up_to_date = True self._last_search_query = None self._pending_search = None self._options = options self._print_results_cb = None if initial_filter: self.should_position_cursor_for_replace = False else: self.should_position_cursor_for_replace = True # First tick should be fast. message_loop.post_delayed_task(self.on_tick, 0)
def status(self): if self._pending_indexer: # Is an integer briefly between _set_dirty and first step_indexer if not isinstance(self._pending_indexer, int): if self._cur_shard_manager: status = "syncing: %s, %s" % ( self._pending_indexer.progress, self._cur_shard_manager.status) else: status = "first-time sync: %s" % self._pending_indexer.progress else: status = "sync scheduled" else: if self._cur_shard_manager: status = "up-to-date: %s" % self._cur_shard_manager.status else: status = "sync required" res = DBStatus() res.is_up_to_date = self.is_up_to_date res.has_index = self.has_index res.status = status return res