Ctrl+R now previews the document as HTML

This commit is contained in:
Veronica K. B. Olsen
2019-05-10 18:47:57 +02:00
parent 7644df1c52
commit 23f3e4b5bb
3 changed files with 20 additions and 16 deletions
+1 -1
View File
@@ -57,7 +57,7 @@ class ToHtml(Tokenizer):
tTemp = tTemp[:xPos]+htmlTags[xFmt]+tTemp[xPos+xLen:] tTemp = tTemp[:xPos]+htmlTags[xFmt]+tTemp[xPos+xLen:]
thisPar.append(tTemp) thisPar.append(tTemp)
print(self.theResult) # print(self.theResult)
return return
+13 -11
View File
@@ -20,6 +20,7 @@ from PyQt5.QtCore import Qt, QTimer
from nw.gui.doctree import GuiDocTree from nw.gui.doctree import GuiDocTree
from nw.gui.doceditor import GuiDocEditor from nw.gui.doceditor import GuiDocEditor
from nw.gui.docviewer import GuiDocViewer
from nw.gui.docdetails import GuiDocDetails from nw.gui.docdetails import GuiDocDetails
from nw.gui.mainmenu import GuiMainMenu from nw.gui.mainmenu import GuiMainMenu
from nw.gui.projecteditor import GuiProjectEditor from nw.gui.projecteditor import GuiProjectEditor
@@ -50,6 +51,7 @@ class GuiMain(QMainWindow):
# Main GUI Elements # Main GUI Elements
self.docEditor = GuiDocEditor(self) self.docEditor = GuiDocEditor(self)
self.docViewer = GuiDocViewer(self)
self.docDetails = GuiDocDetails(self, self.theProject) self.docDetails = GuiDocDetails(self, self.theProject)
self.treeView = GuiDocTree(self, self.theProject) self.treeView = GuiDocTree(self, self.theProject)
self.mainMenu = GuiMainMenu(self, self.theProject) self.mainMenu = GuiMainMenu(self, self.theProject)
@@ -59,6 +61,7 @@ class GuiMain(QMainWindow):
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(self.docEditor)
self.stackView = self.stackPane.addWidget(self.docViewer)
self.stackPane.setCurrentIndex(self.stackNone) self.stackPane.setCurrentIndex(self.stackNone)
self.treePane = QFrame() self.treePane = QFrame()
@@ -193,19 +196,18 @@ class GuiMain(QMainWindow):
def _previewDocument(self): def _previewDocument(self):
theHandles = self.treeView.getSelectedHandles() tHandle = self.treeView.getSelectedHandle()
if len(theHandles) == 0: if tHandle is None:
logger.warning("No document selected")
return return
theDocs = [] logger.debug("Generating preview for item %s" % tHandle)
self.treeView.saveTreeOrder() self.stackPane.setCurrentIndex(self.stackView)
for tHandle in self.theProject.treeOrder: aDoc = ToHtml(self.theProject, self)
if tHandle not in theHandles: aDoc.setText(tHandle)
continue aDoc.tokenizeText()
aDoc = ToHtml(self.theProject, self) aDoc.doConvert()
aDoc.setText(tHandle) self.docViewer.setHtml(aDoc.theResult)
aDoc.tokenizeText()
aDoc.doConvert()
return return
+6 -4
View File
@@ -7,10 +7,12 @@ QTextEdit {
color: #c7cfd0; color: #c7cfd0;
} }
QTextBrowser {
background-color: #141414;
color: #c7cfd0;
padding: 40px;
}
QTreeView, QHeaderView { QTreeView, QHeaderView {
font-size: 13px; font-size: 13px;
} }
/* QStatusBar::item QLabel {
color: #990000;
font-style: normal;
} */