420 counts[TestResultCategory.OK], |
421 counts[TestResultCategory.OK], |
421 counts[TestResultCategory.SKIP], |
422 counts[TestResultCategory.SKIP], |
422 counts[TestResultCategory.PENDING], |
423 counts[TestResultCategory.PENDING], |
423 ) |
424 ) |
424 |
425 |
|
426 def getStatusFilterList(self): |
|
427 """ |
|
428 Public method to get a list of the unique test result status. |
|
429 |
|
430 @return test result status |
|
431 @rtype set of str |
|
432 """ |
|
433 return {t.status for t in self.__testResults} |
|
434 |
|
435 |
|
436 class TestResultsFilterModel(QSortFilterProxyModel): |
|
437 """ |
|
438 Class implementing a filter model to filter the test results by status. |
|
439 """ |
|
440 |
|
441 def __init__(self, parent=None): |
|
442 """ |
|
443 Constructor |
|
444 |
|
445 @param parent reference to the parent object (QObject) |
|
446 """ |
|
447 super().__init__(parent) |
|
448 |
|
449 self.__statusFilterString = "" |
|
450 |
|
451 def filterAcceptsRow(self, sourceRow, sourceParent): |
|
452 """ |
|
453 Public method to determine, if the row is acceptable. |
|
454 |
|
455 @param sourceRow row number in the source model |
|
456 @type int |
|
457 @param sourceParent index of the source item |
|
458 @type QModelIndex |
|
459 @return flag indicating acceptance |
|
460 @rtype bool |
|
461 """ |
|
462 sm = self.sourceModel() |
|
463 idx = sm.index(sourceRow, 0, sourceParent) |
|
464 status = sm.data(idx, Qt.ItemDataRole.DisplayRole) |
|
465 return ( |
|
466 sourceParent.isValid() |
|
467 or self.__statusFilterString == "" |
|
468 or status == self.__statusFilterString |
|
469 ) |
|
470 |
|
471 def setStatusFilterString(self, filterString): |
|
472 """ |
|
473 Public method to set the status filter string. |
|
474 |
|
475 @param filterString status filter string |
|
476 @type str |
|
477 """ |
|
478 self.__statusFilterString = filterString |
|
479 self.invalidateRowsFilter() |
425 |
480 |
426 class TestResultsTreeView(QTreeView): |
481 class TestResultsTreeView(QTreeView): |
427 """ |
482 """ |
428 Class implementing a tree view to show the test result data. |
483 Class implementing a tree view to show the test result data. |
429 |
484 |
450 self.header().setSortIndicatorShown(False) |
505 self.header().setSortIndicatorShown(False) |
451 |
506 |
452 self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) |
507 self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) |
453 |
508 |
454 # connect signals and slots |
509 # connect signals and slots |
455 self.doubleClicked.connect(self.__gotoTestDefinition) |
510 self.activated.connect(self.__gotoTestDefinition) |
456 self.customContextMenuRequested.connect(self.__showContextMenu) |
511 self.customContextMenuRequested.connect(self.__showContextMenu) |
457 |
512 |
458 self.header().sortIndicatorChanged.connect(self.sortByColumn) |
513 self.header().sortIndicatorChanged.connect(self.sortByColumn) |
459 self.header().sortIndicatorChanged.connect( |
514 self.header().sortIndicatorChanged.connect( |
460 lambda col, order: self.header().setSortIndicatorShown(True) # noqa: U100 |
515 lambda col, order: self.header().setSortIndicatorShown(True) # noqa: U100 |
557 @param index index for the double-clicked item |
612 @param index index for the double-clicked item |
558 @type QModelIndex |
613 @type QModelIndex |
559 """ |
614 """ |
560 cindex = self.__canonicalIndex(index) |
615 cindex = self.__canonicalIndex(index) |
561 filename, lineno = self.model().data(cindex, Qt.ItemDataRole.UserRole) |
616 filename, lineno = self.model().data(cindex, Qt.ItemDataRole.UserRole) |
562 if filename is not None: |
617 if filename: |
563 if lineno is None: |
618 if lineno is None: |
564 lineno = 1 |
619 lineno = 1 |
565 self.goto.emit(filename, lineno) |
620 self.goto.emit(filename, lineno) |
566 |
621 |
567 @pyqtSlot(QPoint) |
622 @pyqtSlot(QPoint) |