eric6/Preferences/ConfigurationPages/EditorHighlightingStylesSelectionDialog.py

changeset 8143
2c730d5fd177
parent 8028
a4f1b68c0737
child 8218
7c09585bd960
equal deleted inserted replaced
8141:27f636beebad 8143:2c730d5fd177
38 """ 38 """
39 super(EditorHighlightingStylesSelectionDialog, self).__init__(parent) 39 super(EditorHighlightingStylesSelectionDialog, self).__init__(parent)
40 self.setupUi(self) 40 self.setupUi(self)
41 41
42 self.__selectAllButton = self.buttonBox.addButton( 42 self.__selectAllButton = self.buttonBox.addButton(
43 self.tr("Select All"), QDialogButtonBox.ActionRole) 43 self.tr("Select All"), QDialogButtonBox.ButtonRole.ActionRole)
44 44
45 if forImport: 45 if forImport:
46 self.setWindowTitle(self.tr("Import Highlighting Styles")) 46 self.setWindowTitle(self.tr("Import Highlighting Styles"))
47 self.infoLabel.setText(self.tr( 47 self.infoLabel.setText(self.tr(
48 "Select the highlighting styles to be imported")) 48 "Select the highlighting styles to be imported"))
54 if preselect is None: 54 if preselect is None:
55 preselect = [] 55 preselect = []
56 56
57 for name in lexerNames: 57 for name in lexerNames:
58 itm = QListWidgetItem(name, self.lexersList) 58 itm = QListWidgetItem(name, self.lexersList)
59 itm.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled) 59 itm.setFlags(
60 Qt.ItemFlag.ItemIsUserCheckable | Qt.ItemFlag.ItemIsEnabled)
60 if name in preselect: 61 if name in preselect:
61 itm.setCheckState(Qt.Checked) 62 itm.setCheckState(Qt.CheckState.Checked)
62 else: 63 else:
63 itm.setCheckState(Qt.Unchecked) 64 itm.setCheckState(Qt.CheckState.Unchecked)
64 65
65 self.__updateOkButton() 66 self.__updateOkButton()
66 67
67 @pyqtSlot() 68 @pyqtSlot()
68 def __updateOkButton(self): 69 def __updateOkButton(self):
69 """ 70 """
70 Private slot to update the state of the OK button. 71 Private slot to update the state of the OK button.
71 """ 72 """
72 for row in range(self.lexersList.count()): 73 for row in range(self.lexersList.count()):
73 itm = self.lexersList.item(row) 74 itm = self.lexersList.item(row)
74 if itm.checkState() == Qt.Checked: 75 if itm.checkState() == Qt.CheckState.Checked:
75 enable = True 76 enable = True
76 break 77 break
77 else: 78 else:
78 enable = False 79 enable = False
79 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) 80 self.buttonBox.button(
81 QDialogButtonBox.StandardButton.Ok).setEnabled(enable)
80 82
81 @pyqtSlot(QListWidgetItem) 83 @pyqtSlot(QListWidgetItem)
82 def on_lexersList_itemChanged(self, item): 84 def on_lexersList_itemChanged(self, item):
83 """ 85 """
84 Private slot to react on changes in check state. 86 Private slot to react on changes in check state.
97 @type QAbstractButton 99 @type QAbstractButton
98 """ 100 """
99 if button is self.__selectAllButton: 101 if button is self.__selectAllButton:
100 for row in range(self.lexersList.count()): 102 for row in range(self.lexersList.count()):
101 itm = self.lexersList.item(row) 103 itm = self.lexersList.item(row)
102 itm.setCheckState(Qt.Checked) 104 itm.setCheckState(Qt.CheckState.Checked)
103 105
104 def getLexerNames(self): 106 def getLexerNames(self):
105 """ 107 """
106 Public method to get the selected lexer names. 108 Public method to get the selected lexer names.
107 109
109 @rtype list of str 111 @rtype list of str
110 """ 112 """
111 lexerNames = [] 113 lexerNames = []
112 for row in range(self.lexersList.count()): 114 for row in range(self.lexersList.count()):
113 itm = self.lexersList.item(row) 115 itm = self.lexersList.item(row)
114 if itm.checkState() == Qt.Checked: 116 if itm.checkState() == Qt.CheckState.Checked:
115 lexerNames.append(itm.text()) 117 lexerNames.append(itm.text())
116 118
117 return lexerNames 119 return lexerNames

eric ide

mercurial