Add a novel info dialog

This commit is contained in:
Veronica Berglyd Olsen
2024-01-18 23:34:27 +01:00
parent ae7c19f923
commit ce2ac9b1a1
4 changed files with 91 additions and 7 deletions
+71
View File
@@ -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 20182024, 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
+2 -6
View File
@@ -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")