From 5f417f71561e56a476ad5b9215aa8f8126c9472d Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Sun, 19 Sep 2021 22:35:35 +0300 Subject: [PATCH] - pattern highlighting: added the Dx and %LPC%, %LPD% expressions --- CHANGELOG.md | 1 + appGUI/GUIElements.py | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f67418d..d792ccb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ CHANGELOG for FlatCAM beta - fixed some issues in AppTextEditor due of Qt6 conversion - In Extract Plugin fixed issue with not extracting soldermask for pads made with "P" type Gerber aperture - in the method that exports the Gerber fixed issue with not exporting the geometry associated with the apertures of type "P" +- pattern highlighting: added the Dx and %LPC%, %LPD% expressions 18.09.2021 diff --git a/appGUI/GUIElements.py b/appGUI/GUIElements.py index 5c8d3356..63407afd 100644 --- a/appGUI/GUIElements.py +++ b/appGUI/GUIElements.py @@ -4552,6 +4552,31 @@ class FCTextAreaLineNumber(QtWidgets.QFrame): rule = (pattern, keyword3) self.highlightingRules.append(rule) + keyword4 = QtGui.QTextCharFormat() + # keyword 4 + brush = QtGui.QBrush(QtGui.QColor("green"), Qt.BrushStyle.SolidPattern) + keyword4.setForeground(brush) + keyword4.setFontWeight(QtGui.QFont.Weight.Bold) + keywords = ["LPC", "LPD"] + for word in keywords: + # pattern = QtCore.QRegularExpression("\\b" + word + "\\b") + pattern = QtCore.QRegularExpression("\%" + "\\b" + word + "\*\%") + rule = (pattern, keyword4) + self.highlightingRules.append(rule) + + # keyword 5 + keyword5 = QtGui.QTextCharFormat() + # SVG colors: https://doc.qt.io/qt-5/qml-color.html#svg-color-reference + brush = QtGui.QBrush(QtGui.QColor("red"), Qt.BrushStyle.SolidPattern) + keyword5.setForeground(brush) + keyword5.setFontWeight(QtGui.QFont.Weight.Bold) + keywords = ["D"] + for word in keywords: + # pattern = QtCore.QRegularExpression("\\b" + word + "\\b") + pattern = QtCore.QRegularExpression("\\b" + word + "\d+\s?") + rule = (pattern, keyword5) + self.highlightingRules.append(rule) + # reservedClasses reservedClasses.setForeground(brush) reservedClasses.setFontWeight(QtGui.QFont.Weight.Bold)