Add a novel info dialog
This commit is contained in:
@@ -157,9 +157,13 @@ class GuiMainMenu(QMenuBar):
|
||||
|
||||
# Project > Project Details
|
||||
self.aProjectDetails = self.projMenu.addAction(self.tr("Project Details"))
|
||||
self.aProjectDetails.setShortcut("Shift+F6")
|
||||
self.aProjectDetails.triggered.connect(self.mainGui.showProjectDetailsDialog)
|
||||
|
||||
# Project > Novel Info
|
||||
self.aNovelInfo = self.projMenu.addAction(self.tr("Novel Info"))
|
||||
self.aNovelInfo.setShortcut("Shift+F6")
|
||||
self.aNovelInfo.triggered.connect(self.mainGui.showNovelInfoDialog)
|
||||
|
||||
# Project > Separator
|
||||
self.projMenu.addSeparator()
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ from novelwriter.dialogs.preferences import GuiPreferences
|
||||
from novelwriter.dialogs.projdetails import GuiProjectDetails
|
||||
from novelwriter.dialogs.projsettings import GuiProjectSettings
|
||||
from novelwriter.tools.welcome import GuiWelcome
|
||||
from novelwriter.tools.novelinfo import GuiNovelInfo
|
||||
from novelwriter.tools.manuscript import GuiManuscript
|
||||
from novelwriter.tools.dictionaries import GuiDictionaries
|
||||
from novelwriter.tools.writingstats import GuiWritingStats
|
||||
@@ -836,6 +837,18 @@ class GuiMain(QMainWindow):
|
||||
dialog.updateValues()
|
||||
return
|
||||
|
||||
@pyqtSlot()
|
||||
def showNovelInfoDialog(self) -> None:
|
||||
"""Open the novel info dialog."""
|
||||
if SHARED.hasProject:
|
||||
dialog = GuiNovelInfo(self)
|
||||
dialog.setModal(True)
|
||||
dialog.show()
|
||||
dialog.raise_()
|
||||
qApp.processEvents()
|
||||
# dialog.updateValues()
|
||||
return
|
||||
|
||||
@pyqtSlot()
|
||||
def showBuildManuscriptDialog(self) -> None:
|
||||
"""Open the build manuscript dialog."""
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
"""
|
||||
novelWriter – GUI Novel Info
|
||||
============================
|
||||
|
||||
File History:
|
||||
Created: 2024-01-18 [2.3b1] GuiNovelInfo
|
||||
|
||||
This file is a part of novelWriter
|
||||
Copyright 2018–2024, Veronica Berglyd Olsen
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
from PyQt5.QtGui import QCloseEvent
|
||||
from PyQt5.QtWidgets import QDialog, QWidget
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class GuiNovelInfo(QDialog):
|
||||
|
||||
def __init__(self, parent: QWidget) -> None:
|
||||
super().__init__(parent=parent)
|
||||
|
||||
logger.debug("Create: GuiNovelInfo")
|
||||
self.setObjectName("GuiNovelInfo")
|
||||
|
||||
self.setWindowTitle(self.tr("Novel Info"))
|
||||
logger.debug("Ready: GuiNovelInfo")
|
||||
|
||||
return
|
||||
|
||||
def __del__(self) -> None: # pragma: no cover
|
||||
logger.debug("Delete: GuiNovelInfo")
|
||||
return
|
||||
|
||||
##
|
||||
# Events
|
||||
##
|
||||
|
||||
def closeEvent(self, event: QCloseEvent) -> None:
|
||||
"""Capture the user closing the window and save settings."""
|
||||
self._saveSettings()
|
||||
event.accept()
|
||||
self.deleteLater()
|
||||
return
|
||||
|
||||
##
|
||||
# Internal Functions
|
||||
##
|
||||
|
||||
def _saveSettings(self) -> None:
|
||||
"""Save the user GUI settings."""
|
||||
logger.debug("Saving State: GuiNovelInfo")
|
||||
return
|
||||
|
||||
# END Class GuiNovelInfo
|
||||
@@ -25,7 +25,6 @@ from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
from pathlib import Path
|
||||
from datetime import datetime
|
||||
|
||||
@@ -48,9 +47,6 @@ from novelwriter.constants import nwUnicode
|
||||
from novelwriter.core.coretools import ProjectBuilder
|
||||
from novelwriter.extensions.switch import NSwitch
|
||||
|
||||
if TYPE_CHECKING: # pragma: no cover
|
||||
from novelwriter.guimain import GuiMain
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -58,8 +54,8 @@ class GuiWelcome(QDialog):
|
||||
|
||||
openProjectRequest = pyqtSignal(Path)
|
||||
|
||||
def __init__(self, mainGui: GuiMain) -> None:
|
||||
super().__init__(parent=mainGui)
|
||||
def __init__(self, parent: QWidget) -> None:
|
||||
super().__init__(parent=parent)
|
||||
|
||||
logger.debug("Create: GuiWelcome")
|
||||
self.setObjectName("GuiWelcome")
|
||||
|
||||
Reference in New Issue
Block a user