def addIconFromCache(self, node): item = NodeItem(node) pixmap = self.pixmapCache.find(node.path + "/" + node.name) icon = QIcon(pixmap) item.setIcon(icon) item.setText(str(node.name)) item.setEditable(False) items = [] items.append(item) self.appendRow(items)
def addIconFromImage(self, img, node): item = NodeItem(node) pixmap = QPixmap() pixmap = pixmap.fromImage(img) self.pixmapCache.insert(node.path + "/" + node.name, pixmap) icon = QIcon(pixmap) item.setIcon(icon) item.setText(str(node.name)) item.setEditable(False) items = [] items.append(item) self.appendRow(items)
def addIcon(self, node): item = NodeItem(node) if node.next.empty(): icon = QIcon(":folder_empty_128.png") else: if node.attr.size != 0: icon = QIcon(":folder_documents_128.png") else: icon = QIcon(":folder_128.png") item.setIcon(icon) item.setText(str(node.name)) item.setEditable(False) items = [] items.append(item) self.appendRow(items)