Merge branch 'master' into docbar_icons

This commit is contained in:
Veronica K. B. Olsen
2020-06-07 23:39:12 +02:00
5 changed files with 15 additions and 86 deletions
+1 -2
View File
@@ -2,7 +2,7 @@
from nw.gui.about import GuiAbout
from nw.gui.build import GuiBuildNovel
from nw.gui.docbars import GuiDocTitleBar, GuiNoticeBar, GuiSearchBar
from nw.gui.docbars import GuiDocTitleBar, GuiSearchBar
from nw.gui.docdetails import GuiDocViewDetails
from nw.gui.doceditor import GuiDocEditor
from nw.gui.docmerge import GuiDocMerge
@@ -25,7 +25,6 @@ __all__ = [
"GuiAbout",
"GuiBuildNovel",
"GuiDocTitleBar",
"GuiNoticeBar",
"GuiSearchBar",
"GuiDocViewDetails",
"GuiDocEditor",
-54
View File
@@ -7,7 +7,6 @@
File History:
Created: 2019-09-29 [0.2.1] GuiSearchBar
Created: 2019-10-31 [0.3.2] GuiNoticeBar
Created: 2020-04-25 [0.4.5] GuiDocTitleBar
This file is a part of novelWriter
@@ -169,59 +168,6 @@ class GuiSearchBar(QWidget):
# END Class GuiSearchBar
class GuiNoticeBar(QFrame):
def __init__(self, theParent):
QFrame.__init__(self, theParent)
logger.debug("Initialising GuiNoticeBar ...")
self.mainConf = nw.CONFIG
self.theParent = theParent
self.theTheme = theParent.theTheme
self.setContentsMargins(0, 0, 0, 0)
self.setFrameShape(QFrame.Box)
m8 = self.mainConf.pxInt(8)
m2 = self.mainConf.pxInt(2)
self.mainBox = QHBoxLayout(self)
self.mainBox.setContentsMargins(m8, m2, m2, m2)
self.noteLabel = QLabel("")
self.closeButton = QPushButton(self.theTheme.getIcon("close"),"")
self.closeButton.clicked.connect(self.hideNote)
self.mainBox.addWidget(self.noteLabel)
self.mainBox.addWidget(self.closeButton)
self.mainBox.setStretch(0, 1)
self.setLayout(self.mainBox)
self.hideNote()
logger.debug("GuiNoticeBar initialisation complete")
return
def showNote(self, theNote):
"""Show the note on the noticebar.
"""
self.noteLabel.setText("<b>Note:</b> %s" % theNote)
self.setVisible(True)
return
def hideNote(self):
"""Clear the noticebar and hide it.
"""
self.noteLabel.setText("")
self.setVisible(False)
return
# END Class GuiNoticeBar
class GuiDocTitleBar(QWidget):
def __init__(self, theParent, theProject):
+1 -6
View File
@@ -158,7 +158,6 @@ class GuiDocEditor(QTextEdit):
self.hasSelection = False
self.setDocumentChanged(False)
self.theParent.noticeBar.hideNote()
self.docTitle.setTitleFromHandle(self.theHandle)
return True
@@ -270,11 +269,7 @@ class GuiDocEditor(QTextEdit):
self.setDocumentChanged(False)
self.theHandle = tHandle
if self.nwDocument.docEditable:
self.setReadOnly(False)
else:
self.theParent.noticeBar.showNote("This document is read only.")
self.setReadOnly(False)
self.docTitle.setTitleFromHandle(self.theHandle)
self.updateDocMargins()
self.hLight.spellCheck = spTemp