Using two splitters instead of one to make positioning easier.
This commit is contained in:
+13
-2
@@ -48,7 +48,8 @@ class Config:
|
|||||||
self.guiTheme = "default"
|
self.guiTheme = "default"
|
||||||
self.winGeometry = [1100, 650]
|
self.winGeometry = [1100, 650]
|
||||||
self.treeColWidth = [120, 30, 50]
|
self.treeColWidth = [120, 30, 50]
|
||||||
self.mainPanePos = [300, 400, 400]
|
self.mainPanePos = [300, 800]
|
||||||
|
self.docPanePos = [400, 400]
|
||||||
|
|
||||||
## Project
|
## Project
|
||||||
self.autoSaveProj = 60
|
self.autoSaveProj = 60
|
||||||
@@ -138,7 +139,11 @@ class Config:
|
|||||||
)
|
)
|
||||||
if confParser.has_option(cnfSec,"mainpane"):
|
if confParser.has_option(cnfSec,"mainpane"):
|
||||||
self.mainPanePos = self.unpackList(
|
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
|
## Project
|
||||||
@@ -206,6 +211,7 @@ class Config:
|
|||||||
confParser.set(cnfSec,"geometry", self.packList(self.winGeometry))
|
confParser.set(cnfSec,"geometry", self.packList(self.winGeometry))
|
||||||
confParser.set(cnfSec,"treecols", self.packList(self.treeColWidth))
|
confParser.set(cnfSec,"treecols", self.packList(self.treeColWidth))
|
||||||
confParser.set(cnfSec,"mainpane", self.packList(self.mainPanePos))
|
confParser.set(cnfSec,"mainpane", self.packList(self.mainPanePos))
|
||||||
|
confParser.set(cnfSec,"docpane", self.packList(self.docPanePos))
|
||||||
|
|
||||||
## Project
|
## Project
|
||||||
cnfSec = "Project"
|
cnfSec = "Project"
|
||||||
@@ -298,4 +304,9 @@ class Config:
|
|||||||
self.confChanged = True
|
self.confChanged = True
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def setDocPanePos(self, panePos):
|
||||||
|
self.docPanePos = panePos
|
||||||
|
self.confChanged = True
|
||||||
|
return True
|
||||||
|
|
||||||
# End Class Config
|
# End Class Config
|
||||||
|
|||||||
+16
-14
@@ -70,27 +70,29 @@ class GuiMain(QMainWindow):
|
|||||||
self.treeBox.addWidget(self.docDetails)
|
self.treeBox.addWidget(self.docDetails)
|
||||||
self.treePane.setLayout(self.treeBox)
|
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 = QSplitter(Qt.Horizontal)
|
||||||
self.splitMain.addWidget(self.treePane)
|
self.splitMain.addWidget(self.treePane)
|
||||||
self.splitMain.addWidget(self.docEditor)
|
self.splitMain.addWidget(self.splitView)
|
||||||
self.splitMain.addWidget(self.docViewer)
|
|
||||||
self.splitMain.setSizes(self.mainConf.mainPanePos)
|
self.splitMain.setSizes(self.mainConf.mainPanePos)
|
||||||
self.splitMain.splitterMoved.connect(self._splitMainMove)
|
self.splitMain.splitterMoved.connect(self._splitMainMove)
|
||||||
|
|
||||||
self.setCentralWidget(self.splitMain)
|
self.setCentralWidget(self.splitMain)
|
||||||
|
|
||||||
self.idxTree = self.splitMain.indexOf(self.treePane)
|
self.idxTree = self.splitMain.indexOf(self.treePane)
|
||||||
self.idxEditor = self.splitMain.indexOf(self.docEditor)
|
self.idxMain = self.splitMain.indexOf(self.splitView)
|
||||||
self.idxViewer = self.splitMain.indexOf(self.docViewer)
|
self.idxEditor = self.splitView.indexOf(self.docEditor)
|
||||||
|
self.idxViewer = self.splitView.indexOf(self.docViewer)
|
||||||
|
|
||||||
self.splitMain.setCollapsible(self.idxTree, False)
|
self.splitMain.setCollapsible(self.idxTree, False)
|
||||||
self.splitMain.setCollapsible(self.idxEditor, False)
|
self.splitMain.setCollapsible(self.idxMain, False)
|
||||||
self.splitMain.setCollapsible(self.idxViewer, True)
|
self.splitView.setCollapsible(self.idxEditor, False)
|
||||||
|
self.splitView.setCollapsible(self.idxViewer, True)
|
||||||
|
|
||||||
self.docViewer.setVisible(False)
|
self.docViewer.setVisible(False)
|
||||||
pPos = self.mainConf.mainPanePos
|
|
||||||
tPos = [pPos[0], pPos[1]+pPos[2]]
|
|
||||||
self.splitMain.setSizes(tPos)
|
|
||||||
|
|
||||||
# Build GUI Elements
|
# Build GUI Elements
|
||||||
self.treeView.itemSelectionChanged.connect(self._treeSingleClick)
|
self.treeView.itemSelectionChanged.connect(self._treeSingleClick)
|
||||||
@@ -260,11 +262,10 @@ class GuiMain(QMainWindow):
|
|||||||
|
|
||||||
bPos = self.splitMain.sizes()
|
bPos = self.splitMain.sizes()
|
||||||
self.docViewer.setVisible(True)
|
self.docViewer.setVisible(True)
|
||||||
if bPos[2] == 0:
|
vPos = [0,0]
|
||||||
bWidth = bPos[1]+bPos[2]
|
vPos[0] = int(bPos[1]/2)
|
||||||
bPos[1] = int(bWidth/2)
|
vPos[1] = bPos[1]-vPos[0]
|
||||||
bPos[2] = bWidth-bPos[1]
|
self.splitView.setSizes(vPos)
|
||||||
self.splitMain.setSizes(bPos)
|
|
||||||
self.docEditor.changeWidth()
|
self.docEditor.changeWidth()
|
||||||
|
|
||||||
return True
|
return True
|
||||||
@@ -346,6 +347,7 @@ class GuiMain(QMainWindow):
|
|||||||
self.mainConf.setWinSize(self.width(), self.height())
|
self.mainConf.setWinSize(self.width(), self.height())
|
||||||
self.mainConf.setTreeColWidths(self.treeView.getColumnSizes())
|
self.mainConf.setTreeColWidths(self.treeView.getColumnSizes())
|
||||||
self.mainConf.setMainPanePos(self.splitMain.sizes())
|
self.mainConf.setMainPanePos(self.splitMain.sizes())
|
||||||
|
self.mainConf.setDocPanePos(self.splitView.sizes())
|
||||||
self.mainConf.saveConfig()
|
self.mainConf.saveConfig()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<novelWriterXML appVersion="0.1.3" fileVersion="1.0" timeStamp="2019-05-18 18:12:49">
|
<novelWriterXML appVersion="0.1.3" fileVersion="1.0" timeStamp="2019-05-18 19:29:51">
|
||||||
<project>
|
<project>
|
||||||
<name>Sample Project</name>
|
<name>Sample Project</name>
|
||||||
<title>Sample Project</title>
|
<title>Sample Project</title>
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ timestamp = 2019-05-18 15:06:44
|
|||||||
[Sizes]
|
[Sizes]
|
||||||
geometry = 1100, 650
|
geometry = 1100, 650
|
||||||
treecols = 120, 30, 50
|
treecols = 120, 30, 50
|
||||||
mainpane = 300, 400, 400
|
mainpane = 300, 800
|
||||||
|
docpane = 400, 400
|
||||||
|
|
||||||
[Project]
|
[Project]
|
||||||
autosaveproject = 60
|
autosaveproject = 60
|
||||||
|
|||||||
@@ -70,7 +70,8 @@ def testConfigSetMainPanePos(nwTemp,nwRef):
|
|||||||
refConf = path.join(nwRef, "novelwriter.conf")
|
refConf = path.join(nwRef, "novelwriter.conf")
|
||||||
assert theConf.setMainPanePos([0, 0])
|
assert theConf.setMainPanePos([0, 0])
|
||||||
assert theConf.confChanged
|
assert theConf.confChanged
|
||||||
assert theConf.setMainPanePos([300, 400, 400])
|
assert theConf.setMainPanePos([300, 800])
|
||||||
|
assert theConf.setDocPanePos([400, 400])
|
||||||
assert theConf.saveConfig()
|
assert theConf.saveConfig()
|
||||||
assert cmpFiles(tmpConf, refConf, [2])
|
assert cmpFiles(tmpConf, refConf, [2])
|
||||||
assert not theConf.confChanged
|
assert not theConf.confChanged
|
||||||
|
|||||||
Reference in New Issue
Block a user