Added session log dialog window

This commit is contained in:
Veronica K. B. Olsen
2019-10-20 14:40:59 +02:00
parent 6638c5187e
commit 323013bbaf
4 changed files with 65 additions and 2 deletions
+6
View File
@@ -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()
+53
View File
@@ -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
+1 -1
View File
@@ -127,4 +127,4 @@ class GuiTimeLineView(QDialog):
self.close()
return
# END Class GuiItemEditor
# END Class GuiTimeLineView
+5 -1
View File
@@ -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.