Document editor and document viewer are now in different panes
This commit is contained in:
+2
-2
@@ -48,7 +48,7 @@ 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, 800]
|
self.mainPanePos = [300, 400, 400]
|
||||||
|
|
||||||
## Project
|
## Project
|
||||||
self.autoSaveProj = 60
|
self.autoSaveProj = 60
|
||||||
@@ -138,7 +138,7 @@ 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"), 2, self.mainPanePos
|
confParser.get(cnfSec,"mainpane"), 3, self.mainPanePos
|
||||||
)
|
)
|
||||||
|
|
||||||
## Project
|
## Project
|
||||||
|
|||||||
+10
-3
@@ -79,7 +79,7 @@ class GuiDocEditor(QTextEdit):
|
|||||||
if self.mainConf.doJustify:
|
if self.mainConf.doJustify:
|
||||||
self.theDoc.setDefaultTextOption(QTextOption(Qt.AlignJustify))
|
self.theDoc.setDefaultTextOption(QTextOption(Qt.AlignJustify))
|
||||||
|
|
||||||
self.setMinimumWidth(400)
|
self.setMinimumWidth(300)
|
||||||
self.setAcceptRichText(False)
|
self.setAcceptRichText(False)
|
||||||
self.setFontPointSize(self.mainConf.textSize)
|
self.setFontPointSize(self.mainConf.textSize)
|
||||||
|
|
||||||
@@ -165,11 +165,18 @@ class GuiDocEditor(QTextEdit):
|
|||||||
set to True.
|
set to True.
|
||||||
"""
|
"""
|
||||||
if self.mainConf.textFixedW:
|
if self.mainConf.textFixedW:
|
||||||
|
vBar = self.verticalScrollBar()
|
||||||
|
if vBar.isVisible():
|
||||||
|
sW = vBar.width()
|
||||||
|
else:
|
||||||
|
sW = 0
|
||||||
tW = self.width()
|
tW = self.width()
|
||||||
sW = self.verticalScrollBar().width()
|
|
||||||
tM = int((tW - sW - self.mainConf.textWidth)/2)
|
tM = int((tW - sW - self.mainConf.textWidth)/2)
|
||||||
mTB = self.mainConf.textMargin[0]
|
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
|
return
|
||||||
|
|
||||||
def docAction(self, theAction):
|
def docAction(self, theAction):
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ class GuiDocViewer(QTextBrowser):
|
|||||||
self.mainConf = nw.CONFIG
|
self.mainConf = nw.CONFIG
|
||||||
self.theParent = theParent
|
self.theParent = theParent
|
||||||
|
|
||||||
|
self.setMinimumWidth(300)
|
||||||
|
|
||||||
logger.debug("DocViewer initialisation complete")
|
logger.debug("DocViewer initialisation complete")
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|||||||
+4
-3
@@ -66,8 +66,8 @@ class GuiMain(QMainWindow):
|
|||||||
# Assemble Main Window
|
# Assemble Main Window
|
||||||
self.stackPane = QStackedWidget()
|
self.stackPane = QStackedWidget()
|
||||||
self.stackNone = self.stackPane.addWidget(QWidget())
|
self.stackNone = self.stackPane.addWidget(QWidget())
|
||||||
self.stackDoc = self.stackPane.addWidget(self.docEditor)
|
self.stackDoc = self.stackPane.addWidget(QWidget())
|
||||||
self.stackView = self.stackPane.addWidget(self.docViewer)
|
self.stackView = self.stackPane.addWidget(QWidget())
|
||||||
self.stackPane.setCurrentIndex(self.stackNone)
|
self.stackPane.setCurrentIndex(self.stackNone)
|
||||||
|
|
||||||
self.treePane = QFrame()
|
self.treePane = QFrame()
|
||||||
@@ -78,7 +78,8 @@ class GuiMain(QMainWindow):
|
|||||||
|
|
||||||
self.splitMain = QSplitter(Qt.Horizontal)
|
self.splitMain = QSplitter(Qt.Horizontal)
|
||||||
self.splitMain.addWidget(self.treePane)
|
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.setSizes(self.mainConf.mainPanePos)
|
||||||
self.splitMain.splitterMoved.connect(self._splitMainMove)
|
self.splitMain.splitterMoved.connect(self._splitMainMove)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ 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, 800
|
mainpane = 300, 400, 400
|
||||||
|
|
||||||
[Project]
|
[Project]
|
||||||
autosaveproject = 60
|
autosaveproject = 60
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ 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, 800])
|
assert theConf.setMainPanePos([300, 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