12 from PyQt6.QtCore import Qt, pyqtSlot |
12 from PyQt6.QtCore import Qt, pyqtSlot |
13 from PyQt6.QtWidgets import QHeaderView, QTreeWidgetItem, QDialog |
13 from PyQt6.QtWidgets import QHeaderView, QTreeWidgetItem, QDialog |
14 |
14 |
15 from .Ui_LexerAssociationDialog import Ui_LexerAssociationDialog |
15 from .Ui_LexerAssociationDialog import Ui_LexerAssociationDialog |
16 |
16 |
17 import QScintilla.Lexers |
17 from eric7.QScintilla import Lexers |
18 |
18 |
19 import UI.PixmapCache |
19 from eric7.EricGui import EricPixmapCache |
20 |
20 |
21 |
21 |
22 class LexerAssociationDialog(QDialog, Ui_LexerAssociationDialog): |
22 class LexerAssociationDialog(QDialog, Ui_LexerAssociationDialog): |
23 """ |
23 """ |
24 Class implementing a dialog to enter lexer associations for the project. |
24 Class implementing a dialog to enter lexer associations for the project. |
47 self.extsep = "." |
47 self.extsep = "." |
48 |
48 |
49 self.extras = ["-----------", self.tr("Alternative")] |
49 self.extras = ["-----------", self.tr("Alternative")] |
50 |
50 |
51 self.editorLexerCombo.addItem("") |
51 self.editorLexerCombo.addItem("") |
52 self.editorLexerCombo.addItem(UI.PixmapCache.getIcon("fileText"), "Text") |
52 self.editorLexerCombo.addItem(EricPixmapCache.getIcon("fileText"), "Text") |
53 for lang in sorted(QScintilla.Lexers.getSupportedLanguages().keys()): |
53 for lang in sorted(Lexers.getSupportedLanguages().keys()): |
54 self.editorLexerCombo.addItem( |
54 self.editorLexerCombo.addItem(Lexers.getLanguageIcon(lang, False), lang) |
55 QScintilla.Lexers.getLanguageIcon(lang, False), lang |
|
56 ) |
|
57 self.editorLexerCombo.addItems(self.extras) |
55 self.editorLexerCombo.addItems(self.extras) |
58 |
56 |
59 from pygments.lexers import get_all_lexers |
57 from pygments.lexers import get_all_lexers |
60 |
58 |
61 pygmentsLexers = [""] + sorted(lex[0] for lex in get_all_lexers()) |
59 pygmentsLexers = [""] + sorted(lex[0] for lex in get_all_lexers()) |