Tue, 12 Nov 2024 18:01:04 +0100
Added a configuration entry on the Qt page to enter the path of the 'lrelease' program for that cases, where it cannot be detected automatically (e.g. due to different name).
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:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
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:
diff
changeset
|
2 | |
10439
21c28b0f9e41
Updated copyright for 2024.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
3 | # Copyright (c) 2021 - 2024 Detlev Offenbach <detlev@die-offenbachs.de> |
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:
diff
changeset
|
4 | # |
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:
diff
changeset
|
5 | |
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:
diff
changeset
|
6 | """ |
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:
diff
changeset
|
7 | Module implementing a dialog to select the styles to be imported/exported. |
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:
diff
changeset
|
8 | """ |
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:
diff
changeset
|
9 | |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
10 | from PyQt6.QtCore import Qt, pyqtSlot |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
11 | from PyQt6.QtWidgets import QAbstractButton, QDialog, QDialogButtonBox, QListWidgetItem |
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:
diff
changeset
|
12 | |
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:
diff
changeset
|
13 | from .Ui_EditorHighlightingStylesSelectionDialog import ( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
14 | Ui_EditorHighlightingStylesSelectionDialog, |
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:
diff
changeset
|
15 | ) |
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:
diff
changeset
|
16 | |
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:
diff
changeset
|
17 | |
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:
diff
changeset
|
18 | class EditorHighlightingStylesSelectionDialog( |
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:
diff
changeset
|
19 | QDialog, Ui_EditorHighlightingStylesSelectionDialog |
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:
diff
changeset
|
20 | ): |
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:
diff
changeset
|
21 | """ |
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:
diff
changeset
|
22 | Class implementing a dialog to select the styles to be imported/exported. |
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:
diff
changeset
|
23 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
24 | |
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:
diff
changeset
|
25 | def __init__(self, lexerNames, forImport, preselect=None, parent=None): |
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:
diff
changeset
|
26 | """ |
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:
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 | |
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:
diff
changeset
|
29 | @param lexerNames list of lexer names to select from |
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:
diff
changeset
|
30 | @type list of str |
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:
diff
changeset
|
31 | @param forImport flag indicating a dialog for importing styles |
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:
diff
changeset
|
32 | @type bool |
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:
diff
changeset
|
33 | @param preselect list of lexer names to be preselected |
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:
diff
changeset
|
34 | @type list of str |
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:
diff
changeset
|
35 | @param parent reference to the parent widget |
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:
diff
changeset
|
36 | @type QWidget |
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:
diff
changeset
|
37 | """ |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
38 | super().__init__(parent) |
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:
diff
changeset
|
39 | self.setupUi(self) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
40 | |
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:
diff
changeset
|
41 | self.__selectAllButton = self.buttonBox.addButton( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
42 | self.tr("Select All"), QDialogButtonBox.ButtonRole.ActionRole |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
43 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
44 | |
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:
diff
changeset
|
45 | if forImport: |
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:
diff
changeset
|
46 | self.setWindowTitle(self.tr("Import Highlighting Styles")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
47 | self.infoLabel.setText( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
48 | self.tr("Select the highlighting styles to be imported") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
49 | ) |
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:
diff
changeset
|
50 | else: |
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:
diff
changeset
|
51 | self.setWindowTitle(self.tr("Export Highlighting Styles")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
52 | self.infoLabel.setText( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
53 | self.tr("Select the highlighting styles to be exported") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
54 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
55 | |
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:
diff
changeset
|
56 | if preselect is None: |
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:
diff
changeset
|
57 | preselect = [] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
58 | |
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:
diff
changeset
|
59 | for name in lexerNames: |
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:
diff
changeset
|
60 | itm = QListWidgetItem(name, self.lexersList) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
61 | itm.setFlags(Qt.ItemFlag.ItemIsUserCheckable | Qt.ItemFlag.ItemIsEnabled) |
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:
diff
changeset
|
62 | if name in preselect: |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8028
diff
changeset
|
63 | itm.setCheckState(Qt.CheckState.Checked) |
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:
diff
changeset
|
64 | else: |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8028
diff
changeset
|
65 | itm.setCheckState(Qt.CheckState.Unchecked) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
66 | |
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:
diff
changeset
|
67 | self.__updateOkButton() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
68 | |
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:
diff
changeset
|
69 | @pyqtSlot() |
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:
diff
changeset
|
70 | def __updateOkButton(self): |
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:
diff
changeset
|
71 | """ |
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:
diff
changeset
|
72 | Private slot to update the state of the OK button. |
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:
diff
changeset
|
73 | """ |
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:
diff
changeset
|
74 | for row in range(self.lexersList.count()): |
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:
diff
changeset
|
75 | itm = self.lexersList.item(row) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8028
diff
changeset
|
76 | if itm.checkState() == Qt.CheckState.Checked: |
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:
diff
changeset
|
77 | enable = True |
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:
diff
changeset
|
78 | break |
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:
diff
changeset
|
79 | else: |
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:
diff
changeset
|
80 | enable = False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
81 | self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(enable) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
82 | |
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:
diff
changeset
|
83 | @pyqtSlot(QListWidgetItem) |
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:
diff
changeset
|
84 | def on_lexersList_itemChanged(self, item): |
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:
diff
changeset
|
85 | """ |
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:
diff
changeset
|
86 | Private slot to react on changes in check state. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
87 | |
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:
diff
changeset
|
88 | @param item reference to the changed item |
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:
diff
changeset
|
89 | @type QListWidgetItem |
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:
diff
changeset
|
90 | """ |
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:
diff
changeset
|
91 | self.__updateOkButton() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
92 | |
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:
diff
changeset
|
93 | @pyqtSlot(QAbstractButton) |
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:
diff
changeset
|
94 | def on_buttonBox_clicked(self, button): |
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:
diff
changeset
|
95 | """ |
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:
diff
changeset
|
96 | Private slot to handle the user pressing a button. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
97 | |
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:
diff
changeset
|
98 | @param button reference to the button pressed |
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:
diff
changeset
|
99 | @type QAbstractButton |
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:
diff
changeset
|
100 | """ |
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:
diff
changeset
|
101 | if button is self.__selectAllButton: |
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:
diff
changeset
|
102 | for row in range(self.lexersList.count()): |
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:
diff
changeset
|
103 | itm = self.lexersList.item(row) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8028
diff
changeset
|
104 | itm.setCheckState(Qt.CheckState.Checked) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
105 | |
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:
diff
changeset
|
106 | def getLexerNames(self): |
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:
diff
changeset
|
107 | """ |
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:
diff
changeset
|
108 | Public method to get the selected lexer names. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
109 | |
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:
diff
changeset
|
110 | @return list of selected lexer names |
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:
diff
changeset
|
111 | @rtype list of str |
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:
diff
changeset
|
112 | """ |
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:
diff
changeset
|
113 | lexerNames = [] |
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:
diff
changeset
|
114 | for row in range(self.lexersList.count()): |
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:
diff
changeset
|
115 | itm = self.lexersList.item(row) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8028
diff
changeset
|
116 | if itm.checkState() == Qt.CheckState.Checked: |
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:
diff
changeset
|
117 | lexerNames.append(itm.text()) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
118 | |
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:
diff
changeset
|
119 | return lexerNames |