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