diff --git a/nw/config.py b/nw/config.py index 94eb21bd..549d21c2 100644 --- a/nw/config.py +++ b/nw/config.py @@ -48,7 +48,8 @@ class Config: self.guiTheme = "default" self.winGeometry = [1100, 650] self.treeColWidth = [120, 30, 50] - self.mainPanePos = [300, 400, 400] + self.mainPanePos = [300, 800] + self.docPanePos = [400, 400] ## Project self.autoSaveProj = 60 @@ -138,7 +139,11 @@ class Config: ) if confParser.has_option(cnfSec,"mainpane"): self.mainPanePos = self.unpackList( - confParser.get(cnfSec,"mainpane"), 3, self.mainPanePos + confParser.get(cnfSec,"mainpane"), 2, self.mainPanePos + ) + if confParser.has_option(cnfSec,"docpane"): + self.docPanePos = self.unpackList( + confParser.get(cnfSec,"docpane"), 2, self.docPanePos ) ## Project @@ -206,6 +211,7 @@ class Config: confParser.set(cnfSec,"geometry", self.packList(self.winGeometry)) confParser.set(cnfSec,"treecols", self.packList(self.treeColWidth)) confParser.set(cnfSec,"mainpane", self.packList(self.mainPanePos)) + confParser.set(cnfSec,"docpane", self.packList(self.docPanePos)) ## Project cnfSec = "Project" @@ -298,4 +304,9 @@ class Config: self.confChanged = True return True + def setDocPanePos(self, panePos): + self.docPanePos = panePos + self.confChanged = True + return True + # End Class Config diff --git a/nw/gui/winmain.py b/nw/gui/winmain.py index 36e1ecad..084546c1 100644 --- a/nw/gui/winmain.py +++ b/nw/gui/winmain.py @@ -70,27 +70,29 @@ class GuiMain(QMainWindow): self.treeBox.addWidget(self.docDetails) self.treePane.setLayout(self.treeBox) + self.splitView = QSplitter(Qt.Horizontal) + self.splitView.addWidget(self.docEditor) + self.splitView.addWidget(self.docViewer) + self.splitMain = QSplitter(Qt.Horizontal) self.splitMain.addWidget(self.treePane) - self.splitMain.addWidget(self.docEditor) - self.splitMain.addWidget(self.docViewer) + self.splitMain.addWidget(self.splitView) self.splitMain.setSizes(self.mainConf.mainPanePos) self.splitMain.splitterMoved.connect(self._splitMainMove) self.setCentralWidget(self.splitMain) self.idxTree = self.splitMain.indexOf(self.treePane) - self.idxEditor = self.splitMain.indexOf(self.docEditor) - self.idxViewer = self.splitMain.indexOf(self.docViewer) + self.idxMain = self.splitMain.indexOf(self.splitView) + self.idxEditor = self.splitView.indexOf(self.docEditor) + self.idxViewer = self.splitView.indexOf(self.docViewer) self.splitMain.setCollapsible(self.idxTree, False) - self.splitMain.setCollapsible(self.idxEditor, False) - self.splitMain.setCollapsible(self.idxViewer, True) + self.splitMain.setCollapsible(self.idxMain, False) + self.splitView.setCollapsible(self.idxEditor, False) + self.splitView.setCollapsible(self.idxViewer, True) self.docViewer.setVisible(False) - pPos = self.mainConf.mainPanePos - tPos = [pPos[0], pPos[1]+pPos[2]] - self.splitMain.setSizes(tPos) # Build GUI Elements self.treeView.itemSelectionChanged.connect(self._treeSingleClick) @@ -260,11 +262,10 @@ class GuiMain(QMainWindow): bPos = self.splitMain.sizes() self.docViewer.setVisible(True) - if bPos[2] == 0: - bWidth = bPos[1]+bPos[2] - bPos[1] = int(bWidth/2) - bPos[2] = bWidth-bPos[1] - self.splitMain.setSizes(bPos) + vPos = [0,0] + vPos[0] = int(bPos[1]/2) + vPos[1] = bPos[1]-vPos[0] + self.splitView.setSizes(vPos) self.docEditor.changeWidth() return True @@ -346,6 +347,7 @@ class GuiMain(QMainWindow): self.mainConf.setWinSize(self.width(), self.height()) self.mainConf.setTreeColWidths(self.treeView.getColumnSizes()) self.mainConf.setMainPanePos(self.splitMain.sizes()) + self.mainConf.setDocPanePos(self.splitView.sizes()) self.mainConf.saveConfig() return diff --git a/sample/sampleNovel/nwProject.nwx b/sample/sampleNovel/nwProject.nwx index 0e68ae5c..4383468b 100644 --- a/sample/sampleNovel/nwProject.nwx +++ b/sample/sampleNovel/nwProject.nwx @@ -1,5 +1,5 @@ - + Sample Project Sample Project diff --git a/tests/reference/novelwriter.conf b/tests/reference/novelwriter.conf index f11f5904..9a7362e8 100644 --- a/tests/reference/novelwriter.conf +++ b/tests/reference/novelwriter.conf @@ -4,7 +4,8 @@ timestamp = 2019-05-18 15:06:44 [Sizes] geometry = 1100, 650 treecols = 120, 30, 50 -mainpane = 300, 400, 400 +mainpane = 300, 800 +docpane = 400, 400 [Project] autosaveproject = 60 diff --git a/tests/test_config.py b/tests/test_config.py index a46c3c41..12fc5c18 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -70,7 +70,8 @@ def testConfigSetMainPanePos(nwTemp,nwRef): refConf = path.join(nwRef, "novelwriter.conf") assert theConf.setMainPanePos([0, 0]) assert theConf.confChanged - assert theConf.setMainPanePos([300, 400, 400]) + assert theConf.setMainPanePos([300, 800]) + assert theConf.setDocPanePos([400, 400]) assert theConf.saveConfig() assert cmpFiles(tmpConf, refConf, [2]) assert not theConf.confChanged