From f14ebb5512292dd5ce28468fd44c81bc808d14c8 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Tue, 9 Jun 2020 16:30:58 +0200 Subject: [PATCH] Updated icons in outline and project tree --- nw/gui/outline.py | 7 ++++--- nw/gui/projtree.py | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/nw/gui/outline.py b/nw/gui/outline.py index 2d2716f8..b2c45f86 100644 --- a/nw/gui/outline.py +++ b/nw/gui/outline.py @@ -371,7 +371,7 @@ class GuiOutline(QTreeWidget): tLevel = self.theIndex.novelIndex[tHandle][sTitle]["level"] tTime = self.theIndex.novelIndex[tHandle][sTitle]["updated"] - tItem = self._createTreeItem(tHandle, sTitle) + tItem = self._createTreeItem(tHandle, sTitle, tLevel) self.treeMap[titleKey] = tItem if tLevel == "H1": @@ -410,17 +410,18 @@ class GuiOutline(QTreeWidget): return - def _createTreeItem(self, tHandle, sTitle): + def _createTreeItem(self, tHandle, sTitle, tLevel): """Populate a tree item with all the column values. """ nwItem = self.theProject.projTree[tHandle] novIdx = self.theIndex.novelIndex[tHandle][sTitle] newItem = QTreeWidgetItem() + hIcon = "doc_%s" % tLevel.lower() newItem.setText(self.colIndex[nwOutline.TITLE], novIdx["title"]) newItem.setData(self.colIndex[nwOutline.TITLE], Qt.UserRole, tHandle) - newItem.setIcon(self.colIndex[nwOutline.TITLE], self.theTheme.getIcon("hash")) + newItem.setIcon(self.colIndex[nwOutline.TITLE], self.theTheme.getIcon(hIcon)) newItem.setText(self.colIndex[nwOutline.LEVEL], novIdx["level"]) newItem.setText(self.colIndex[nwOutline.LABEL], nwItem.itemName) newItem.setIcon(self.colIndex[nwOutline.LABEL], self.theTheme.getIcon("proj_document")) diff --git a/nw/gui/projtree.py b/nw/gui/projtree.py index 7a3c98fb..b7b9029c 100644 --- a/nw/gui/projtree.py +++ b/nw/gui/projtree.py @@ -67,7 +67,7 @@ class GuiProjectTree(QTreeWidget): self.clearTree() # Build GUI - iPx = self.theTheme.textIconSize + iPx = self.theTheme.baseIconSize self.setIconSize(QSize(iPx, iPx)) self.setExpandsOnDoubleClick(True) self.setIndentation(iPx) @@ -758,8 +758,8 @@ class GuiProjectTree(QTreeWidget): self.addTopLevelItem(newItem) self.orphRoot = newItem newItem.setExpanded(True) - newItem.setData(self.C_NAME, "") - newItem.setIcon(self.C_NAME, self.theTheme.getIcon("warning")) + newItem.setData(self.C_NAME, Qt.UserRole, "") + newItem.setIcon(self.C_NAME, self.theTheme.getIcon("proj_orphan")) return def _cleanOrphanedRoot(self):