eric6/Debugger/VariablesFilterDialog.py

branch
maintenance
changeset 8176
31965986ecd1
parent 8043
0acf98cd089a
parent 8143
2c730d5fd177
child 8273
698ae46f40a4
equal deleted inserted replaced
8153:e01ae92db699 8176:31965986ecd1
36 self.setObjectName(name) 36 self.setObjectName(name)
37 self.setModal(modal) 37 self.setModal(modal)
38 self.setupUi(self) 38 self.setupUi(self)
39 39
40 self.defaultButton = self.buttonBox.addButton( 40 self.defaultButton = self.buttonBox.addButton(
41 self.tr("Save Default"), QDialogButtonBox.ActionRole) 41 self.tr("Save Default"), QDialogButtonBox.ButtonRole.ActionRole)
42 42
43 #populate the list widgets and set the default selection 43 #populate the list widgets and set the default selection
44 for widget in self.localsList, self.globalsList: 44 for widget in self.localsList, self.globalsList:
45 for varType, varTypeStr in ConfigVarTypeDispStrings.items(): 45 for varType, varTypeStr in ConfigVarTypeDispStrings.items():
46 itm = QListWidgetItem(self.tr(varTypeStr), widget) 46 itm = QListWidgetItem(self.tr(varTypeStr), widget)
47 itm.setData(Qt.UserRole, varType) 47 itm.setData(Qt.ItemDataRole.UserRole, varType)
48 itm.setFlags(Qt.ItemIsEnabled | Qt.ItemIsUserCheckable) 48 itm.setFlags(Qt.ItemFlag.ItemIsEnabled |
49 itm.setCheckState(Qt.Unchecked) 49 Qt.ItemFlag.ItemIsUserCheckable)
50 itm.setCheckState(Qt.CheckState.Unchecked)
50 widget.addItem(itm) 51 widget.addItem(itm)
51 52
52 lDefaultFilter, gDefaultFilter = Preferences.getVarFilters() 53 lDefaultFilter, gDefaultFilter = Preferences.getVarFilters()
53 self.setSelection(lDefaultFilter, gDefaultFilter) 54 self.setSelection(lDefaultFilter, gDefaultFilter)
54 55
62 @rtype tuple of (list of str, list of str) 63 @rtype tuple of (list of str, list of str)
63 """ 64 """
64 lList = [] 65 lList = []
65 for row in range(self.localsList.count()): 66 for row in range(self.localsList.count()):
66 itm = self.localsList.item(row) 67 itm = self.localsList.item(row)
67 if itm.checkState() == Qt.Unchecked: 68 if itm.checkState() == Qt.CheckState.Unchecked:
68 lList.append(itm.data(Qt.UserRole)) 69 lList.append(itm.data(Qt.ItemDataRole.UserRole))
69 70
70 gList = [] 71 gList = []
71 for row in range(self.globalsList.count()): 72 for row in range(self.globalsList.count()):
72 itm = self.globalsList.item(row) 73 itm = self.globalsList.item(row)
73 if itm.checkState() == Qt.Unchecked: 74 if itm.checkState() == Qt.CheckState.Unchecked:
74 gList.append(itm.data(Qt.UserRole)) 75 gList.append(itm.data(Qt.ItemDataRole.UserRole))
75 return (lList, gList) 76 return (lList, gList)
76 77
77 def setSelection(self, lList, gList): 78 def setSelection(self, lList, gList):
78 """ 79 """
79 Public slot to set the current selection. 80 Public slot to set the current selection.
83 @param gList global variables filter 84 @param gList global variables filter
84 @type list of str 85 @type list of str
85 """ 86 """
86 for row in range(self.localsList.count()): 87 for row in range(self.localsList.count()):
87 itm = self.localsList.item(row) 88 itm = self.localsList.item(row)
88 if itm.data(Qt.UserRole) in lList: 89 if itm.data(Qt.ItemDataRole.UserRole) in lList:
89 itm.setCheckState(Qt.Unchecked) 90 itm.setCheckState(Qt.CheckState.Unchecked)
90 else: 91 else:
91 itm.setCheckState(Qt.Checked) 92 itm.setCheckState(Qt.CheckState.Checked)
92 93
93 for row in range(self.globalsList.count()): 94 for row in range(self.globalsList.count()):
94 itm = self.globalsList.item(row) 95 itm = self.globalsList.item(row)
95 if itm.data(Qt.UserRole) in gList: 96 if itm.data(Qt.ItemDataRole.UserRole) in gList:
96 itm.setCheckState(Qt.Unchecked) 97 itm.setCheckState(Qt.CheckState.Unchecked)
97 else: 98 else:
98 itm.setCheckState(Qt.Checked) 99 itm.setCheckState(Qt.CheckState.Checked)
99 100
100 def on_buttonBox_clicked(self, button): 101 def on_buttonBox_clicked(self, button):
101 """ 102 """
102 Private slot called by a button of the button box clicked. 103 Private slot called by a button of the button box clicked.
103 104

eric ide

mercurial