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