From 9baea11791527eab4a92e3fb79c29f6f4410083a Mon Sep 17 00:00:00 2001 From: Olivier Keshavjee Date: Mon, 27 Nov 2017 21:13:15 +0100 Subject: [PATCH] Fixes FullScreenEditor with MDEditView --- manuskript/ui/highlighters/basicHighlighter.py | 5 ++++- manuskript/ui/views/MDEditView.py | 4 ++++ manuskript/ui/views/textEditView.py | 6 +++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/manuskript/ui/highlighters/basicHighlighter.py b/manuskript/ui/highlighters/basicHighlighter.py index 18c1dfc0..960b7201 100644 --- a/manuskript/ui/highlighters/basicHighlighter.py +++ b/manuskript/ui/highlighters/basicHighlighter.py @@ -64,7 +64,10 @@ class BasicHighlighter(QSyntaxHighlighter): else: opt = self.editor._themeData self.defaultTextColor = QColor(opt["Text/Color"]) - self.backgroundColor = QColor(opt["Background/Color"]) + self.backgroundColor = F.mixColors( + QColor(opt["Foreground/Color"]), + QColor(opt["Background/Color"]), + int(opt["Foreground/Opacity"])/100.) self.markupColor = F.mixColors(self.defaultTextColor, self.backgroundColor, .3) diff --git a/manuskript/ui/views/MDEditView.py b/manuskript/ui/views/MDEditView.py index 2d31f716..4521906b 100644 --- a/manuskript/ui/views/MDEditView.py +++ b/manuskript/ui/views/MDEditView.py @@ -24,6 +24,10 @@ class MDEditView(textEditView): self._textFormat = "md" self._highlighterClass = MarkdownHighlighter + if index: + # We have to setup things anew, for the highlighter notably + self.setCurrentModelIndex(index) + # def focusInEvent(self, event): # """Finds textFormatter and attach them to that view.""" # textEditView.focusInEvent(self, event) diff --git a/manuskript/ui/views/textEditView.py b/manuskript/ui/views/textEditView.py index 6090f2cc..07fbeb9b 100644 --- a/manuskript/ui/views/textEditView.py +++ b/manuskript/ui/views/textEditView.py @@ -83,9 +83,9 @@ class textEditView(QTextEdit): else: self.spellcheck = False - # if self._highlighting and not self.highlighter: - # self.highlighter = self._highlighterClass(self) - # self.highlighter.setDefaultBlockFormat(self._defaultBlockFormat) + if self._highlighting and not self.highlighter: + self.highlighter = self._highlighterClass(self) + self.highlighter.setDefaultBlockFormat(self._defaultBlockFormat) def getDefaultLocale(self): default_locale = enchant.get_default_language()