154 if not parent.isValid(): |
154 if not parent.isValid(): |
155 return len(self.watchpoints) > 0 |
155 return len(self.watchpoints) > 0 |
156 else: |
156 else: |
157 return False |
157 return False |
158 |
158 |
159 ############################################################################ |
159 ########################################################################### |
160 |
160 |
161 def addWatchPoint(self, cond, special, properties): |
161 def addWatchPoint(self, cond, special, properties): |
162 """ |
162 """ |
163 Public method to add a new watch expression to the list. |
163 Public method to add a new watch expression to the list. |
164 |
164 |
165 @param cond expression of the watch expression (string) |
165 @param cond expression of the watch expression (string) |
166 @param special special condition of the watch expression (string) |
166 @param special special condition of the watch expression (string) |
167 @param properties properties of the watch expression |
167 @param properties properties of the watch expression |
168 (tuple of temporary flag (bool), enabled flag (bool), ignore count (integer)) |
168 (tuple of temporary flag (bool), enabled flag (bool), |
|
169 ignore count (integer)) |
169 """ |
170 """ |
170 wp = [cond, special] + list(properties) |
171 wp = [cond, special] + list(properties) |
171 cnt = len(self.watchpoints) |
172 cnt = len(self.watchpoints) |
172 self.beginInsertRows(QModelIndex(), cnt, cnt) |
173 self.beginInsertRows(QModelIndex(), cnt, cnt) |
173 self.watchpoints.append(wp) |
174 self.watchpoints.append(wp) |
179 |
180 |
180 @param index index of the watch expression (QModelIndex) |
181 @param index index of the watch expression (QModelIndex) |
181 @param cond expression of the watch expression (string) |
182 @param cond expression of the watch expression (string) |
182 @param special special condition of the watch expression (string) |
183 @param special special condition of the watch expression (string) |
183 @param properties properties of the watch expression |
184 @param properties properties of the watch expression |
184 (tuple of temporary flag (bool), enabled flag (bool), ignore count (integer)) |
185 (tuple of temporary flag (bool), enabled flag (bool), |
|
186 ignore count (integer)) |
185 """ |
187 """ |
186 if index.isValid(): |
188 if index.isValid(): |
187 row = index.row() |
189 row = index.row() |
188 index1 = self.createIndex(row, 0, self.watchpoints[row]) |
190 index1 = self.createIndex(row, 0, self.watchpoints[row]) |
189 index2 = self.createIndex(row, len(self.watchpoints[row]), |
191 index2 = self.createIndex(row, len(self.watchpoints[row]), |
195 i += 1 |
197 i += 1 |
196 self.dataChanged.emit(index1, index2) |
198 self.dataChanged.emit(index1, index2) |
197 |
199 |
198 def setWatchPointEnabledByIndex(self, index, enabled): |
200 def setWatchPointEnabledByIndex(self, index, enabled): |
199 """ |
201 """ |
200 Public method to set the enabled state of a watch expression given by index. |
202 Public method to set the enabled state of a watch expression given by |
|
203 index. |
201 |
204 |
202 @param index index of the watch expression (QModelIndex) |
205 @param index index of the watch expression (QModelIndex) |
203 @param enabled flag giving the enabled state (boolean) |
206 @param enabled flag giving the enabled state (boolean) |
204 """ |
207 """ |
205 if index.isValid(): |
208 if index.isValid(): |
222 del self.watchpoints[row] |
225 del self.watchpoints[row] |
223 self.endRemoveRows() |
226 self.endRemoveRows() |
224 |
227 |
225 def deleteWatchPoints(self, idxList): |
228 def deleteWatchPoints(self, idxList): |
226 """ |
229 """ |
227 Public method to delete a list of watch expressions given by their indexes. |
230 Public method to delete a list of watch expressions given by their |
|
231 indexes. |
228 |
232 |
229 @param idxList list of watch expression indexes (list of QModelIndex) |
233 @param idxList list of watch expression indexes (list of QModelIndex) |
230 """ |
234 """ |
231 rows = [] |
235 rows = [] |
232 for index in idxList: |
236 for index in idxList: |
250 def getWatchPointByIndex(self, index): |
254 def getWatchPointByIndex(self, index): |
251 """ |
255 """ |
252 Public method to get the values of a watch expression given by index. |
256 Public method to get the values of a watch expression given by index. |
253 |
257 |
254 @param index index of the watch expression (QModelIndex) |
258 @param index index of the watch expression (QModelIndex) |
255 @return watch expression (list of six values (expression, special condition, |
259 @return watch expression (list of six values (expression, |
256 temporary flag, enabled flag, ignore count, index)) |
260 special condition, temporary flag, enabled flag, ignore count, |
|
261 index)) |
257 """ |
262 """ |
258 if index.isValid(): |
263 if index.isValid(): |
259 return self.watchpoints[index.row()][:] # return a copy |
264 return self.watchpoints[index.row()][:] # return a copy |
260 else: |
265 else: |
261 return [] |
266 return [] |
262 |
267 |
263 def getWatchPointIndex(self, cond, special=""): |
268 def getWatchPointIndex(self, cond, special=""): |
264 """ |
269 """ |
265 Public method to get the index of a watch expression given by expression. |
270 Public method to get the index of a watch expression given by |
|
271 expression. |
266 |
272 |
267 @param cond expression of the watch expression (string) |
273 @param cond expression of the watch expression (string) |
268 @param special special condition of the watch expression (string) |
274 @param special special condition of the watch expression (string) |
269 @return index (QModelIndex) |
275 @return index (QModelIndex) |
270 """ |
276 """ |