Base document title class ready.

This commit is contained in:
Veronica K. B. Olsen
2020-04-26 21:35:58 +02:00
parent 3a9de4af38
commit 0387ce67b7
5 changed files with 74 additions and 3 deletions
+2
View File
@@ -19,6 +19,7 @@ from nw.gui.dialogs.sessionlog import GuiSessionLogView
# GUI Elements
from nw.gui.elements.docdetails import GuiDocDetails
from nw.gui.elements.doceditor import GuiDocEditor
from nw.gui.elements.doctitlebar import GuiDocTitleBar
from nw.gui.elements.doctree import GuiDocTree
from nw.gui.elements.docviewer import GuiDocViewer
from nw.gui.elements.noticebar import GuiNoticeBar
@@ -45,6 +46,7 @@ __all__ = [
"GuiSessionLogView",
"GuiDocDetails",
"GuiDocEditor",
"GuiDocTitleBar",
"GuiDocTree",
"GuiDocViewer",
"GuiNoticeBar",
+2
View File
@@ -2,6 +2,7 @@
from nw.gui.elements.docdetails import GuiDocDetails
from nw.gui.elements.doceditor import GuiDocEditor
from nw.gui.elements.doctitlebar import GuiDocTitleBar
from nw.gui.elements.doctree import GuiDocTree
from nw.gui.elements.docviewer import GuiDocViewer
from nw.gui.elements.noticebar import GuiNoticeBar
@@ -12,6 +13,7 @@ from nw.gui.elements.viewdetails import GuiDocViewDetails
__all__ = [
"GuiDocDetails",
"GuiDocEditor",
"GuiDocTitleBar",
"GuiDocTree",
"GuiDocViewer",
"GuiNoticeBar",
+1 -1
View File
@@ -131,7 +131,7 @@ class GuiDocEditor(QTextEdit):
def clearEditor(self):
"""Clear the current document and reset all document related
flags and counters.
flags and counters.
"""
self.nwDocument.clearDocument()
+61
View File
@@ -0,0 +1,61 @@
# -*- coding: utf-8 -*-
"""novelWriter GUI Document Title Bar
novelWriter GUI Document Title Bar
======================================
Class holding the document title bar class
File History:
Created: 2020-04-25 [0.4.5]
This file is a part of novelWriter
Copyright 2020, 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/.
"""
import logging
import nw
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPalette, QColor
from PyQt5.QtWidgets import QLabel
logger = logging.getLogger(__name__)
class GuiDocTitleBar(QLabel):
def __init__(self, theParent):
QLabel.__init__(self, theParent)
logger.debug("Initialising DocTitleBar ...")
self.mainConf = nw.CONFIG
self.theParent = theParent
self.theTheme = theParent.theTheme
self.setText("A > B > C")
self.setContentsMargins(8,2,8,2)
self.setAutoFillBackground(True)
self.setAlignment(Qt.AlignCenter)
docPalette = self.palette()
docPalette.setColor(QPalette.Window, QColor(*self.theTheme.colBack))
docPalette.setColor(QPalette.Text, QColor(*self.theTheme.colText))
self.setPalette(docPalette)
logger.debug("DocTitleBar initialisation complete")
return
# END Class GuiDocTitleBar
+8 -2
View File
@@ -43,7 +43,7 @@ from nw.gui import (
GuiMainMenu, GuiMainStatus, GuiTheme, GuiDocTree, GuiDocEditor, GuiExport,
GuiDocViewer, GuiDocDetails, GuiSearchBar, GuiNoticeBar, GuiDocViewDetails,
GuiConfigEditor, GuiProjectEditor, GuiItemEditor, GuiProjectOutline,
GuiSessionLogView, GuiDocMerge, GuiDocSplit, GuiProjectLoad
GuiSessionLogView, GuiDocMerge, GuiDocSplit, GuiProjectLoad, GuiDocTitleBar
)
from nw.project import NWProject, NWDoc, NWItem, NWIndex, NWBackup
from nw.tools import countWords
@@ -93,6 +93,8 @@ class GuiMain(QMainWindow):
self.treeView = GuiDocTree(self, self.theProject)
self.projView = GuiProjectOutline(self, self.theProject)
self.mainMenu = GuiMainMenu(self, self.theProject)
self.viewTitle = GuiDocTitleBar(self)
self.editTitle = GuiDocTitleBar(self)
# Minor Gui Elements
self.statusIcons = []
@@ -109,17 +111,21 @@ class GuiMain(QMainWindow):
self.editPane = QFrame()
self.docEdit = QVBoxLayout()
self.docEdit.setContentsMargins(0,0,0,0)
self.docEdit.setSpacing(0)
self.docEdit.addWidget(self.searchBar)
self.docEdit.addWidget(self.noticeBar)
self.docEdit.addWidget(self.editTitle)
self.docEdit.addWidget(self.docEditor)
self.editPane.setLayout(self.docEdit)
self.viewPane = QFrame()
self.docView = QVBoxLayout()
self.docView.setContentsMargins(0,0,0,0)
self.docView.setSpacing(0)
self.docView.addWidget(self.viewTitle)
self.docView.addWidget(self.docViewer)
self.docView.addWidget(self.viewMeta)
self.docView.setStretch(0, 1)
self.docView.setStretch(1, 1)
self.viewPane.setLayout(self.docView)
self.splitView = QSplitter(Qt.Horizontal)