Update Project Tree (#847)

* Rename index textCounts to fileMeta and add main header level
* Add new icons for document layouts
* Add function in NWItem to describe the item
* Use the icons and description in the project tree and details panel
* Remove flags column and add status column with optional full text
* Update handling and display of header level in editor
* Fix potential bug in project tree
* Update tests
This commit is contained in:
Veronica Berglyd Olsen
2021-08-15 17:55:57 +02:00
committed by GitHub
parent cf7cd5502c
commit 97aebc5b84
34 changed files with 833 additions and 196 deletions
+28 -1
View File
@@ -29,7 +29,7 @@ from lxml import etree
from nw.enum import nwItemType, nwItemClass, nwItemLayout
from nw.common import checkInt, isHandle, isItemClass, isItemLayout, isItemType
from nw.constants import nwLists
from nw.constants import nwLabels, nwLists, trConst
logger = logging.getLogger(__name__)
@@ -151,6 +151,33 @@ class NWItem():
return
##
# Methods
##
def describeMe(self, hLevel=None):
"""Return a string description of the item.
"""
descKey = "none"
if self.itemType == nwItemType.ROOT:
descKey = "root"
elif self.itemType == nwItemType.FOLDER:
descKey = "folder"
elif self.itemType == nwItemType.FILE:
if self.itemLayout == nwItemLayout.DOCUMENT:
if hLevel == "H1":
descKey = "doc_h1"
elif hLevel == "H2":
descKey = "doc_h2"
elif hLevel == "H3":
descKey = "doc_h3"
else:
descKey = "document"
elif self.itemLayout == nwItemLayout.NOTE:
descKey = "note"
return trConst(nwLabels.ITEM_DESCRIPTION.get(descKey, ""))
##
# Set Item Values
##