From bf1b4d5d3b9a48556a8e1f0198b5009c965292a5 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Sat, 18 May 2019 18:13:25 +0200 Subject: [PATCH] Fixed tests, some resize issues, and cleaned out some unneeded code. --- nw/gui/doceditor.py | 1 + nw/gui/winmain.py | 16 ++-------------- sample/sampleNovel/nwProject.nwx | 2 +- tests/reference/gui/1_nwProject.nwx | 2 ++ tests/reference/gui/2_nwProject.nwx | 2 ++ tests/reference/gui/3_nwProject.nwx | 2 ++ tests/reference/proj/1_nwProject.nwx | 2 ++ tests/reference/proj/2_nwProject.nwx | 2 ++ 8 files changed, 14 insertions(+), 15 deletions(-) diff --git a/nw/gui/doceditor.py b/nw/gui/doceditor.py index b7c6a7d5..11acf866 100644 --- a/nw/gui/doceditor.py +++ b/nw/gui/doceditor.py @@ -176,6 +176,7 @@ class GuiDocEditor(QTextEdit): mTB = self.mainConf.textMargin[0] if tM >= 10: self.setViewportMargins(tM,mTB,0,mTB) + self.setLineWrapColumnOrWidth(self.mainConf.textWidth) else: self.setViewportMargins(10,mTB,0,mTB) self.setLineWrapColumnOrWidth(tW - sW - 20) diff --git a/nw/gui/winmain.py b/nw/gui/winmain.py index e7af4666..02318a1e 100644 --- a/nw/gui/winmain.py +++ b/nw/gui/winmain.py @@ -64,12 +64,6 @@ class GuiMain(QMainWindow): self.importLabels = [] # Assemble Main Window - self.stackPane = QStackedWidget() - self.stackNone = self.stackPane.addWidget(QWidget()) - self.stackDoc = self.stackPane.addWidget(QWidget()) - self.stackView = self.stackPane.addWidget(QWidget()) - self.stackPane.setCurrentIndex(self.stackNone) - self.treePane = QFrame() self.treeBox = QVBoxLayout() self.treeBox.addWidget(self.treeView) @@ -222,7 +216,6 @@ class GuiMain(QMainWindow): def openDocument(self, tHandle): if self._takeDocumentAction(): self.saveDocument() - self.stackPane.setCurrentIndex(self.stackDoc) self.docEditor.setText(self.theDocument.openDocument(tHandle)) self.docEditor.setReadOnly(False) self.docEditor.setCursorPosition(self.theDocument.theItem.cursorPos) @@ -254,7 +247,6 @@ class GuiMain(QMainWindow): tItem = self.theProject.getItem(tHandle) if tItem.itemType == nwItemType.FILE: logger.debug("Generating preview for item %s" % tHandle) - self.stackPane.setCurrentIndex(self.stackView) aDoc = ToHtml(self.theProject, self) aDoc.setText(tHandle) aDoc.tokenizeText() @@ -393,8 +385,6 @@ class GuiMain(QMainWindow): return True def _takeDocumentAction(self): - if self.stackPane.currentIndex() != self.stackDoc: - return False if self.theDocument.theItem is None: return False if not self.docEditor.docChanged: @@ -429,8 +419,7 @@ class GuiMain(QMainWindow): """Extend QMainWindow.resizeEvent to signal dependent GUI elements that its pane may have changed size. """ QMainWindow.resizeEvent(self,theEvent) - if self.stackPane.currentIndex() == self.stackDoc: - self.docEditor.changeWidth() + self.docEditor.changeWidth() return def closeEvent(self, theEvent): @@ -473,8 +462,7 @@ class GuiMain(QMainWindow): def _splitMainMove(self, pWidth, pHeight): """Alert dependent GUI elements that the main pane splitter has been moved. """ - if self.stackPane.currentIndex() == self.stackDoc: - self.docEditor.changeWidth() + self.docEditor.changeWidth() return # END Class GuiMain diff --git a/sample/sampleNovel/nwProject.nwx b/sample/sampleNovel/nwProject.nwx index 4b1a3cb9..0e68ae5c 100644 --- a/sample/sampleNovel/nwProject.nwx +++ b/sample/sampleNovel/nwProject.nwx @@ -1,5 +1,5 @@ - + Sample Project Sample Project diff --git a/tests/reference/gui/1_nwProject.nwx b/tests/reference/gui/1_nwProject.nwx index 75ab919f..cf0b0f54 100644 --- a/tests/reference/gui/1_nwProject.nwx +++ b/tests/reference/gui/1_nwProject.nwx @@ -6,6 +6,8 @@ False + None + None diff --git a/tests/reference/gui/2_nwProject.nwx b/tests/reference/gui/2_nwProject.nwx index 74949967..33070870 100644 --- a/tests/reference/gui/2_nwProject.nwx +++ b/tests/reference/gui/2_nwProject.nwx @@ -8,6 +8,8 @@ False + None + None diff --git a/tests/reference/gui/3_nwProject.nwx b/tests/reference/gui/3_nwProject.nwx index 632419cb..ecc54350 100644 --- a/tests/reference/gui/3_nwProject.nwx +++ b/tests/reference/gui/3_nwProject.nwx @@ -6,6 +6,8 @@ False + None + None diff --git a/tests/reference/proj/1_nwProject.nwx b/tests/reference/proj/1_nwProject.nwx index 91f8998d..181e1166 100644 --- a/tests/reference/proj/1_nwProject.nwx +++ b/tests/reference/proj/1_nwProject.nwx @@ -6,6 +6,8 @@ False + None + None diff --git a/tests/reference/proj/2_nwProject.nwx b/tests/reference/proj/2_nwProject.nwx index 8a101717..f9dbdef1 100644 --- a/tests/reference/proj/2_nwProject.nwx +++ b/tests/reference/proj/2_nwProject.nwx @@ -6,6 +6,8 @@ False + None + None