From bcd8f94b2c6c3d2155ee015fcf3d74166cf2f256 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Mon, 31 Aug 2020 17:37:26 +0200 Subject: [PATCH 1/2] Move footer if horisontal scroll bar appears --- nw/gui/doceditor.py | 8 +++++++- nw/gui/docviewer.py | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/nw/gui/doceditor.py b/nw/gui/doceditor.py index ca860561..8ddaa6fb 100644 --- a/nw/gui/doceditor.py +++ b/nw/gui/doceditor.py @@ -339,6 +339,12 @@ class GuiDocEditor(QTextEdit): else: sW = 0 + hBar = self.horizontalScrollBar() + if hBar.isVisible(): + sH = hBar.height() + else: + sH = 0 + if self.mainConf.textFixedW or self.theParent.isFocusMode: if self.theParent.isFocusMode: tW = self.mainConf.getFocusWidth() @@ -354,7 +360,7 @@ class GuiDocEditor(QTextEdit): tW = wW - 2*tB - sW tH = self.docHeader.height() fH = self.docFooter.height() - fY = self.height() - fH - tB + fY = self.height() - fH - tB - sH self.docHeader.setGeometry(tB, tB, tW, tH) self.docFooter.setGeometry(tB, fY, tW, fH) diff --git a/nw/gui/docviewer.py b/nw/gui/docviewer.py index f06eff22..8d373a2e 100644 --- a/nw/gui/docviewer.py +++ b/nw/gui/docviewer.py @@ -255,12 +255,18 @@ class GuiDocViewer(QTextBrowser): else: sW = 0 + hBar = self.horizontalScrollBar() + if hBar.isVisible(): + sH = hBar.height() + else: + sH = 0 + cM = self.mainConf.getTextMargin() tB = self.frameWidth() tW = self.width() - 2*tB - sW tH = self.docHeader.height() fH = self.docFooter.height() - fY = self.height() - fH - tB + fY = self.height() - fH - tB - sH self.docHeader.setGeometry(tB, tB, tW, tH) self.docFooter.setGeometry(tB, fY, tW, fH) From aefb4e782cbe18bba898e5cbac095b03b6a30c3f Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Mon, 31 Aug 2020 17:41:06 +0200 Subject: [PATCH 2/2] Use more compact notation --- nw/gui/doceditor.py | 10 ++-------- nw/gui/docviewer.py | 10 ++-------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/nw/gui/doceditor.py b/nw/gui/doceditor.py index 8ddaa6fb..b0e4b5f4 100644 --- a/nw/gui/doceditor.py +++ b/nw/gui/doceditor.py @@ -334,16 +334,10 @@ class GuiDocEditor(QTextEdit): cM = self.mainConf.getTextMargin() vBar = self.verticalScrollBar() - if vBar.isVisible(): - sW = vBar.width() - else: - sW = 0 + sW = vBar.width() if vBar.isVisible() else 0 hBar = self.horizontalScrollBar() - if hBar.isVisible(): - sH = hBar.height() - else: - sH = 0 + sH = hBar.height() if hBar.isVisible() else 0 if self.mainConf.textFixedW or self.theParent.isFocusMode: if self.theParent.isFocusMode: diff --git a/nw/gui/docviewer.py b/nw/gui/docviewer.py index 8d373a2e..c3378806 100644 --- a/nw/gui/docviewer.py +++ b/nw/gui/docviewer.py @@ -250,16 +250,10 @@ class GuiDocViewer(QTextBrowser): just ensure the margins are set correctly. """ vBar = self.verticalScrollBar() - if vBar.isVisible(): - sW = vBar.width() - else: - sW = 0 + sW = vBar.width() if vBar.isVisible() else 0 hBar = self.horizontalScrollBar() - if hBar.isVisible(): - sH = hBar.height() - else: - sH = 0 + sH = hBar.height() if hBar.isVisible() else 0 cM = self.mainConf.getTextMargin() tB = self.frameWidth()