From d815ae8a6acb8440d624284f235a706114b5f54b Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Mon, 7 Oct 2019 13:34:22 +0300 Subject: [PATCH] - made sure that is the text in the source file of a FlatCAMDocument is HTML is loaded as such --- FlatCAMObj.py | 9 +++++++-- README.md | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/FlatCAMObj.py b/FlatCAMObj.py index 364f2c48..27ca4e98 100644 --- a/FlatCAMObj.py +++ b/FlatCAMObj.py @@ -6,6 +6,8 @@ # MIT Licence # # ########################################################## ## +from PyQt5.QtCore import Qt +from PyQt5.QtGui import QTextDocument import copy import inspect # TODO: For debugging only. from datetime import datetime @@ -6789,8 +6791,11 @@ class FlatCAMDocument(FlatCAMObj): self.document_editor_tab.handleTextChanged() self.ser_attrs = ['options', 'kind', 'source_file'] - for line in self.source_file.splitlines(): - self.document_editor_tab.code_editor.append(line) + if Qt.mightBeRichText(self.source_file): + self.document_editor_tab.code_editor.setHtml(self.source_file) + else: + for line in self.source_file.splitlines(): + self.document_editor_tab.code_editor.append(line) self.build_ui() diff --git a/README.md b/README.md index 34199dc1..c32937e9 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ CAD program, and create G-Code for Isolation routing. - added a dark theme to FlatCAM (only for canvas). The selection is done in Edit -> Preferences -> General -> GUI Settings - updated the .POT file and worked a bit in the romanian translation - small changes: reduced the thickness of the axis in 3D mode from 3 pixels to 1 pixel +- made sure that is the text in the source file of a FlatCAMDocument is HTML is loaded as such 6.10.2019