def init_index_process(self, path): """Starts the indexing process. Fires up the relevant methods in a thread. Then checks if something was already indexed, and clears the environment accordingly. """ if (path is not None): tvhandler = TVHandler(self, path) self._tvhandlers.append(tvhandler) #self.set_buttons_sensitivity(False) tvhandler.add_to_viewport() tvhandler.pbar.set_text("") tvhandler.hbpbar.show() dbmanager = DBManager(self, tvhandler) self._dbmanagers.append(dbmanager) if dbmanager.index_new_dir(path) is True: fscountthread = dbmanager.start_counting() tvhandler.dbmanager = dbmanager gobject.timeout_add(500, tvhandler.check_if_counting_finished, fscountthread) tvhandler.hbpbar.show() tvhandler.is_scanning = True else: self.set_buttons_sensitivity(True)
def load_catalog_from_filename(self, filename): opened = False for tvhandler in self._tvhandlers: if tvhandler.path == get_scanned_path_from_catalog(filename): self._notebook.set_current_page(self._tvhandlers. index(tvhandler)) opened = True if opened is False: path = get_scanned_path_from_catalog(filename) tvhandler = TVHandler(self, path) self._tvhandlers.append(tvhandler) dbmanager = DBManager(self, tvhandler) self._dbmanagers.append(dbmanager) dbmanager.create_connection(filename, path) dbmanager.set_root_node() tvhandler.dbmanager = dbmanager tvhandler.add_to_viewport() tvhandler.print_output()