def __init__(self, dbmanager): self._dbmanager = dbmanager self._conn = dbmanager.conn MetaDir.createTable(connection = self._conn) FileAbstract.createTable(connection = self._conn) File.createTable(connection = self._conn) Directory.createTable(connection = self._conn) Video.createTable(connection = self._conn) Audio.createTable(connection = self._conn) Photo.createTable(connection = self._conn)
def tvfilelist_cursor_changed_cb(self, tvfl): """Callback that handles the selection in the file list treeview. Each time the file list selection changes, gets the selected node and calls the main handler's relevant method to update the info pane. """ (_model, _iter) = tvfl.get_selection().get_selected() path = tvfl.get_model().get_value(_iter, 3) node = FileAbstract.select(FileAbstract.q.strabs == path, connection = self._conn) node = node[0] self.set_infopane_content(node)
def search(self, term): results = FileAbstract.select("""file_abstract.name LIKE '%""" + term + """%'""", connection = self._con) for file in results: index = self.find_text(file.name, term) name2 = file.name.decode("utf-8") str2 = file.__str__().decode("utf-8") text2 = term.decode("utf-8") namemarkup = name2[0:index] namemarkup += "<b>" namemarkup += name2[index:index + len(text2)] namemarkup += "</b>" namemarkup += name2[index + len(text2):len(name2)] namemarkup += "\n" + str2 node = [ICONS[MIMES[file.mimetype]], namemarkup.replace("&", "&"), file.strsize, file.__str__(), file.parent, file.size, self._filename, file.name] #self._searchhandler.lssearch.append([ICONS[MIMES[file.mimetype]], namemarkup.replace("&", "&"), # file.strsize, file.__str__(), file.parent, # file.size]) self._searchhandler.notify_and_add(self, node)