diff -r 0b936ff1bbb9 -r a2bc06a54d9d src/eric7/Preferences/ConfigurationPages/EditorHighlightingStylesPage.py --- a/src/eric7/Preferences/ConfigurationPages/EditorHighlightingStylesPage.py Sun Nov 06 11:22:39 2022 +0100 +++ b/src/eric7/Preferences/ConfigurationPages/EditorHighlightingStylesPage.py Mon Nov 07 17:19:58 2022 +0100 @@ -22,6 +22,9 @@ from eric7.EricGui import EricPixmapCache from eric7.EricWidgets import EricFileDialog, EricMessageBox +from eric7.EricXML.HighlightingStylesReader import HighlightingStylesReader +from eric7.Preferences.HighlightingStylesFile import HighlightingStylesFile +from eric7.QScintilla import Lexers from ..SubstyleDefinitionDialog import SubstyleDefinitionDialog from .ConfigurationPageBase import ConfigurationPageBase @@ -89,8 +92,6 @@ self.lexers = lexers # set initial values - from eric7.QScintilla import Lexers - languages = sorted([""] + list(self.lexers.keys())) for language in languages: self.lexerLanguageComboBox.addItem( @@ -541,6 +542,10 @@ """ from eric7.Globals import getConfig + from .EditorHighlightingStylesSelectionDialog import ( + EditorHighlightingStylesSelectionDialog, + ) + stylesDir = getConfig("ericStylesDir") lexerNames = list(self.lexers.keys()) @@ -549,10 +554,6 @@ preselect = [self.lexer.language()] else: preselect = [] - from .EditorHighlightingStylesSelectionDialog import ( - EditorHighlightingStylesSelectionDialog, - ) - dlg = EditorHighlightingStylesSelectionDialog( lexerNames, forImport=False, preselect=preselect ) @@ -596,8 +597,6 @@ ) if ok: - from eric7.Preferences.HighlightingStylesFile import HighlightingStylesFile - highlightingStylesFile = HighlightingStylesFile() highlightingStylesFile.writeFile(str(fpath), lexers) @@ -628,8 +627,6 @@ if fn.endswith(".ehj"): # new JSON based file - from eric7.Preferences.HighlightingStylesFile import HighlightingStylesFile - highlightingStylesFile = HighlightingStylesFile() styles = highlightingStylesFile.readFile(fn) if not styles: @@ -638,10 +635,6 @@ # old XML based file f = QFile(fn) if f.open(QIODevice.OpenModeFlag.ReadOnly): - from eric7.EricXML.HighlightingStylesReader import ( - HighlightingStylesReader, - ) - reader = HighlightingStylesReader(f, self.lexers) styles = reader.readXML() f.close() @@ -673,13 +666,13 @@ (defaults to False) @type bool (optional) """ + from .EditorHighlightingStylesSelectionDialog import ( + EditorHighlightingStylesSelectionDialog, + ) + lexerNames = [d["name"] for d in stylesList if d["name"] in self.lexers] if not importAll: - from .EditorHighlightingStylesSelectionDialog import ( - EditorHighlightingStylesSelectionDialog, - ) - dlg = EditorHighlightingStylesSelectionDialog(lexerNames, forImport=True) if dlg.exec() == QDialog.DialogCode.Accepted: lexerNames = dlg.getLexerNames()