diff --git a/novelwriter/dialogs/__init__.py b/novelwriter/dialogs/__init__.py
index b7a1dd46..10dddcd6 100644
--- a/novelwriter/dialogs/__init__.py
+++ b/novelwriter/dialogs/__init__.py
@@ -24,6 +24,7 @@ from novelwriter.dialogs.docmerge import GuiDocMerge
from novelwriter.dialogs.docsplit import GuiDocSplit
from novelwriter.dialogs.itemeditor import GuiItemEditor
from novelwriter.dialogs.preferences import GuiPreferences
+from novelwriter.dialogs.projdetails import GuiProjectDetails
from novelwriter.dialogs.projload import GuiProjectLoad
from novelwriter.dialogs.projsettings import GuiProjectSettings
from novelwriter.dialogs.quotes import GuiQuoteSelect
@@ -36,6 +37,7 @@ __all__ = [
"GuiDocSplit",
"GuiItemEditor",
"GuiPreferences",
+ "GuiProjectDetails",
"GuiProjectLoad",
"GuiProjectSettings",
"GuiQuoteSelect",
diff --git a/novelwriter/gui/projdetails.py b/novelwriter/dialogs/projdetails.py
similarity index 95%
rename from novelwriter/gui/projdetails.py
rename to novelwriter/dialogs/projdetails.py
index a1a769a5..1673c21b 100644
--- a/novelwriter/gui/projdetails.py
+++ b/novelwriter/dialogs/projdetails.py
@@ -81,6 +81,13 @@ class GuiProjectDetails(PagedDialog):
return
+ def updateValues(self):
+ """Set all the values of the pages.
+ """
+ self.tabMain.updateValues()
+ self.tabContents.updateValues()
+ return
+
##
# Slots
##
@@ -176,24 +183,20 @@ class GuiProjectDetailsMain(QWidget):
# Stats
# =====
- hCounts = self.theIndex.getNovelTitleCounts()
- nwCount = self.theIndex.getNovelWordCount()
-
self.wordCountLbl = QLabel("%s:" % self.tr("Words"))
- self.wordCountVal = QLabel(f"{nwCount:n}")
+ self.wordCountVal = QLabel("")
self.chapCountLbl = QLabel("%s:" % self.tr("Chapters"))
- self.chapCountVal = QLabel(f"{hCounts[2]:n}")
+ self.chapCountVal = QLabel("")
self.sceneCountLbl = QLabel("%s:" % self.tr("Scenes"))
- self.sceneCountVal = QLabel(f"{hCounts[3]:n}")
+ self.sceneCountVal = QLabel("")
self.revCountLbl = QLabel("%s:" % self.tr("Revisions"))
- self.revCountVal = QLabel(f"{self.theProject.saveCount:n}")
+ self.revCountVal = QLabel("")
- edTime = self.theProject.getCurrentEditTime()
self.editTimeLbl = QLabel("%s:" % self.tr("Editing Time"))
- self.editTimeVal = QLabel(f"{edTime//3600:02d}:{edTime%3600//60:02d}")
+ self.editTimeVal = QLabel("")
self.statsGrid = QGridLayout()
self.statsGrid.addWidget(self.wordCountLbl, 0, 0, 1, 1, Qt.AlignRight)
@@ -214,7 +217,6 @@ class GuiProjectDetailsMain(QWidget):
self.projPathLbl = QLabel("%s:" % self.tr("Path"))
self.projPathVal = QLineEdit()
- self.projPathVal.setText(self.theProject.projPath)
self.projPathVal.setReadOnly(True)
self.projPathBox = QHBoxLayout()
@@ -240,6 +242,23 @@ class GuiProjectDetailsMain(QWidget):
return
+ def updateValues(self):
+ """Set all the values.
+ """
+ hCounts = self.theIndex.getNovelTitleCounts()
+ nwCount = self.theIndex.getNovelWordCount()
+ edTime = self.theProject.getCurrentEditTime()
+
+ self.wordCountVal.setText(f"{nwCount:n}")
+ self.chapCountVal.setText(f"{hCounts[2]:n}")
+ self.sceneCountVal.setText(f"{hCounts[3]:n}")
+ self.revCountVal.setText(f"{self.theProject.saveCount:n}")
+ self.editTimeVal.setText(f"{edTime//3600:02d}:{edTime%3600//60:02d}")
+
+ self.projPathVal.setText(self.theProject.projPath)
+
+ return
+
# END Class GuiProjectDetailsMain
@@ -376,9 +395,6 @@ class GuiProjectDetailsContents(QWidget):
self.setLayout(self.outerBox)
- self._prepareData()
- self._populateTree()
-
return
def getColumnSizes(self):
@@ -393,6 +409,13 @@ class GuiProjectDetailsContents(QWidget):
]
return retVals
+ def updateValues(self):
+ """Populate the tree.
+ """
+ self._prepareData()
+ self._populateTree()
+ return
+
##
# Internal Functions
##
diff --git a/novelwriter/gui/__init__.py b/novelwriter/gui/__init__.py
index 6b233b9e..4e0d96ea 100644
--- a/novelwriter/gui/__init__.py
+++ b/novelwriter/gui/__init__.py
@@ -26,7 +26,6 @@ from novelwriter.gui.mainmenu import GuiMainMenu
from novelwriter.gui.noveltree import GuiNovelTree
from novelwriter.gui.outline import GuiOutline
from novelwriter.gui.outlinedetails import GuiOutlineDetails
-from novelwriter.gui.projdetails import GuiProjectDetails
from novelwriter.gui.projtree import GuiProjectTree
from novelwriter.gui.statusbar import GuiMainStatus
from novelwriter.gui.theme import GuiTheme
@@ -41,7 +40,6 @@ __all__ = [
"GuiNovelTree",
"GuiOutline",
"GuiOutlineDetails",
- "GuiProjectDetails",
"GuiProjectTree",
"GuiTheme",
]
diff --git a/novelwriter/guimain.py b/novelwriter/guimain.py
index 658be71d..2dd45d80 100644
--- a/novelwriter/guimain.py
+++ b/novelwriter/guimain.py
@@ -39,12 +39,13 @@ from PyQt5.QtWidgets import (
from novelwriter.gui import (
GuiDocEditor, GuiDocViewDetails, GuiDocViewer, GuiItemDetails, GuiMainMenu,
- GuiMainStatus, GuiNovelTree, GuiOutline, GuiOutlineDetails,
- GuiProjectDetails, GuiProjectTree, GuiTheme
+ GuiMainStatus, GuiNovelTree, GuiOutline, GuiOutlineDetails, GuiProjectTree,
+ GuiTheme
)
from novelwriter.dialogs import (
GuiAbout, GuiDocMerge, GuiDocSplit, GuiItemEditor, GuiPreferences,
- GuiProjectLoad, GuiProjectSettings, GuiUpdates, GuiWordList
+ GuiProjectDetails, GuiProjectLoad, GuiProjectSettings, GuiUpdates,
+ GuiWordList
)
from novelwriter.tools import GuiBuildNovel, GuiProjectWizard, GuiWritingStats
from novelwriter.core import NWProject, NWIndex
@@ -1017,6 +1018,7 @@ class GuiMain(QMainWindow):
dlgDetails.setModal(False)
dlgDetails.show()
dlgDetails.raise_()
+ dlgDetails.updateValues()
return
diff --git a/tests/test_gui/test_gui_projdetails.py b/tests/test_dialogs/test_dlg_projdetails.py
similarity index 96%
rename from tests/test_gui/test_gui_projdetails.py
rename to tests/test_dialogs/test_dlg_projdetails.py
index 7ecf3d3e..b0643d0c 100644
--- a/tests/test_gui/test_gui_projdetails.py
+++ b/tests/test_dialogs/test_dlg_projdetails.py
@@ -25,7 +25,7 @@ from tools import getGuiItem
from PyQt5.QtWidgets import QAction, QMessageBox
-from novelwriter.gui import GuiProjectDetails
+from novelwriter.dialogs import GuiProjectDetails
keyDelay = 2
typeDelay = 1
@@ -33,7 +33,7 @@ stepDelay = 20
@pytest.mark.gui
-def testGuiProjDetails_Dialog(qtbot, monkeypatch, nwGUI, nwLipsum):
+def testDlgProjDetails_Dialog(qtbot, monkeypatch, nwGUI, nwLipsum):
"""Test the project details dialog.
"""
# Block message box
@@ -111,4 +111,4 @@ def testGuiProjDetails_Dialog(qtbot, monkeypatch, nwGUI, nwLipsum):
projDet._doClose()
nwGUI.closeMain()
-# END Test testGuiProjDetails_Dialog
+# END Test testDlgProjDetails_Dialog