Some cleanup in the doc view header

This commit is contained in:
Veronica K. B. Olsen
2020-06-11 17:57:58 +02:00
parent c3e6007f76
commit 9671db0b42
2 changed files with 11 additions and 16 deletions
-3
View File
@@ -133,9 +133,6 @@ class GuiDocEditor(QTextEdit):
logger.debug("GuiDocEditor initialisation complete") logger.debug("GuiDocEditor initialisation complete")
# Connect Functions
self.setSelectedHandle = self.theParent.treeView.setSelectedHandle
return return
def clearEditor(self): def clearEditor(self):
+11 -13
View File
@@ -78,9 +78,6 @@ class GuiDocViewer(QTextBrowser):
logger.debug("GuiDocViewer initialisation complete") logger.debug("GuiDocViewer initialisation complete")
# Connect Functions
self.setSelectedHandle = self.theParent.treeView.setSelectedHandle
return return
def clearViewer(self): def clearViewer(self):
@@ -401,15 +398,16 @@ class GuiDocViewer(QTextBrowser):
class GuiDocViewHeader(QWidget): class GuiDocViewHeader(QWidget):
def __init__(self, theParent): def __init__(self, docViewer):
QWidget.__init__(self, theParent) QWidget.__init__(self, docViewer)
logger.debug("Initialising GuiDocViewHeader ...") logger.debug("Initialising GuiDocViewHeader ...")
self.mainConf = nw.CONFIG self.mainConf = nw.CONFIG
self.theParent = theParent self.docViewer = docViewer
self.theProject = theParent.theProject self.theParent = docViewer.theParent
self.theTheme = theParent.theTheme self.theProject = docViewer.theProject
self.theTheme = docViewer.theTheme
self.theHandle = None self.theHandle = None
# Make a QPalette that matches the Syntax Theme # Make a QPalette that matches the Syntax Theme
@@ -487,12 +485,12 @@ class GuiDocViewHeader(QWidget):
"""Sets the document title from the handle, or alternatively, """Sets the document title from the handle, or alternatively,
set the whole document path. set the whole document path.
""" """
self.theTitle.setText("")
self.theHandle = tHandle self.theHandle = tHandle
if tHandle is None: if tHandle is None:
self.theTitle.setText("")
self.closeButton.setVisible(False) self.closeButton.setVisible(False)
self.refreshButton.setVisible(False) self.refreshButton.setVisible(False)
return False return True
if self.mainConf.showFullPath: if self.mainConf.showFullPath:
tTitle = [] tTitle = []
@@ -521,13 +519,13 @@ class GuiDocViewHeader(QWidget):
def _closeDocument(self): def _closeDocument(self):
"""Trigger the close editor/viewer on the main window. """Trigger the close editor/viewer on the main window.
""" """
self.theParent.theParent.closeDocViewer() self.theParent.closeDocViewer()
return return
def _refreshDocument(self): def _refreshDocument(self):
"""Reload the content of the document. """Reload the content of the document.
""" """
self.theParent.reloadText() self.docViewer.reloadText()
return return
## ##
@@ -538,7 +536,7 @@ class GuiDocViewHeader(QWidget):
"""Capture a click on the title and ensure that the item is """Capture a click on the title and ensure that the item is
selected in the project tree. selected in the project tree.
""" """
self.theParent.setSelectedHandle(self.theHandle) self.theParent.treeView.setSelectedHandle(self.theHandle)
return return
# END Class GuiDocViewHeader # END Class GuiDocViewHeader