diff --git a/nw/constants/constants.py b/nw/constants/constants.py index 92378a73..66b026fc 100644 --- a/nw/constants/constants.py +++ b/nw/constants/constants.py @@ -136,7 +136,6 @@ class nwLabels(): } OUTLINE_COLS = { nwOutline.TITLE : "Title", - nwOutline.HANDLE : "Handle", nwOutline.LEVEL : "Level", nwOutline.LABEL : "Document", nwOutline.LINE : "Line", diff --git a/nw/constants/enum.py b/nw/constants/enum.py index c4a0f031..ee33c575 100644 --- a/nw/constants/enum.py +++ b/nw/constants/enum.py @@ -107,21 +107,20 @@ class nwAlert(Enum): class nwOutline(Enum): TITLE = 0 - HANDLE = 1 - LEVEL = 2 - LABEL = 3 - LINE = 4 - CCOUNT = 5 - WCOUNT = 6 - PCOUNT = 7 - POV = 8 - CHAR = 9 - PLOT = 10 - TIME = 11 - WORLD = 12 - OBJECT = 13 - ENTITY = 14 - CUSTOM = 15 - SYNOP = 16 + LEVEL = 1 + LABEL = 2 + LINE = 3 + CCOUNT = 4 + WCOUNT = 5 + PCOUNT = 6 + POV = 7 + CHAR = 8 + PLOT = 9 + TIME = 10 + WORLD = 11 + OBJECT = 12 + ENTITY = 13 + CUSTOM = 14 + SYNOP = 15 # END Enum nwOutline diff --git a/nw/gui/outline.py b/nw/gui/outline.py index 982f21c9..0636cddc 100644 --- a/nw/gui/outline.py +++ b/nw/gui/outline.py @@ -30,7 +30,7 @@ import nw from time import time -from PyQt5.QtCore import Qt +from PyQt5.QtCore import Qt, QSize from PyQt5.QtWidgets import ( QTreeWidget, QTreeWidgetItem, QMenu, QAction, QAbstractItemView ) @@ -43,7 +43,6 @@ class GuiProjectOutline(QTreeWidget): DEF_WIDTH = { nwOutline.TITLE : 200, - nwOutline.HANDLE : 0, nwOutline.LEVEL : 40, nwOutline.LABEL : 150, nwOutline.LINE : 40, @@ -63,7 +62,6 @@ class GuiProjectOutline(QTreeWidget): DEF_HIDDEN = { nwOutline.TITLE : False, - nwOutline.HANDLE : True, nwOutline.LEVEL : True, nwOutline.LABEL : False, nwOutline.LINE : True, @@ -103,6 +101,10 @@ class GuiProjectOutline(QTreeWidget): self.setDragEnabled(False) self.itemDoubleClicked.connect(self._treeDoubleClick) + iPx = self.theTheme.textIconSize + self.setIconSize(QSize(iPx, iPx)) + self.setIndentation(iPx) + self.treeHead = self.header() self.treeHead.setContextMenuPolicy(Qt.CustomContextMenu) self.treeHead.customContextMenuRequested.connect(self._headerRightClick) @@ -187,7 +189,7 @@ class GuiProjectOutline(QTreeWidget): clicked, and send it to the main gui class for opening in the document editor. """ - tHandle = tItem.text(self.colIndex[nwOutline.HANDLE]) + tHandle = tItem.data(self.colIndex[nwOutline.TITLE], Qt.UserRole) try: tLine = int(tItem.text(self.colIndex[nwOutline.LINE])) except: @@ -332,7 +334,6 @@ class GuiProjectOutline(QTreeWidget): # Make sure title column is always visible, # and handle column always hidden self.setColumnHidden(self.colIndex[nwOutline.TITLE], False) - self.setColumnHidden(self.colIndex[nwOutline.HANDLE], True) headItem = self.headerItem() headItem.setTextAlignment(self.colIndex[nwOutline.CCOUNT], Qt.AlignRight) @@ -408,7 +409,8 @@ class GuiProjectOutline(QTreeWidget): newItem = QTreeWidgetItem() newItem.setText(self.colIndex[nwOutline.TITLE], novIdx["title"]) - newItem.setText(self.colIndex[nwOutline.HANDLE], tHandle) + newItem.setData(self.colIndex[nwOutline.TITLE], Qt.UserRole, tHandle) + newItem.setIcon(self.colIndex[nwOutline.TITLE], self.theTheme.getIcon("proj_document")) newItem.setText(self.colIndex[nwOutline.LEVEL], novIdx["level"]) newItem.setText(self.colIndex[nwOutline.LABEL], nwItem.itemName) newItem.setText(self.colIndex[nwOutline.LINE], sTitle[1:].lstrip("0")) @@ -451,7 +453,7 @@ class GuiOutlineHeaderMenu(QMenu): self.actionMap = {} for hItem in nwOutline: - if hItem == nwOutline.TITLE or hItem == nwOutline.HANDLE: + if hItem == nwOutline.TITLE: continue self.actionMap[hItem] = QAction(nwLabels.OUTLINE_COLS[hItem], self) self.actionMap[hItem].setCheckable(True) @@ -469,7 +471,7 @@ class GuiOutlineHeaderMenu(QMenu): self.acceptToggle = False for hItem in nwOutline: - if hItem == nwOutline.TITLE or hItem == nwOutline.HANDLE or hItem not in hiddenState: + if hItem == nwOutline.TITLE or hItem not in hiddenState: continue self.actionMap[hItem].setChecked(not hiddenState[hItem])