Debugger/BreakPointModel.py

changeset 460
6a3899e91d76
parent 13
1af94a91f439
child 531
26efb720a299
equal deleted inserted replaced
459:0021b759c805 460:6a3899e91d76
11 11
12 class BreakPointModel(QAbstractItemModel): 12 class BreakPointModel(QAbstractItemModel):
13 """ 13 """
14 Class implementing a custom model for breakpoints. 14 Class implementing a custom model for breakpoints.
15 """ 15 """
16 dataAboutToBeChanged = pyqtSignal(QModelIndex, QModelIndex)
17
16 def __init__(self, parent = None): 18 def __init__(self, parent = None):
17 """ 19 """
18 Constructor 20 Constructor
19 21
20 @param reference to the parent widget (QObject) 22 @param reference to the parent widget (QObject)
178 if index.isValid(): 180 if index.isValid():
179 row = index.row() 181 row = index.row()
180 index1 = self.createIndex(row, 0, self.breakpoints[row]) 182 index1 = self.createIndex(row, 0, self.breakpoints[row])
181 index2 = self.createIndex(row, len(self.breakpoints[row]), 183 index2 = self.createIndex(row, len(self.breakpoints[row]),
182 self.breakpoints[row]) 184 self.breakpoints[row])
183 self.emit(\ 185 self.dataAboutToBeChanged.emit(index1, index2)
184 SIGNAL("dataAboutToBeChanged(const QModelIndex &, const QModelIndex &)"),
185 index1, index2)
186 i = 0 186 i = 0
187 for value in [fn, line] + list(properties): 187 for value in [fn, line] + list(properties):
188 self.breakpoints[row][i] = value 188 self.breakpoints[row][i] = value
189 i += 1 189 i += 1
190 self.emit(SIGNAL("dataChanged(const QModelIndex &, const QModelIndex &)"), 190 self.dataChanged.emit(index1, index2)
191 index1, index2)
192 191
193 def setBreakPointEnabledByIndex(self, index, enabled): 192 def setBreakPointEnabledByIndex(self, index, enabled):
194 """ 193 """
195 Public method to set the enabled state of a breakpoint given by index. 194 Public method to set the enabled state of a breakpoint given by index.
196 195
199 """ 198 """
200 if index.isValid(): 199 if index.isValid():
201 row = index.row() 200 row = index.row()
202 col = 4 201 col = 4
203 index1 = self.createIndex(row, col, self.breakpoints[row]) 202 index1 = self.createIndex(row, col, self.breakpoints[row])
204 self.emit(\ 203 self.dataAboutToBeChanged.emit(index1, index1)
205 SIGNAL("dataAboutToBeChanged(const QModelIndex &, const QModelIndex &)"),
206 index1, index1)
207 self.breakpoints[row][col] = enabled 204 self.breakpoints[row][col] = enabled
208 self.emit(SIGNAL("dataChanged(const QModelIndex &, const QModelIndex &)"), 205 self.dataChanged.emit(index1, index1)
209 index1, index1)
210 206
211 def deleteBreakPointByIndex(self, index): 207 def deleteBreakPointByIndex(self, index):
212 """ 208 """
213 Public method to set the values of a breakpoint given by index. 209 Public method to set the values of a breakpoint given by index.
214 210

eric ide

mercurial