From 8abfb5f9839d2dd9b8f53b7c8d4f4fbbf602fbbc Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sun, 7 Jun 2020 23:37:59 +0200 Subject: [PATCH 1/3] Convert the doc title bar to a widget with a layout --- nw/gui/docbars.py | 55 ++++++++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/nw/gui/docbars.py b/nw/gui/docbars.py index 3e65855d..384bec0c 100644 --- a/nw/gui/docbars.py +++ b/nw/gui/docbars.py @@ -33,7 +33,7 @@ import nw from PyQt5.QtCore import Qt from PyQt5.QtGui import QPalette, QColor from PyQt5.QtWidgets import ( - qApp, QFrame, QGridLayout, QLabel, QLineEdit, QPushButton, + qApp, QWidget, QFrame, QGridLayout, QLabel, QLineEdit, QPushButton, QHBoxLayout ) @@ -41,10 +41,10 @@ from nw.constants import nwDocAction, nwUnicode logger = logging.getLogger(__name__) -class GuiSearchBar(QFrame): +class GuiSearchBar(QWidget): def __init__(self, theParent): - QFrame.__init__(self, theParent) + QWidget.__init__(self, theParent) logger.debug("Initialising GuiSearchBar ...") @@ -222,10 +222,10 @@ class GuiNoticeBar(QFrame): # END Class GuiNoticeBar -class GuiDocTitleBar(QLabel): +class GuiDocTitleBar(QWidget): def __init__(self, theParent, theProject): - QLabel.__init__(self, theParent) + QWidget.__init__(self, theParent) logger.debug("Initialising GuiDocTitleBar ...") @@ -235,24 +235,36 @@ class GuiDocTitleBar(QLabel): self.theTheme = theParent.theTheme self.theHandle = None - self.setText("") - self.setIndent(0) - self.setMargin(0) + # Make a QPalette that matches the Syntax Theme + self.thePalette = QPalette() + self.thePalette.setColor(QPalette.Window, QColor(*self.theTheme.colBack)) + self.thePalette.setColor(QPalette.Text, QColor(*self.theTheme.colText)) + + # Main Widget Settings self.setContentsMargins(0, 0, 0, 0) self.setAutoFillBackground(True) - self.setAlignment(Qt.AlignCenter) - self.setWordWrap(True) - self.setFrameShape(QFrame.NoFrame) - self.setLineWidth(0) + self.setPalette(self.thePalette) - lblPalette = self.palette() - lblPalette.setColor(QPalette.Window, QColor(*self.theTheme.colBack)) - lblPalette.setColor(QPalette.Text, QColor(*self.theTheme.colText)) - self.setPalette(lblPalette) + self.theTitle = QLabel() + self.theTitle.setText("") + self.theTitle.setIndent(0) + self.theTitle.setMargin(0) + self.theTitle.setContentsMargins(10, 0, 0, 0) + self.theTitle.setAutoFillBackground(True) + self.theTitle.setAlignment(Qt.AlignCenter) + self.theTitle.setWordWrap(True) + self.theTitle.setFrameShape(QFrame.NoFrame) + self.theTitle.setLineWidth(0) + self.theTitle.setPalette(self.thePalette) - lblFont = self.font() + lblFont = self.theTitle.font() lblFont.setPointSizeF(0.9*self.theTheme.fontPointSize) - self.setFont(lblFont) + self.theTitle.setFont(lblFont) + + # Assemble Layout + self.outerBox = QHBoxLayout() + self.outerBox.addWidget(self.theTitle) + self.setLayout(self.outerBox) logger.debug("GuiDocTitleBar initialisation complete") @@ -266,7 +278,7 @@ class GuiDocTitleBar(QLabel): """Sets the document title from the handle, or alternatively, set the whole document path. """ - self.setText("") + self.theTitle.setText("") self.theHandle = tHandle if tHandle is None: return False @@ -279,13 +291,12 @@ class GuiDocTitleBar(QLabel): if nwItem is not None: tTitle.append(nwItem.itemName) sSep = " %s " % nwUnicode.U_RSAQUO - self.setText(sSep.join(tTitle)) + self.theTitle.setText(sSep.join(tTitle)) else: nwItem = self.theProject.projTree[tHandle] if nwItem is None: return False - - self.setText(nwItem.itemName) + self.theTitle.setText(nwItem.itemName) return True From 2c337e593838ab43f7002f2d5d9f7efc1cdaca52 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Mon, 8 Jun 2020 00:24:23 +0200 Subject: [PATCH 2/3] Added the document tile buttons and icons --- nw/assets/icons/fallback/maximise-dark.svg | 56 +++++++++++++++++++ nw/assets/icons/fallback/maximise.svg | 56 +++++++++++++++++++ nw/assets/icons/fallback/minimise-dark.svg | 55 ++++++++++++++++++ nw/assets/icons/fallback/minimise.svg | 55 ++++++++++++++++++ nw/assets/icons/fallback/refresh-dark.svg | 56 +++++++++++++++++++ nw/assets/icons/fallback/refresh.svg | 56 +++++++++++++++++++ .../typicons_colour_dark/arrow-maximise.svg | 55 ++++++++++++++++++ .../typicons_colour_dark/arrow-minimise.svg | 55 ++++++++++++++++++ .../icons/typicons_colour_dark/icons.conf | 3 + .../icons/typicons_colour_dark/refresh.svg | 55 ++++++++++++++++++ .../typicons_colour_light/arrow-maximise.svg | 56 +++++++++++++++++++ .../typicons_colour_light/arrow-minimise.svg | 55 ++++++++++++++++++ .../icons/typicons_colour_light/icons.conf | 3 + .../icons/typicons_colour_light/refresh.svg | 56 +++++++++++++++++++ .../typicons_grey_dark/arrow-maximise.svg | 56 +++++++++++++++++++ .../typicons_grey_dark/arrow-minimise.svg | 55 ++++++++++++++++++ nw/assets/icons/typicons_grey_dark/icons.conf | 3 + .../icons/typicons_grey_dark/refresh.svg | 56 +++++++++++++++++++ .../typicons_grey_light/arrow-maximise.svg | 56 +++++++++++++++++++ .../typicons_grey_light/arrow-minimise.svg | 55 ++++++++++++++++++ .../icons/typicons_grey_light/icons.conf | 3 + .../icons/typicons_grey_light/refresh.svg | 56 +++++++++++++++++++ nw/gui/docbars.py | 55 +++++++++++++++++- nw/gui/doceditor.py | 2 +- nw/gui/docviewer.py | 2 +- nw/gui/theme.py | 3 + 26 files changed, 1069 insertions(+), 5 deletions(-) create mode 100644 nw/assets/icons/fallback/maximise-dark.svg create mode 100644 nw/assets/icons/fallback/maximise.svg create mode 100644 nw/assets/icons/fallback/minimise-dark.svg create mode 100644 nw/assets/icons/fallback/minimise.svg create mode 100644 nw/assets/icons/fallback/refresh-dark.svg create mode 100644 nw/assets/icons/fallback/refresh.svg create mode 100644 nw/assets/icons/typicons_colour_dark/arrow-maximise.svg create mode 100644 nw/assets/icons/typicons_colour_dark/arrow-minimise.svg create mode 100644 nw/assets/icons/typicons_colour_dark/refresh.svg create mode 100644 nw/assets/icons/typicons_colour_light/arrow-maximise.svg create mode 100644 nw/assets/icons/typicons_colour_light/arrow-minimise.svg create mode 100644 nw/assets/icons/typicons_colour_light/refresh.svg create mode 100644 nw/assets/icons/typicons_grey_dark/arrow-maximise.svg create mode 100644 nw/assets/icons/typicons_grey_dark/arrow-minimise.svg create mode 100644 nw/assets/icons/typicons_grey_dark/refresh.svg create mode 100644 nw/assets/icons/typicons_grey_light/arrow-maximise.svg create mode 100644 nw/assets/icons/typicons_grey_light/arrow-minimise.svg create mode 100644 nw/assets/icons/typicons_grey_light/refresh.svg diff --git a/nw/assets/icons/fallback/maximise-dark.svg b/nw/assets/icons/fallback/maximise-dark.svg new file mode 100644 index 00000000..1ce767a3 --- /dev/null +++ b/nw/assets/icons/fallback/maximise-dark.svg @@ -0,0 +1,56 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/nw/assets/icons/fallback/maximise.svg b/nw/assets/icons/fallback/maximise.svg new file mode 100644 index 00000000..0e1d4a86 --- /dev/null +++ b/nw/assets/icons/fallback/maximise.svg @@ -0,0 +1,56 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/nw/assets/icons/fallback/minimise-dark.svg b/nw/assets/icons/fallback/minimise-dark.svg new file mode 100644 index 00000000..4bc48ce2 --- /dev/null +++ b/nw/assets/icons/fallback/minimise-dark.svg @@ -0,0 +1,55 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/nw/assets/icons/fallback/minimise.svg b/nw/assets/icons/fallback/minimise.svg new file mode 100644 index 00000000..b0a1972f --- /dev/null +++ b/nw/assets/icons/fallback/minimise.svg @@ -0,0 +1,55 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/nw/assets/icons/fallback/refresh-dark.svg b/nw/assets/icons/fallback/refresh-dark.svg new file mode 100644 index 00000000..31367a18 --- /dev/null +++ b/nw/assets/icons/fallback/refresh-dark.svg @@ -0,0 +1,56 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/nw/assets/icons/fallback/refresh.svg b/nw/assets/icons/fallback/refresh.svg new file mode 100644 index 00000000..c87d3257 --- /dev/null +++ b/nw/assets/icons/fallback/refresh.svg @@ -0,0 +1,56 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/nw/assets/icons/typicons_colour_dark/arrow-maximise.svg b/nw/assets/icons/typicons_colour_dark/arrow-maximise.svg new file mode 100644 index 00000000..a5ee7fa0 --- /dev/null +++ b/nw/assets/icons/typicons_colour_dark/arrow-maximise.svg @@ -0,0 +1,55 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/nw/assets/icons/typicons_colour_dark/arrow-minimise.svg b/nw/assets/icons/typicons_colour_dark/arrow-minimise.svg new file mode 100644 index 00000000..83d5a066 --- /dev/null +++ b/nw/assets/icons/typicons_colour_dark/arrow-minimise.svg @@ -0,0 +1,55 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/nw/assets/icons/typicons_colour_dark/icons.conf b/nw/assets/icons/typicons_colour_dark/icons.conf index b0e75498..cffe7329 100644 --- a/nw/assets/icons/typicons_colour_dark/icons.conf +++ b/nw/assets/icons/typicons_colour_dark/icons.conf @@ -32,6 +32,9 @@ delete = delete.svg add = plus.svg remove = minus.svg close = times.svg +refresh = refresh.svg +maximise = arrow-maximise.svg +minimise = arrow-minimise.svg done = input-checked.svg search = search.svg search-replace = search-replace.svg diff --git a/nw/assets/icons/typicons_colour_dark/refresh.svg b/nw/assets/icons/typicons_colour_dark/refresh.svg new file mode 100644 index 00000000..f1853eb3 --- /dev/null +++ b/nw/assets/icons/typicons_colour_dark/refresh.svg @@ -0,0 +1,55 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/nw/assets/icons/typicons_colour_light/arrow-maximise.svg b/nw/assets/icons/typicons_colour_light/arrow-maximise.svg new file mode 100644 index 00000000..3ef012fe --- /dev/null +++ b/nw/assets/icons/typicons_colour_light/arrow-maximise.svg @@ -0,0 +1,56 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/nw/assets/icons/typicons_colour_light/arrow-minimise.svg b/nw/assets/icons/typicons_colour_light/arrow-minimise.svg new file mode 100644 index 00000000..0d9f7d13 --- /dev/null +++ b/nw/assets/icons/typicons_colour_light/arrow-minimise.svg @@ -0,0 +1,55 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/nw/assets/icons/typicons_colour_light/icons.conf b/nw/assets/icons/typicons_colour_light/icons.conf index 70477f64..ac281962 100644 --- a/nw/assets/icons/typicons_colour_light/icons.conf +++ b/nw/assets/icons/typicons_colour_light/icons.conf @@ -32,6 +32,9 @@ delete = delete.svg add = plus.svg remove = minus.svg close = times.svg +refresh = refresh.svg +maximise = arrow-maximise.svg +minimise = arrow-minimise.svg done = input-checked.svg search = search.svg search-replace = search-replace.svg diff --git a/nw/assets/icons/typicons_colour_light/refresh.svg b/nw/assets/icons/typicons_colour_light/refresh.svg new file mode 100644 index 00000000..d1d9513b --- /dev/null +++ b/nw/assets/icons/typicons_colour_light/refresh.svg @@ -0,0 +1,56 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/nw/assets/icons/typicons_grey_dark/arrow-maximise.svg b/nw/assets/icons/typicons_grey_dark/arrow-maximise.svg new file mode 100644 index 00000000..1ce767a3 --- /dev/null +++ b/nw/assets/icons/typicons_grey_dark/arrow-maximise.svg @@ -0,0 +1,56 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/nw/assets/icons/typicons_grey_dark/arrow-minimise.svg b/nw/assets/icons/typicons_grey_dark/arrow-minimise.svg new file mode 100644 index 00000000..4bc48ce2 --- /dev/null +++ b/nw/assets/icons/typicons_grey_dark/arrow-minimise.svg @@ -0,0 +1,55 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/nw/assets/icons/typicons_grey_dark/icons.conf b/nw/assets/icons/typicons_grey_dark/icons.conf index d06201b1..d03bec4d 100644 --- a/nw/assets/icons/typicons_grey_dark/icons.conf +++ b/nw/assets/icons/typicons_grey_dark/icons.conf @@ -32,6 +32,9 @@ delete = delete.svg add = plus.svg remove = minus.svg close = times.svg +refresh = refresh.svg +maximise = arrow-maximise.svg +minimise = arrow-minimise.svg done = input-checked.svg search = search.svg search-replace = search-replace.svg diff --git a/nw/assets/icons/typicons_grey_dark/refresh.svg b/nw/assets/icons/typicons_grey_dark/refresh.svg new file mode 100644 index 00000000..31367a18 --- /dev/null +++ b/nw/assets/icons/typicons_grey_dark/refresh.svg @@ -0,0 +1,56 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/nw/assets/icons/typicons_grey_light/arrow-maximise.svg b/nw/assets/icons/typicons_grey_light/arrow-maximise.svg new file mode 100644 index 00000000..0e1d4a86 --- /dev/null +++ b/nw/assets/icons/typicons_grey_light/arrow-maximise.svg @@ -0,0 +1,56 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/nw/assets/icons/typicons_grey_light/arrow-minimise.svg b/nw/assets/icons/typicons_grey_light/arrow-minimise.svg new file mode 100644 index 00000000..b0a1972f --- /dev/null +++ b/nw/assets/icons/typicons_grey_light/arrow-minimise.svg @@ -0,0 +1,55 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/nw/assets/icons/typicons_grey_light/icons.conf b/nw/assets/icons/typicons_grey_light/icons.conf index dd97c4c8..9f04ee61 100644 --- a/nw/assets/icons/typicons_grey_light/icons.conf +++ b/nw/assets/icons/typicons_grey_light/icons.conf @@ -32,6 +32,9 @@ delete = delete.svg add = plus.svg remove = minus.svg close = times.svg +refresh = refresh.svg +maximise = arrow-maximise.svg +minimise = arrow-minimise.svg done = input-checked.svg search = search.svg search-replace = search-replace.svg diff --git a/nw/assets/icons/typicons_grey_light/refresh.svg b/nw/assets/icons/typicons_grey_light/refresh.svg new file mode 100644 index 00000000..c87d3257 --- /dev/null +++ b/nw/assets/icons/typicons_grey_light/refresh.svg @@ -0,0 +1,56 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/nw/gui/docbars.py b/nw/gui/docbars.py index 546de674..1c8ad270 100644 --- a/nw/gui/docbars.py +++ b/nw/gui/docbars.py @@ -29,7 +29,7 @@ import logging import nw -from PyQt5.QtCore import Qt +from PyQt5.QtCore import Qt, QSize from PyQt5.QtGui import QPalette, QColor from PyQt5.QtWidgets import ( qApp, QWidget, QFrame, QGridLayout, QLabel, QLineEdit, QPushButton, @@ -170,7 +170,7 @@ class GuiSearchBar(QWidget): class GuiDocTitleBar(QWidget): - def __init__(self, theParent, theProject): + def __init__(self, theParent, theProject, isEditor): QWidget.__init__(self, theParent) logger.debug("Initialising GuiDocTitleBar ...") @@ -180,6 +180,7 @@ class GuiDocTitleBar(QWidget): self.theProject = theProject self.theTheme = theParent.theTheme self.theHandle = None + self.isEditor = isEditor # Make a QPalette that matches the Syntax Theme self.thePalette = QPalette() @@ -191,6 +192,7 @@ class GuiDocTitleBar(QWidget): self.setAutoFillBackground(True) self.setPalette(self.thePalette) + # Title Label self.theTitle = QLabel() self.theTitle.setText("") self.theTitle.setIndent(0) @@ -207,9 +209,45 @@ class GuiDocTitleBar(QWidget): lblFont.setPointSizeF(0.9*self.theTheme.fontPointSize) self.theTitle.setFont(lblFont) + # Buttons + iPx = self.theTheme.textIconSize + + self.closeButton = QPushButton("") + self.closeButton.setIcon(self.theTheme.getIcon("close")) + self.closeButton.setContentsMargins(0, 0, 0, 0) + self.closeButton.setIconSize(QSize(iPx, iPx)) + self.closeButton.setFixedSize(iPx, iPx) + self.closeButton.setFlat(True) + self.closeButton.setVisible(False) + + if self.isEditor: + self.minmaxButton = QPushButton("") + self.minmaxButton.setIcon(self.theTheme.getIcon("maximise")) + self.minmaxButton.setContentsMargins(0, 0, 0, 0) + self.minmaxButton.setIconSize(QSize(iPx, iPx)) + self.minmaxButton.setFixedSize(iPx, iPx) + self.minmaxButton.setFlat(True) + self.minmaxButton.setVisible(False) + else: + self.refreshButton = QPushButton("") + self.refreshButton.setIcon(self.theTheme.getIcon("refresh")) + self.refreshButton.setContentsMargins(0, 0, 0, 0) + self.refreshButton.setIconSize(QSize(iPx, iPx)) + self.refreshButton.setFixedSize(iPx, iPx) + self.refreshButton.setFlat(True) + self.refreshButton.setVisible(False) + # Assemble Layout + hSp = self.mainConf.pxInt(6) self.outerBox = QHBoxLayout() - self.outerBox.addWidget(self.theTitle) + self.outerBox.setSpacing(hSp) + self.outerBox.addSpacing(2*(iPx + hSp)) + self.outerBox.addWidget(self.theTitle, 1) + if self.isEditor: + self.outerBox.addWidget(self.minmaxButton, 0) + else: + self.outerBox.addWidget(self.refreshButton, 0) + self.outerBox.addWidget(self.closeButton, 0) self.setLayout(self.outerBox) logger.debug("GuiDocTitleBar initialisation complete") @@ -227,6 +265,11 @@ class GuiDocTitleBar(QWidget): self.theTitle.setText("") self.theHandle = tHandle if tHandle is None: + self.closeButton.setVisible(False) + if self.isEditor: + self.minmaxButton.setVisible(False) + else: + self.refreshButton.setVisible(False) return False if self.mainConf.showFullPath: @@ -244,6 +287,12 @@ class GuiDocTitleBar(QWidget): return False self.theTitle.setText(nwItem.itemName) + self.closeButton.setVisible(True) + if self.isEditor: + self.minmaxButton.setVisible(True) + else: + self.refreshButton.setVisible(True) + return True ## diff --git a/nw/gui/doceditor.py b/nw/gui/doceditor.py index 97ef5c94..e523c6f7 100644 --- a/nw/gui/doceditor.py +++ b/nw/gui/doceditor.py @@ -85,7 +85,7 @@ class GuiDocEditor(QTextEdit): self.qDocument.contentsChange.connect(self._docChange) # Document Title - self.docTitle = GuiDocTitleBar(self, self.theProject) + self.docTitle = GuiDocTitleBar(self, self.theProject, isEditor=True) self.docTitle.setGeometry(0, 0, self.docTitle.width(), self.docTitle.height()) self.setViewportMargins(0, self.docTitle.height(), 0, 0) diff --git a/nw/gui/docviewer.py b/nw/gui/docviewer.py index a3d6eeda..3c4f86b9 100644 --- a/nw/gui/docviewer.py +++ b/nw/gui/docviewer.py @@ -58,7 +58,7 @@ class GuiDocViewer(QTextBrowser): self.initViewer() # Document Title - self.docTitle = GuiDocTitleBar(self, self.theProject) + self.docTitle = GuiDocTitleBar(self, self.theProject, isEditor=False) self.docTitle.setGeometry(0, 0, self.docTitle.width(), self.docTitle.height()) self.setViewportMargins(0, self.docTitle.height(), 0, 0) diff --git a/nw/gui/theme.py b/nw/gui/theme.py index 2f5a896f..8288e1fa 100644 --- a/nw/gui/theme.py +++ b/nw/gui/theme.py @@ -525,6 +525,9 @@ class GuiIcons: "check" : (None, None), "cross" : (None, None), "hash" : (None, None), + "maximise" : (None, None), + "minimise" : (None, None), + "refresh" : (None, None), ## Other Icons "warning" : (QStyle.SP_MessageBoxWarning, "dialog-warning"), From 87ee7206a23c6057b91c2c32587e8952336b03dc Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Mon, 8 Jun 2020 00:35:03 +0200 Subject: [PATCH 3/3] The close/refresh/minmax buttons are now connected --- nw/gui/docbars.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/nw/gui/docbars.py b/nw/gui/docbars.py index 1c8ad270..e1240e2d 100644 --- a/nw/gui/docbars.py +++ b/nw/gui/docbars.py @@ -219,6 +219,7 @@ class GuiDocTitleBar(QWidget): self.closeButton.setFixedSize(iPx, iPx) self.closeButton.setFlat(True) self.closeButton.setVisible(False) + self.closeButton.clicked.connect(self._closeDocument) if self.isEditor: self.minmaxButton = QPushButton("") @@ -228,6 +229,7 @@ class GuiDocTitleBar(QWidget): self.minmaxButton.setFixedSize(iPx, iPx) self.minmaxButton.setFlat(True) self.minmaxButton.setVisible(False) + self.minmaxButton.clicked.connect(self._minmaxDocument) else: self.refreshButton = QPushButton("") self.refreshButton.setIcon(self.theTheme.getIcon("refresh")) @@ -236,6 +238,7 @@ class GuiDocTitleBar(QWidget): self.refreshButton.setFixedSize(iPx, iPx) self.refreshButton.setFlat(True) self.refreshButton.setVisible(False) + self.refreshButton.clicked.connect(self._refreshDocument) # Assemble Layout hSp = self.mainConf.pxInt(6) @@ -295,6 +298,36 @@ class GuiDocTitleBar(QWidget): return True + ## + # Slots + ## + + def _closeDocument(self): + """Trigger the close editor/viewer on the main window. + """ + if self.isEditor: + self.theParent.theParent.closeDocEditor() + else: + self.theParent.theParent.closeDocViewer() + return + + def _minmaxDocument(self): + """Switch on or off zen mode. + """ + self.theParent.theParent.toggleZenMode() + self.closeButton.setVisible(not self.theParent.theParent.isZenMode) + if self.theParent.theParent.isZenMode: + self.minmaxButton.setIcon(self.theTheme.getIcon("minimise")) + else: + self.minmaxButton.setIcon(self.theTheme.getIcon("maximise")) + return + + def _refreshDocument(self): + """Reload the content of the document. + """ + self.theParent.reloadText() + return + ## # Events ##