Debugger/BreakPointModel.py

changeset 2126
3744863a534e
parent 2081
b7ccd563eeb6
child 2302
f29e9405c851
equal deleted inserted replaced
2124:909d55803dd6 2126:3744863a534e
5 5
6 """ 6 """
7 Module implementing the Breakpoint model. 7 Module implementing the Breakpoint model.
8 """ 8 """
9 9
10 from PyQt4.QtCore import pyqtSignal, Qt, QAbstractItemModel, QModelIndex, qVersion 10 from PyQt4.QtCore import pyqtSignal, Qt, QAbstractItemModel, QModelIndex
11 11
12 12
13 class BreakPointModel(QAbstractItemModel): 13 class BreakPointModel(QAbstractItemModel):
14 """ 14 """
15 Class implementing a custom model for breakpoints. 15 Class implementing a custom model for breakpoints.
105 index.row() >= len(self.breakpoints): 105 index.row() >= len(self.breakpoints):
106 return False 106 return False
107 107
108 self.dataAboutToBeChanged.emit(index, index) 108 self.dataAboutToBeChanged.emit(index, index)
109 self.breakpoints[index.row()][index.column()] = value 109 self.breakpoints[index.row()][index.column()] = value
110 if qVersion() >= "5.0.0": 110 self.dataChanged.emit(index, index)
111 self.dataChanged.emit(index, index, [])
112 else:
113 self.dataChanged.emit(index, index)
114 return True 111 return True
115 112
116 def flags(self, index): 113 def flags(self, index):
117 """ 114 """
118 Public method to get item flags. 115 Public method to get item flags.
213 index1 = self.createIndex(row, 0, self.breakpoints[row]) 210 index1 = self.createIndex(row, 0, self.breakpoints[row])
214 index2 = self.createIndex(row, len(self.breakpoints[row]), 211 index2 = self.createIndex(row, len(self.breakpoints[row]),
215 self.breakpoints[row]) 212 self.breakpoints[row])
216 self.dataAboutToBeChanged.emit(index1, index2) 213 self.dataAboutToBeChanged.emit(index1, index2)
217 self.breakpoints[row] = [fn, line] + list(properties) 214 self.breakpoints[row] = [fn, line] + list(properties)
218 if qVersion() >= "5.0.0": 215 self.dataChanged.emit(index1, index2)
219 self.dataChanged.emit(index1, index2, [])
220 else:
221 self.dataChanged.emit(index1, index2)
222 216
223 def setBreakPointEnabledByIndex(self, index, enabled): 217 def setBreakPointEnabledByIndex(self, index, enabled):
224 """ 218 """
225 Public method to set the enabled state of a breakpoint given by index. 219 Public method to set the enabled state of a breakpoint given by index.
226 220
231 row = index.row() 225 row = index.row()
232 col = 4 226 col = 4
233 index1 = self.createIndex(row, col, self.breakpoints[row]) 227 index1 = self.createIndex(row, col, self.breakpoints[row])
234 self.dataAboutToBeChanged.emit(index1, index1) 228 self.dataAboutToBeChanged.emit(index1, index1)
235 self.breakpoints[row][col] = enabled 229 self.breakpoints[row][col] = enabled
236 if qVersion() >= "5.0.0": 230 self.dataChanged.emit(index1, index1)
237 self.dataChanged.emit(index1, index1, [])
238 else:
239 self.dataChanged.emit(index1, index1)
240 231
241 def deleteBreakPointByIndex(self, index): 232 def deleteBreakPointByIndex(self, index):
242 """ 233 """
243 Public method to set the values of a breakpoint given by index. 234 Public method to set the values of a breakpoint given by index.
244 235

eric ide

mercurial