eric6/Debugger/VariablesFilterDialog.py

branch
maintenance
changeset 8043
0acf98cd089a
parent 7924
8a96736d465e
parent 7923
91e843545d9a
child 8176
31965986ecd1
equal deleted inserted replaced
7991:866adc8c315b 8043:0acf98cd089a
8 """ 8 """
9 9
10 from PyQt5.QtCore import Qt 10 from PyQt5.QtCore import Qt
11 from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QListWidgetItem 11 from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QListWidgetItem
12 12
13 from Debugger.Config import ConfigVarTypeDispStrings, ConfigVarTypeFilters 13 from Debugger.Config import ConfigVarTypeDispStrings
14 import Preferences 14 import Preferences
15 15
16 from .Ui_VariablesFilterDialog import Ui_VariablesFilterDialog 16 from .Ui_VariablesFilterDialog import Ui_VariablesFilterDialog
17 17
18 18
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, ConfigVarTypeFilters[varType]) 47 itm.setData(Qt.UserRole, varType)
48 itm.setFlags(Qt.ItemIsEnabled | Qt.ItemIsUserCheckable) 48 itm.setFlags(Qt.ItemIsEnabled | Qt.ItemIsUserCheckable)
49 itm.setCheckState(Qt.Unchecked) 49 itm.setCheckState(Qt.Unchecked)
50 widget.addItem(itm) 50 widget.addItem(itm)
51 51
52 lDefaultFilter, gDefaultFilter = Preferences.getVarFilters() 52 lDefaultFilter, gDefaultFilter = Preferences.getVarFilters()
54 54
55 def getSelection(self): 55 def getSelection(self):
56 """ 56 """
57 Public slot to retrieve the current selections. 57 Public slot to retrieve the current selections.
58 58
59 @return A tuple of lists of integer values. The first list is the 59 @return tuple of lists containing the variable filters. The first list
60 locals variables filter, the second the globals variables filter. 60 is the locals variables filter, the second the globals variables
61 filter.
62 @rtype tuple of (list of str, list of str)
61 """ 63 """
62 lList = [] 64 lList = []
63 for row in range(self.localsList.count()): 65 for row in range(self.localsList.count()):
64 itm = self.localsList.item(row) 66 itm = self.localsList.item(row)
65 if itm.checkState() == Qt.Unchecked: 67 if itm.checkState() == Qt.Unchecked:
74 76
75 def setSelection(self, lList, gList): 77 def setSelection(self, lList, gList):
76 """ 78 """
77 Public slot to set the current selection. 79 Public slot to set the current selection.
78 80
79 @param lList local variables filter (list of int) 81 @param lList local variables filter
80 @param gList global variables filter (list of int) 82 @type list of str
83 @param gList global variables filter
84 @type list of str
81 """ 85 """
82 for row in range(self.localsList.count()): 86 for row in range(self.localsList.count()):
83 itm = self.localsList.item(row) 87 itm = self.localsList.item(row)
84 if itm.data(Qt.UserRole) in lList: 88 if itm.data(Qt.UserRole) in lList:
85 itm.setCheckState(Qt.Unchecked) 89 itm.setCheckState(Qt.Unchecked)

eric ide

mercurial