diff --git a/nw/config.py b/nw/config.py index 5805396b..94eb21bd 100644 --- a/nw/config.py +++ b/nw/config.py @@ -48,7 +48,7 @@ class Config: self.guiTheme = "default" self.winGeometry = [1100, 650] self.treeColWidth = [120, 30, 50] - self.mainPanePos = [300, 800] + self.mainPanePos = [300, 400, 400] ## Project self.autoSaveProj = 60 @@ -138,7 +138,7 @@ class Config: ) if confParser.has_option(cnfSec,"mainpane"): self.mainPanePos = self.unpackList( - confParser.get(cnfSec,"mainpane"), 2, self.mainPanePos + confParser.get(cnfSec,"mainpane"), 3, self.mainPanePos ) ## Project diff --git a/nw/gui/doceditor.py b/nw/gui/doceditor.py index ad90fe13..9842d03c 100644 --- a/nw/gui/doceditor.py +++ b/nw/gui/doceditor.py @@ -79,7 +79,7 @@ class GuiDocEditor(QTextEdit): if self.mainConf.doJustify: self.theDoc.setDefaultTextOption(QTextOption(Qt.AlignJustify)) - self.setMinimumWidth(400) + self.setMinimumWidth(300) self.setAcceptRichText(False) self.setFontPointSize(self.mainConf.textSize) @@ -165,11 +165,18 @@ class GuiDocEditor(QTextEdit): set to True. """ if self.mainConf.textFixedW: + vBar = self.verticalScrollBar() + if vBar.isVisible(): + sW = vBar.width() + else: + sW = 0 tW = self.width() - sW = self.verticalScrollBar().width() tM = int((tW - sW - self.mainConf.textWidth)/2) mTB = self.mainConf.textMargin[0] - self.setViewportMargins(tM,mTB,0,mTB) + if tM > 0: + self.setViewportMargins(tM,mTB,0,mTB) + else: + self.setViewportMargins(0,mTB,0,mTB) return def docAction(self, theAction): diff --git a/nw/gui/docviewer.py b/nw/gui/docviewer.py index 9aa654ab..1a795b29 100644 --- a/nw/gui/docviewer.py +++ b/nw/gui/docviewer.py @@ -28,6 +28,8 @@ class GuiDocViewer(QTextBrowser): self.mainConf = nw.CONFIG self.theParent = theParent + self.setMinimumWidth(300) + logger.debug("DocViewer initialisation complete") return diff --git a/nw/gui/winmain.py b/nw/gui/winmain.py index 72aa6977..7beb5bbe 100644 --- a/nw/gui/winmain.py +++ b/nw/gui/winmain.py @@ -66,8 +66,8 @@ class GuiMain(QMainWindow): # Assemble Main Window self.stackPane = QStackedWidget() self.stackNone = self.stackPane.addWidget(QWidget()) - self.stackDoc = self.stackPane.addWidget(self.docEditor) - self.stackView = self.stackPane.addWidget(self.docViewer) + self.stackDoc = self.stackPane.addWidget(QWidget()) + self.stackView = self.stackPane.addWidget(QWidget()) self.stackPane.setCurrentIndex(self.stackNone) self.treePane = QFrame() @@ -78,7 +78,8 @@ class GuiMain(QMainWindow): self.splitMain = QSplitter(Qt.Horizontal) self.splitMain.addWidget(self.treePane) - self.splitMain.addWidget(self.stackPane) + self.splitMain.addWidget(self.docEditor) + self.splitMain.addWidget(self.docViewer) self.splitMain.setSizes(self.mainConf.mainPanePos) self.splitMain.splitterMoved.connect(self._splitMainMove) diff --git a/tests/reference/novelwriter.conf b/tests/reference/novelwriter.conf index 5b27daa9..f11f5904 100644 --- a/tests/reference/novelwriter.conf +++ b/tests/reference/novelwriter.conf @@ -4,7 +4,7 @@ timestamp = 2019-05-18 15:06:44 [Sizes] geometry = 1100, 650 treecols = 120, 30, 50 -mainpane = 300, 800 +mainpane = 300, 400, 400 [Project] autosaveproject = 60 diff --git a/tests/test_config.py b/tests/test_config.py index 528b7dcf..a46c3c41 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -70,7 +70,7 @@ def testConfigSetMainPanePos(nwTemp,nwRef): refConf = path.join(nwRef, "novelwriter.conf") assert theConf.setMainPanePos([0, 0]) assert theConf.confChanged - assert theConf.setMainPanePos([300, 800]) + assert theConf.setMainPanePos([300, 400, 400]) assert theConf.saveConfig() assert cmpFiles(tmpConf, refConf, [2]) assert not theConf.confChanged