Sat, 10 Apr 2021 18:38:27 +0200
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
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 | |
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
|
3 | # Copyright (c) 2021 Detlev Offenbach <detlev@die-offenbachs.de> |
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 | |
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
|
10 | from PyQt5.QtCore import pyqtSlot, Qt |
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
|
11 | from PyQt5.QtWidgets import ( |
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 | QDialog, QDialogButtonBox, QListWidgetItem, 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
|
13 | ) |
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
|
14 | |
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 | from .Ui_EditorHighlightingStylesSelectionDialog import ( |
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 | 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
|
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 | |
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 | |
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 | 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
|
21 | 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
|
22 | ): |
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 | """ |
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
|
24 | 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
|
25 | """ |
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 | 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
|
27 | """ |
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
|
28 | Constructor |
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 | |
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 | @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
|
31 | @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
|
32 | @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
|
33 | @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
|
34 | @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
|
35 | @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
|
36 | @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
|
37 | @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
|
38 | """ |
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
|
39 | 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
|
40 | self.setupUi(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
|
41 | |
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
|
42 | self.__selectAllButton = self.buttonBox.addButton( |
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
|
43 | self.tr("Select All"), QDialogButtonBox.ButtonRole.ActionRole) |
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
|
44 | |
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")) |
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
|
47 | self.infoLabel.setText(self.tr( |
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
|
48 | "Select the highlighting styles to be imported")) |
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
|
49 | 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
|
50 | self.setWindowTitle(self.tr("Export Highlighting 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
|
51 | self.infoLabel.setText(self.tr( |
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
|
52 | "Select the highlighting styles to be 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
|
53 | |
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
|
54 | 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
|
55 | preselect = [] |
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 | |
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 | 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
|
58 | itm = QListWidgetItem(name, self.lexersList) |
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
|
59 | itm.setFlags( |
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
|
60 | 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
|
61 | 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
|
62 | 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
|
63 | 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
|
64 | itm.setCheckState(Qt.CheckState.Unchecked) |
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
|
65 | |
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
|
66 | self.__updateOkButton() |
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 | |
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
|
68 | @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
|
69 | 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
|
70 | """ |
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 | 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
|
72 | """ |
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 | 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
|
74 | 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
|
75 | 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
|
76 | 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
|
77 | 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
|
78 | 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
|
79 | enable = False |
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
|
80 | self.buttonBox.button( |
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
|
81 | QDialogButtonBox.StandardButton.Ok).setEnabled(enable) |
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
|
82 | |
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. |
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
|
87 | |
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() |
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
|
92 | |
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. |
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
|
97 | |
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) |
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
|
105 | |
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. |
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
|
109 | |
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()) |
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
|
118 | |
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 |