From 323013bbaf41c77ed27ac6111dd00001d8d5ab0e Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sun, 20 Oct 2019 14:40:59 +0200 Subject: [PATCH] Added session log dialog window --- nw/gui/mainmenu.py | 6 +++++ nw/gui/sessionlog.py | 53 ++++++++++++++++++++++++++++++++++++++++++ nw/gui/timelineview.py | 2 +- nw/gui/winmain.py | 6 ++++- 4 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 nw/gui/sessionlog.py diff --git a/nw/gui/mainmenu.py b/nw/gui/mainmenu.py index a5d77820..366ff5fa 100644 --- a/nw/gui/mainmenu.py +++ b/nw/gui/mainmenu.py @@ -199,6 +199,12 @@ class GuiMainMenu(QMenuBar): menuItem.triggered.connect(self.theParent.exportProjectDialog) self.projMenu.addAction(menuItem) + # Project > Session Log + menuItem = QAction("Session Log", self) + menuItem.setStatusTip("Show the session log") + menuItem.triggered.connect(self.theParent.showTimeLineDialog) + self.projMenu.addAction(menuItem) + # Project > Separator self.projMenu.addSeparator() diff --git a/nw/gui/sessionlog.py b/nw/gui/sessionlog.py new file mode 100644 index 00000000..c31b2f25 --- /dev/null +++ b/nw/gui/sessionlog.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +"""novelWriter GUI Session Log Viewer + + novelWriter – GUI Session Log Viewer +====================================== + Class holding the session log view window + + File History: + Created: 2019-10-20 [0.3] + +""" + +import logging +import nw + +from PyQt5.QtCore import Qt +from PyQt5.QtGui import QIcon, QColor, QPixmap +from PyQt5.QtWidgets import ( + QDialog, QVBoxLayout, QHBoxLayout, QTableWidget, QTableWidgetItem, + QDialogButtonBox, QLabel, QPushButton, QHeaderView +) + +logger = logging.getLogger(__name__) + +class GuiSessionLogView(QDialog): + + def __init__(self, theParent, theProject): + QDialog.__init__(self, theParent) + + logger.debug("Initialising SessionLogView ...") + + self.mainConf = nw.CONFIG + self.theProject = theProject + self.theParent = theParent + + self.outerBox = QVBoxLayout() + self.bottomBox = QHBoxLayout() + + self.setWindowTitle("Session Log") + + self.setLayout(self.outerBox) + + self.show() + + logger.debug("SessionLogView initialisation complete") + + return + + def _doClose(self): + self.close() + return + +# END Class GuiSessionLogView diff --git a/nw/gui/timelineview.py b/nw/gui/timelineview.py index 05a041a3..9f13c2a0 100644 --- a/nw/gui/timelineview.py +++ b/nw/gui/timelineview.py @@ -127,4 +127,4 @@ class GuiTimeLineView(QDialog): self.close() return -# END Class GuiItemEditor +# END Class GuiTimeLineView diff --git a/nw/gui/winmain.py b/nw/gui/winmain.py index 4bc40daa..0ff3aeb9 100644 --- a/nw/gui/winmain.py +++ b/nw/gui/winmain.py @@ -34,6 +34,7 @@ from nw.gui.export import GuiExport from nw.gui.itemeditor import GuiItemEditor from nw.gui.statusbar import GuiMainStatus from nw.gui.timelineview import GuiTimeLineView +from nw.gui.sessionlog import GuiSessionLogView from nw.project.project import NWProject from nw.project.document import NWDoc from nw.project.item import NWItem @@ -521,10 +522,13 @@ class GuiMain(QMainWindow): def showTimeLineDialog(self): if self.hasProject: - dlgTLine = GuiTimeLineView(self, self.theProject, self.theIndex) + dlgTLine = GuiSessionLogView(self, self.theProject) dlgTLine.exec_() return True + def showSessionLogDialog(self): + return True + def makeAlert(self, theMessage, theLevel=nwAlert.INFO): """Alert both the user and the logger at the same time. Message can be either a string or an array of strings. Severity level is 0 = info, 1 = warning, and 2 = error.