Tue, 10 Dec 2024 15:46:34 +0100
Updated copyright for 2025.
8022
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
11090
f5f5f5803935
Updated copyright for 2025.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10459
diff
changeset
|
3 | # Copyright (c) 2021 - 2025 Detlev Offenbach <detlev@die-offenbachs.de> |
8022
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Module implementing a class representing the highlighting styles JSON file. |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | """ |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
10 | import json |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
11 | import time |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
12 | |
8318
962bce857696
Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8312
diff
changeset
|
13 | from PyQt6.QtCore import QObject |
8022
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
14 | |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
15 | from eric7 import Preferences |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9278
diff
changeset
|
16 | from eric7.EricGui.EricOverrideCursor import EricOverridenCursor |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
17 | from eric7.EricWidgets import EricMessageBox |
8022
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
18 | |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
19 | |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
20 | class HighlightingStylesFile(QObject): |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
21 | """ |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
22 | Class representing the highlighting styles JSON file. |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
23 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
24 | |
8022
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
25 | def __init__(self, parent: QObject = None): |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
26 | """ |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
27 | Constructor |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
28 | |
8022
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
29 | @param parent reference to the parent object (defaults to None) |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
30 | @type QObject (optional) |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
31 | """ |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8103
diff
changeset
|
32 | super().__init__(parent) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
33 | |
8103
338fe0064e5a
HighlightingStylesFile: added code for some aliased lexer names where the QScintilla name and the one used in eric are not identical.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8028
diff
changeset
|
34 | self.__lexerAliases = { |
338fe0064e5a
HighlightingStylesFile: added code for some aliased lexer names where the QScintilla name and the one used in eric are not identical.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8028
diff
changeset
|
35 | "PO": "Gettext", |
338fe0064e5a
HighlightingStylesFile: added code for some aliased lexer names where the QScintilla name and the one used in eric are not identical.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8028
diff
changeset
|
36 | "POV": "Povray", |
338fe0064e5a
HighlightingStylesFile: added code for some aliased lexer names where the QScintilla name and the one used in eric are not identical.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8028
diff
changeset
|
37 | } |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
38 | |
8022
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
39 | def writeFile(self, filename: str, lexers: list) -> bool: |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
40 | """ |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
41 | Public method to write the highlighting styles data to a highlighting |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
42 | styles JSON file. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
43 | |
8022
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
44 | @param filename name of the highlighting styles file |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
45 | @type str |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
46 | @param lexers list of lexers for which to export the styles |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
47 | @type list of PreferencesLexer |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
48 | @return flag indicating a successful write |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
49 | @rtype bool |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
50 | """ |
9278
36448ca469c2
Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
51 | stylesDict = { |
36448ca469c2
Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
52 | # step 0: header |
36448ca469c2
Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
53 | "header": { |
36448ca469c2
Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
54 | "comment": "eric highlighting styles file", |
36448ca469c2
Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
55 | "saved": time.strftime("%Y-%m-%d, %H:%M:%S"), |
36448ca469c2
Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
56 | "author": Preferences.getUser("Email"), |
36448ca469c2
Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
57 | }, |
36448ca469c2
Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
58 | # step 1: add the lexer style data |
36448ca469c2
Simplified some code iaw. recommendations of the extended style checker and reformatted the code with black.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
59 | "lexers": [], |
8022
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
60 | } |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
61 | for lexer in lexers: |
8103
338fe0064e5a
HighlightingStylesFile: added code for some aliased lexer names where the QScintilla name and the one used in eric are not identical.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8028
diff
changeset
|
62 | name = lexer.language() |
338fe0064e5a
HighlightingStylesFile: added code for some aliased lexer names where the QScintilla name and the one used in eric are not identical.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8028
diff
changeset
|
63 | if name in self.__lexerAliases: |
338fe0064e5a
HighlightingStylesFile: added code for some aliased lexer names where the QScintilla name and the one used in eric are not identical.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8028
diff
changeset
|
64 | name = self.__lexerAliases[name] |
8022
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
65 | lexerDict = { |
8103
338fe0064e5a
HighlightingStylesFile: added code for some aliased lexer names where the QScintilla name and the one used in eric are not identical.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8028
diff
changeset
|
66 | "name": name, |
8022
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
67 | "styles": [], |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
68 | } |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
69 | for description, style, substyle in lexer.getStyles(): |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
70 | lexerDict["styles"].append( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
71 | { |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
72 | "description": description, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
73 | "style": style, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
74 | "substyle": substyle, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
75 | "color": lexer.color(style, substyle).name(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
76 | "paper": lexer.paper(style, substyle).name(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
77 | "font": lexer.font(style, substyle).toString(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
78 | "eolfill": lexer.eolFill(style, substyle), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
79 | "words": lexer.words(style, substyle).strip(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
80 | } |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
81 | ) |
8022
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
82 | stylesDict["lexers"].append(lexerDict) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
83 | |
8022
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
84 | try: |
10459
5c5ed40d533d
Changed the JSON based file writers to ensure a "\n" at the end to make them please version control systems (see issue 528).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
85 | jsonString = json.dumps(stylesDict, indent=2) + "\n" |
8022
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
86 | with open(filename, "w") as f: |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
87 | f.write(jsonString) |
10050
3750abc45d5e
Corrected some code style issues detected by the extended checkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
88 | except (OSError, TypeError) as err: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
89 | with EricOverridenCursor(): |
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
90 | EricMessageBox.critical( |
8022
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
91 | None, |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
92 | self.tr("Export Highlighting Styles"), |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
93 | self.tr( |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
94 | "<p>The highlighting styles file <b>{0}</b> could not" |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
95 | " be written.</p><p>Reason: {1}</p>" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
96 | ).format(filename, str(err)), |
8022
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
97 | ) |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
98 | return False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
99 | |
8022
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
100 | return True |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
101 | |
8028
a4f1b68c0737
Highlighting Styles: changed the import/export logic to allow the selection of lexers to be imported/exported.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8026
diff
changeset
|
102 | def readFile(self, filename: str) -> list: |
8022
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
103 | """ |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
104 | Public method to read the highlighting styles data from a highlighting |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
105 | styles JSON file. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
106 | |
8022
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
107 | @param filename name of the highlighting styles file |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
108 | @type str |
8026
d3eacdbcb18b
Changed the highlighting styles import logic thus, that the imported styles are applied in the configuration page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8022
diff
changeset
|
109 | @return list of read lexer style definitions |
d3eacdbcb18b
Changed the highlighting styles import logic thus, that the imported styles are applied in the configuration page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8022
diff
changeset
|
110 | @rtype list of dict |
8022
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
111 | """ |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
112 | try: |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
113 | with open(filename, "r") as f: |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
114 | jsonString = f.read() |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
115 | stylesDict = json.loads(jsonString) |
8240
93b8a353c4bf
Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
116 | except (OSError, json.JSONDecodeError) as err: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
117 | EricMessageBox.critical( |
8022
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
118 | None, |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
119 | self.tr("Import Highlighting Styles"), |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
120 | self.tr( |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
121 | "<p>The highlighting styles file <b>{0}</b> could not be" |
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
122 | " read.</p><p>Reason: {1}</p>" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
123 | ).format(filename, str(err)), |
8022
2da0139f4f91
Implemented the JSON based highlighting styles files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
124 | ) |
8026
d3eacdbcb18b
Changed the highlighting styles import logic thus, that the imported styles are applied in the configuration page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8022
diff
changeset
|
125 | return [] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
126 | |
8026
d3eacdbcb18b
Changed the highlighting styles import logic thus, that the imported styles are applied in the configuration page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8022
diff
changeset
|
127 | return stylesDict["lexers"] |