From 519e5857d16d5f2195d3b8cf1813811a67ea728d Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sat, 25 Nov 2023 18:23:09 +0100 Subject: [PATCH] Add a column to viewer panel to show the brief --- novelwriter/assets/i18n/project_en_GB.json | 1 + novelwriter/core/coretools.py | 2 +- novelwriter/core/index.py | 2 +- novelwriter/gui/docviewerpanel.py | 8 ++++++-- sample/content/14298de4d9524.nwd | 6 ++++-- sample/content/bb2c23b3c42cc.nwd | 6 ++++-- sample/nwProject.nwx | 8 ++++---- 7 files changed, 21 insertions(+), 12 deletions(-) diff --git a/novelwriter/assets/i18n/project_en_GB.json b/novelwriter/assets/i18n/project_en_GB.json index d29160b8..f630e22f 100644 --- a/novelwriter/assets/i18n/project_en_GB.json +++ b/novelwriter/assets/i18n/project_en_GB.json @@ -1,6 +1,7 @@ { "Synopsis": "Synopsis", "Comment": "Comment", + "Brief": "Brief", "Notes": "Notes", "Tag": "Tag", "Point of View": "Point of View", diff --git a/novelwriter/core/coretools.py b/novelwriter/core/coretools.py index fd040461..fe0b1ba7 100644 --- a/novelwriter/core/coretools.py +++ b/novelwriter/core/coretools.py @@ -449,8 +449,8 @@ class ProjectBuilder: aDoc = project.storage.getDocument(aHandle) aDoc.writeDocument( f"# {noteTitles[newRoot]}\n\n" - f"% Brief: {bfNote}\n\n" f"@tag: {ntTag}\n\n" + f"% Brief: {bfNote}\n\n" ) # Also add the archive and trash folders diff --git a/novelwriter/core/index.py b/novelwriter/core/index.py index 2c76c3ae..1f47256b 100644 --- a/novelwriter/core/index.py +++ b/novelwriter/core/index.py @@ -1264,7 +1264,7 @@ class IndexHeading: # =============================================================================================== # -# text Processing Functions +# Text Processing Functions # =============================================================================================== # CLASSIFIERS = { diff --git a/novelwriter/gui/docviewerpanel.py b/novelwriter/gui/docviewerpanel.py index 5f4f4cc6..e45820e8 100644 --- a/novelwriter/gui/docviewerpanel.py +++ b/novelwriter/gui/docviewerpanel.py @@ -295,6 +295,7 @@ class _ViewPanelKeyWords(QTreeWidget): C_VIEW = 2 C_DOC = 3 C_TITLE = 4 + C_BRIEF = 5 D_TAG = Qt.ItemDataRole.UserRole @@ -307,7 +308,10 @@ class _ViewPanelKeyWords(QTreeWidget): iPx = SHARED.theme.baseIconSize cMg = CONFIG.pxInt(6) - self.setHeaderLabels([self.tr("Tag"), "", "", self.tr("Document"), self.tr("Heading")]) + self.setHeaderLabels([ + self.tr("Tag"), "", "", self.tr("Document"), + self.tr("Heading"), self.tr("Brief") + ]) self.setIndentation(0) self.setSelectionMode(QAbstractItemView.SelectionMode.NoSelection) self.setIconSize(QSize(iPx, iPx)) @@ -321,7 +325,6 @@ class _ViewPanelKeyWords(QTreeWidget): treeHeader.setSectionResizeMode(self.C_NAME, QHeaderView.ResizeMode.ResizeToContents) treeHeader.setSectionResizeMode(self.C_EDIT, QHeaderView.ResizeMode.Fixed) treeHeader.setSectionResizeMode(self.C_VIEW, QHeaderView.ResizeMode.Fixed) - treeHeader.setSectionResizeMode(self.C_DOC, QHeaderView.ResizeMode.ResizeToContents) treeHeader.resizeSection(self.C_EDIT, iPx + cMg) treeHeader.resizeSection(self.C_VIEW, iPx + cMg) @@ -367,6 +370,7 @@ class _ViewPanelKeyWords(QTreeWidget): trItem.setText(self.C_DOC, nwItem.itemName) trItem.setText(self.C_TITLE, hItem.title) trItem.setData(self.C_TITLE, Qt.ItemDataRole.DecorationRole, hDec) + trItem.setText(self.C_BRIEF, hItem.synopsis) trItem.setData(self.C_DATA, self.D_TAG, tag) if tag not in self._treeMap: diff --git a/sample/content/14298de4d9524.nwd b/sample/content/14298de4d9524.nwd index 0f69520e..6150d624 100644 --- a/sample/content/14298de4d9524.nwd +++ b/sample/content/14298de4d9524.nwd @@ -1,10 +1,12 @@ %%~name: John Smith %%~path: f7e2d9f330615/14298de4d9524 %%~kind: CHARACTER/NOTE -%%~hash: 259eff30f10e101cf93e27e8764e851d356d54b8 -%%~date: Unknown/2023-08-25 16:52:03 +%%~hash: fda91c416d874aa41a47fceaedb3d62f040c7e32 +%%~date: Unknown/2023-11-25 18:16:13 # John Smith @tag: John +% Brief: The sidekick + He’s pretty cool. Not Brad Pitt though. \ No newline at end of file diff --git a/sample/content/bb2c23b3c42cc.nwd b/sample/content/bb2c23b3c42cc.nwd index 28175909..d028a12c 100644 --- a/sample/content/bb2c23b3c42cc.nwd +++ b/sample/content/bb2c23b3c42cc.nwd @@ -1,10 +1,12 @@ %%~name: Jane Smith %%~path: f7e2d9f330615/bb2c23b3c42cc %%~kind: CHARACTER/NOTE -%%~hash: a69e4ca6ceede2536c8d364f88e6b62ef0ec36c3 -%%~date: Unknown/2023-08-25 16:52:04 +%%~hash: b7291713899bd0356617a36ae606b08e5fee1b65 +%%~date: Unknown/2023-11-25 18:16:07 # Jane Smith @tag: Jane +% Brief: The heroine + She’s pretty cool. Not Angelina Jolie though. \ No newline at end of file diff --git a/sample/nwProject.nwx b/sample/nwProject.nwx index f2f09e9c..ea845e2c 100644 --- a/sample/nwProject.nwx +++ b/sample/nwProject.nwx @@ -1,6 +1,6 @@ - - + + Sample Project Sample Project Jane Smith @@ -102,11 +102,11 @@ Main Characters - + John Smith - + Jane Smith