Document editor and document viewer are now in different panes

This commit is contained in:
Veronica K. B. Olsen
2019-05-18 17:09:03 +02:00
parent c4caac748f
commit ac1f9569e6
6 changed files with 20 additions and 10 deletions
+2 -2
View File
@@ -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
+10 -3
View File
@@ -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):
+2
View File
@@ -28,6 +28,8 @@ class GuiDocViewer(QTextBrowser):
self.mainConf = nw.CONFIG
self.theParent = theParent
self.setMinimumWidth(300)
logger.debug("DocViewer initialisation complete")
return
+4 -3
View File
@@ -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)
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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